/* WarUniverse Auction House — station market UI */
:root {
  --ah-bg0: #040a12;
  --ah-bg1: #0a1624;
  --ah-panel: rgba(8, 18, 32, 0.88);
  --ah-line: rgba(78, 200, 255, 0.22);
  --ah-line-strong: rgba(78, 200, 255, 0.45);
  --ah-cyan: #4ec8ff;
  --ah-cyan-dim: #7eb8d8;
  --ah-gold: #e8c47a;
  --ah-gold-hot: #ffd86b;
  --ah-text: #e8f0f8;
  --ah-muted: #8aa4bc;
  --ah-danger: #ff8a9a;
  --ah-ok: #5dff9a;
  --ah-font: "Outfit", system-ui, sans-serif;
  --ah-display: "Orbitron", "Outfit", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--ah-bg0);
  color: var(--ah-text);
  font-family: var(--ah-font);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* —— atmosphere —— */
.ah-root {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  isolation: isolate;
}

.ah-atmos {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 50% at 12% 0%, rgba(0, 120, 180, 0.28), transparent 55%),
    radial-gradient(ellipse 50% 40% at 90% 85%, rgba(180, 120, 40, 0.12), transparent 50%),
    linear-gradient(165deg, #061018 0%, #040a12 48%, #081422 100%);
  animation: ahDrift 18s ease-in-out infinite alternate;
}

.ah-grid {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(78, 200, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(78, 200, 255, 0.07) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 80%);
  animation: ahGridShift 28s linear infinite;
}

@keyframes ahDrift {
  from { transform: scale(1) translateY(0); }
  to { transform: scale(1.04) translateY(-1.5%); }
}
@keyframes ahGridShift {
  from { background-position: 0 0; }
  to { background-position: 48px 24px; }
}
@keyframes ahIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes ahPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 196, 122, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(232, 196, 122, 0); }
}

.ah-window {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 14px 16px 16px;
  animation: ahIn 0.45s ease-out both;
}

/* —— header —— */
.ah-top-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ah-line);
}

.ah-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ah-brand-mark {
  width: 10px;
  height: 36px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--ah-gold-hot), var(--ah-gold) 55%, transparent);
  box-shadow: 0 0 18px rgba(255, 200, 80, 0.35);
  flex-shrink: 0;
}

.ah-title {
  font-family: var(--ah-display);
  font-size: clamp(0.95rem, 1.6vw, 1.15rem);
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--ah-gold-hot);
  line-height: 1.15;
  text-shadow: 0 0 24px rgba(255, 200, 80, 0.25);
}

.ah-subtitle {
  font-size: 0.72rem;
  color: var(--ah-muted);
  letter-spacing: 0.06em;
  margin-top: 2px;
}

.ah-main-tabs {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}

.ah-main-tab {
  appearance: none;
  border: 1px solid rgba(78, 200, 255, 0.18);
  background: rgba(6, 14, 24, 0.75);
  color: var(--ah-muted);
  font-family: var(--ah-display);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  padding: 8px 14px;
  cursor: pointer;
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
  transition: color 0.2s, background 0.2s, border-color 0.2s, transform 0.15s;
}

.ah-main-tab:hover {
  color: var(--ah-text);
  border-color: var(--ah-line-strong);
  background: rgba(12, 28, 44, 0.9);
}

.ah-main-tab.active {
  color: #0b1220;
  background: linear-gradient(180deg, var(--ah-gold-hot), var(--ah-gold));
  border-color: transparent;
  cursor: default;
}

.ah-timer-chip {
  justify-self: end;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--ah-line);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}

.ah-ends-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ah-muted);
}

.ah-ends-time {
  font-family: var(--ah-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ah-gold-hot);
  font-variant-numeric: tabular-nums;
}

/* —— sub bar —— */
.ah-sub-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0 10px;
  flex-wrap: wrap;
}

.ah-sub-tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.ah-sub-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ah-muted);
  font-family: var(--ah-font);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 8px 14px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.ah-sub-tab:hover { color: var(--ah-cyan); }

