@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg:           #0b0f19;
  --surface:      #111827;
  --surface2:     #1a2235;
  --border:       #1f2d45;
  --border-light: #263346;
  --text:         #e2e8f4;
  --text-muted:   #64748b;
  --text-dim:     #94a3b8;
  --accent:       #facc15;
  --accent-text:  #0b0f19;
  --green:        #4ade80;
  --green-dim:    #166534;
  --blue:         #38bdf8;
  --danger:       #f87171;
  --radius:       14px;
  --radius-sm:    8px;
  --font:         "Inter", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Header ─────────────────────────────────────── */
.header {
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #0d1525 0%, var(--bg) 100%);
}

.header-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 1.25rem;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-icon {
  font-size: 2.25rem;
  line-height: 1;
  filter: drop-shadow(0 0 12px rgba(250,204,21,0.5));
}

h1 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.15;
}

.sub {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: right;
}

.error {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0.6rem 1.5rem;
  color: var(--danger);
  font-size: 0.875rem;
}

/* ── Layout ──────────────────────────────────────── */
main {
  max-width: 1160px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ── Panel base ──────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem 1.5rem;
}

.panel h2 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

/* ── Just Landed panel ───────────────────────────── */
.panel-landed {
  background: linear-gradient(135deg, #0d1a0f 0%, #0f1f14 100%);
  border-color: #1e3a22;
  position: relative;
  overflow: hidden;
}

.panel-landed::after {
  content: "";
  position: absolute;
  top: -60px; right: -60px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(74,222,128,0.07) 0%, transparent 70%);
  pointer-events: none;
}

.panel-landed.has-items {
  border-color: rgba(74, 222, 128, 0.5);
  animation: landed-glow 3s ease-in-out infinite alternate;
}

@keyframes landed-glow {
  from { box-shadow: 0 0 0 0 rgba(74,222,128,0); }
  to   { box-shadow: 0 0 28px 2px rgba(74,222,128,0.14); }
}

.panel-landed-header { margin-bottom: 0.75rem; }

.landed-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}

.landed-title-row h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
}

.landed-icon { font-size: 1.1rem; }

.badge-landed {
  background: #16a34a;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
}

.panel-landed.has-items .badge-landed {
  background: var(--green);
  color: #052e16;
  animation: badge-pulse 1.8s ease-in-out infinite;
}

@keyframes badge-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(74,222,128,0.4); }
  50%       { transform: scale(1.1); box-shadow: 0 0 0 5px rgba(74,222,128,0); }
}

.landed-empty {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  padding: 0.25rem 0 0.5rem;
}

.landed-empty-icon {
  width: 1.4rem; height: 1.4rem;
  background: rgba(74,222,128,0.15);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--green);
  flex-shrink: 0;
}

/* ── Out-of-stock panel ──────────────────────────── */
.panel-oos {
  background: var(--bg);
  border-color: var(--border);
  opacity: 0.85;
}

.panel-oos h2 { color: var(--text-muted); }

/* ── Toolbar (store toggles + stat chips) ────────── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1.25rem;
}

.store-toggles {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.controls-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-right: 0.25rem;
}

.store-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s;
}

.toggle-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
  transition: background 0.15s;
}

.store-toggle.active {
  background: rgba(250,204,21,0.1);
  color: var(--accent);
  border-color: rgba(250,204,21,0.35);
}

.store-toggle.active .toggle-dot {
  background: var(--accent);
  box-shadow: 0 0 5px rgba(250,204,21,0.6);
}

/* Store-specific toggle colors */
.store-toggle[data-source="jbhifi"].active {
  background: rgba(250,204,21,0.12);
  color: #facc15;
  border-color: rgba(250,204,21,0.25);
}

.store-toggle[data-source="jbhifi"].active .toggle-dot {
  background: #facc15;
  box-shadow: 0 0 5px rgba(250,204,21,0.6);
}

.store-toggle[data-source="target"].active {
  background: rgba(239,68,68,0.12);
  color: #f87171;
  border-color: rgba(239,68,68,0.25);
}

.store-toggle[data-source="target"].active .toggle-dot {
  background: #f87171;
  box-shadow: 0 0 5px rgba(239,68,68,0.6);
}

.store-toggle[data-source="kmart"].active {
  background: rgba(56,189,248,0.12);
  color: #38bdf8;
  border-color: rgba(56,189,248,0.25);
}

.store-toggle[data-source="kmart"].active .toggle-dot {
  background: #38bdf8;
  box-shadow: 0 0 5px rgba(56,189,248,0.6);
}

.store-toggle[data-source="bigw"].active {
  background: rgba(34,197,94,0.12);
  color: #4ade80;
  border-color: rgba(34,197,94,0.25);
}

.store-toggle[data-source="bigw"].active .toggle-dot {
  background: #4ade80;
  box-shadow: 0 0 5px rgba(34,197,94,0.6);
}

.store-toggle:hover:not(.active) {
  border-color: var(--text-muted);
  color: var(--text-dim);
}

/* Store-specific hover colors */
.store-toggle[data-source="jbhifi"]:hover:not(.active) {
  border-color: rgba(250,204,21,0.5);
  color: rgba(250,204,21,0.8);
}

.store-toggle[data-source="target"]:hover:not(.active) {
  border-color: rgba(239,68,68,0.5);
  color: rgba(239,68,68,0.8);
}

.store-toggle[data-source="kmart"]:hover:not(.active) {
  border-color: rgba(56,189,248,0.5);
  color: rgba(56,189,248,0.8);
}

.store-toggle[data-source="bigw"]:hover:not(.active) {
  border-color: rgba(34,197,94,0.5);
  color: rgba(34,197,94,0.8);
}

.stat-chips {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dim);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
}

.chip-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.chip-dot-green { background: var(--green); }
.chip-dot-grey  { background: var(--text-muted); }

/* ── Table ───────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead tr {
  border-bottom: 1px solid var(--border);
}

th {
  padding: 0.55rem 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  text-align: left;
}

td {
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}

tbody tr:last-child td { border-bottom: none; }

tbody tr {
  transition: background 0.1s;
}

tbody tr:hover { background: var(--surface2); }

/* source badge in table */
.source-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.source-badge.jbhifi {
  background: rgba(250,204,21,0.12);
  color: #facc15;
  border: 1px solid rgba(250,204,21,0.25);
}

.source-badge.target {
  background: rgba(239,68,68,0.12);
  color: #f87171;
  border: 1px solid rgba(239,68,68,0.25);
}

.source-badge.kmart {
  background: rgba(56,189,248,0.12);
  color: #38bdf8;
  border: 1px solid rgba(56,189,248,0.25);
}

.source-badge.bigw {
  background: rgba(34,197,94,0.12);
  color: #4ade80;
  border: 1px solid rgba(34,197,94,0.25);
}

.badge-preorder {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  background: rgba(167,139,250,0.15);
  color: #a78bfa;
  border: 1px solid rgba(167,139,250,0.3);
  margin-left: 0.4rem;
  vertical-align: middle;
}

.chip-dot-blue {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #60a5fa;
  flex-shrink: 0;
}

.price-cell {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.sku-cell {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--surface2);
  color: var(--blue);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: var(--font);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}

.link-btn:hover {
  background: rgba(56,189,248,0.1);
  border-color: rgba(56,189,248,0.4);
  text-decoration: none;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover { text-decoration: underline; }

/* ── Footer ──────────────────────────────────────── */
.footer {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 1.5rem 2.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.footer code {
  font-size: 0.8em;
  background: var(--surface);
  color: var(--text-dim);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  border: 1px solid var(--border);
}