.ah-sub-tab.active {
  color: var(--ah-text);
  background: linear-gradient(180deg, rgba(78, 200, 255, 0.2), rgba(78, 200, 255, 0.06));
  box-shadow: inset 0 -2px 0 var(--ah-cyan);
}

.ah-status {
  font-size: 0.75rem;
  color: var(--ah-cyan-dim);
  min-height: 1.2em;
  text-align: right;
}

/* —— layout —— */
.ah-content {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr minmax(220px, 260px);
  gap: 14px;
}

.ah-table-wrapper {
  min-height: 0;
  overflow: auto;
  background: var(--ah-panel);
  border: 1px solid var(--ah-line);
  backdrop-filter: blur(8px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.ah-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.ah-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.ah-table thead th {
  background: linear-gradient(180deg, #122436, #0c1a28);
  padding: 10px 12px;
  font-family: var(--ah-display);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ah-cyan);
  text-align: left;
  border-bottom: 1px solid var(--ah-line-strong);
  white-space: nowrap;
}

.ah-table td {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--ah-text);
  vertical-align: middle;
}

.ah-table tbody tr {
  cursor: pointer;
  transition: background 0.15s ease;
}

.ah-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.015);
}

.ah-table tbody tr:hover {
  background: rgba(78, 200, 255, 0.07);
}

.ah-table tbody tr.selected {
  background: rgba(78, 200, 255, 0.14);
  box-shadow: inset 3px 0 0 var(--ah-cyan);
}

.ah-table th.col-item,
.ah-table td:nth-child(1) { width: 28%; }
.ah-table th.col-type,
.ah-table td:nth-child(2) { width: 10%; text-align: center; }
.ah-table th.col-high,
.ah-table td:nth-child(3) { width: 14%; text-align: center; }
.ah-table th.col-current,
.ah-table td:nth-child(4),
.ah-table th.col-your,
.ah-table td:nth-child(5),
.ah-table th.col-instant,
.ah-table td:nth-child(6) { width: 12%; text-align: right; font-variant-numeric: tabular-nums; }
.ah-table th.col-currency,
.ah-table td:nth-child(7) { width: 10%; text-align: center; }

.ah-item-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.ah-item-icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(78, 200, 255, 0.15);
  padding: 3px;
  flex-shrink: 0;
}

.ah-outbid { color: var(--ah-danger); font-weight: 600; }
.cur-credits { color: #9ad0ff; font-weight: 700; }
.cur-gold { color: #ffd166; font-weight: 700; }
.cur-coins { color: #ffd166; font-weight: 700; }
.cur-uri { color: #7dffb3; font-weight: 700; }

/* —— right panel —— */
.ah-right-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.ah-item-preview {
  position: relative;
  flex: 1;
  min-height: 160px;
  padding: 16px 14px 12px;
  text-align: center;
  background: linear-gradient(165deg, rgba(10, 28, 44, 0.95), rgba(6, 14, 24, 0.98));
  border: 1px solid var(--ah-line);
  overflow: hidden;
  animation: ahIn 0.35s ease-out both;
}

.ah-preview-glow {
  position: absolute;
  inset: -20% 10% auto;
  height: 55%;
  background: radial-gradient(ellipse at center, rgba(78, 200, 255, 0.22), transparent 70%);
  pointer-events: none;
  animation: ahDrift 10s ease-in-out infinite alternate;
}

.ah-preview-image {
  position: relative;
  width: 108px;
  height: 108px;
  object-fit: contain;
  margin: 0 auto 10px;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.45));
}

.ah-preview-name {
  position: relative;
  font-family: var(--ah-display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.ah-preview-empty {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 160px;
  padding: 20px;
  text-align: center;
  color: var(--ah-muted);
  font-size: 0.85rem;
  border: 1px dashed rgba(78, 200, 255, 0.2);
  background: rgba(0, 0, 0, 0.2);
}

.itemInfos { position: relative; }
.itemInfos .amount {
  color: var(--ah-gold-hot);
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 8px;
}
.itemInfos .description {
  font-size: 0.78rem;
  color: var(--ah-cyan-dim);
  line-height: 1.45;
  max-height: 88px;
  overflow: auto;
  text-align: left;
}

.ah-bid-label {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ah-muted);
}

.ah-bid-input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--ah-line);
  background: rgba(2, 8, 16, 0.9);
  color: var(--ah-text);
  font-family: var(--ah-display);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.04em;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.ah-bid-input:focus {
  outline: none;
  border-color: var(--ah-cyan);
  box-shadow: 0 0 0 3px rgba(78, 200, 255, 0.15);
}

.ah-bid-buttons {
  display: grid;
  gap: 8px;
}

.ah-bid-btn,
.ah-instant-btn {
  appearance: none;
  border: 0;
  width: 100%;
  padding: 12px 14px;
  font-family: var(--ah-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  cursor: pointer;
  transition: transform 0.12s, filter 0.15s, box-shadow 0.2s;
}

.ah-bid-btn {
  color: #061018;
  background: linear-gradient(180deg, #6ed4ff, #2a9fd4);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}

.ah-instant-btn {
  color: #1a1204;
  background: linear-gradient(180deg, var(--ah-gold-hot), #c9923a);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}

.ah-bid-btn:hover,
.ah-instant-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.ah-bid-btn:active,
.ah-instant-btn:active {
  transform: translateY(1px);
}

/* —— win overlay —— */
.ah-win-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  background: rgba(2, 6, 12, 0.72);
  backdrop-filter: blur(4px);
  animation: ahIn 0.25s ease-out;
}

.ah-win-card {
  width: min(400px, 92vw);
  padding: 22px 20px 16px;
  background: linear-gradient(165deg, #14304a, #081018);
  border: 1px solid rgba(232, 196, 122, 0.55);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  animation: ahPulse 2.2s ease-out 1;
}

.ah-win-title {
  font-family: var(--ah-display);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ah-gold-hot);
  text-align: center;
  margin-bottom: 14px;
}

.ah-win-list {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  max-height: 45vh;
  overflow: auto;
}

.ah-win-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(78, 200, 255, 0.18);
}

.ah-win-row img { width: 44px; height: 44px; object-fit: contain; }
.ah-win-row strong { display: block; color: #fff; }
.ah-win-row span { color: var(--ah-cyan-dim); font-size: 0.82rem; }

.ah-win-ok {
  width: 100%;
  border: 0;
  padding: 11px;
  cursor: pointer;
  font-family: var(--ah-display);
  font-weight: 700;
  letter-spacing: 0.12em;
  background: linear-gradient(180deg, var(--ah-gold-hot), #c9923a);
  color: #1a1204;
}

/* —— popups / errors —— */
#popupContainer {
  position: fixed;
  right: 16px;
  top: 16px;
  width: 280px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.popup {
  background: linear-gradient(145deg, rgba(8, 18, 32, 0.98), rgba(4, 12, 22, 0.98));
  border: 1px solid var(--ah-line-strong);
  padding: 12px 14px;
  color: var(--ah-text);
  font-size: 0.8rem;
  line-height: 1.4;
}

.ls-hud-error {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.94);
  background: linear-gradient(180deg, rgba(20, 30, 45, 0.96), rgba(5, 10, 18, 0.96));
  border: 1px solid rgba(0, 200, 255, 0.55);
  padding: 14px 26px;
  font-size: 0.9rem;
  color: #dff6ff;
  opacity: 0;
  transition: 0.3s ease;
  z-index: 999999;
  pointer-events: none;
}

.ls-hud-error.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* —— scrollbars —— */
.ah-table-wrapper::-webkit-scrollbar,
.itemInfos .description::-webkit-scrollbar {
  width: 8px;
}
.ah-table-wrapper::-webkit-scrollbar-thumb,
.itemInfos .description::-webkit-scrollbar-thumb {
  background: rgba(78, 200, 255, 0.28);
  border-radius: 4px;
}

@media (max-width: 820px) {
  .ah-top-bar {
    grid-template-columns: 1fr;
    justify-items: start;
  }
  .ah-main-tabs { justify-content: flex-start; }
  .ah-timer-chip { justify-self: start; }
  .ah-content {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }
  .ah-right-panel {
    max-height: 42vh;
  }
}
