/* ═══════════════════════════════════════════════════════════
   WOOT DEAL SNIPER — Design System v5
   ═══════════════════════════════════════════════════════════ */

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

:root {
  /* ── Surfaces ── */
  --bg:        #07070f;
  --bg2:       #0c0c18;
  --surface:   #0f0f1e;
  --surface2:  #15152a;
  --surface3:  #1c1c36;
  --surface-h: #1a1a34;

  /* ── Borders ── */
  --border:    rgba(255,255,255,0.04);
  --border2:   rgba(255,255,255,0.07);
  --border3:   rgba(255,255,255,0.11);
  --border-h:  rgba(255,255,255,0.14);

  /* ── Text ── */
  --text:      #f0f0f8;
  --text2:     #9494b0;
  --text3:     #5c5c78;
  --text4:     #3e3e54;

  /* ── Brand ── */
  --accent:    #e94560;
  --accent-h:  #ff5a75;
  --accent-bg: rgba(233,69,96,0.06);
  --accent-b:  rgba(233,69,96,0.12);

  /* ── Semantic ── */
  --green:     #2dd4a8;
  --green-bg:  rgba(45,212,168,0.07);
  --green-b:   rgba(45,212,168,0.18);
  --orange:    #f59e0b;
  --orange-bg: rgba(245,158,11,0.07);
  --orange-b:  rgba(245,158,11,0.18);
  --red:       #f87171;
  --red-bg:    rgba(248,113,113,0.07);
  --red-b:     rgba(248,113,113,0.18);
  --blue:      #60a5fa;
  --blue-bg:   rgba(96,165,250,0.07);
  --blue-b:    rgba(96,165,250,0.15);
  --purple:    #a78bfa;
  --purple-bg: rgba(167,139,250,0.07);

  /* ── Elevation ── */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-sm: 0 2px 6px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.35);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.45);
  --shadow-xl: 0 24px 64px rgba(0,0,0,0.5);

  /* ── Radii ── */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-full: 999px;

  /* ── Motion ── */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --t-fast: 0.12s var(--ease);
  --t-base: 0.2s var(--ease);
  --t-slow: 0.3s var(--ease);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  font-size: 13px;
  line-height: 1.5;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.16); }
::-webkit-scrollbar-track { background: transparent; }

/* ═══════════════════════════════════════════════════════════
   HEADER / TOP BAR
   ═══════════════════════════════════════════════════════════ */

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 50px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border2);
  position: relative;
  z-index: 20;
}

/* Accent line under header */
header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--accent) 0%, transparent 50%);
  opacity: 0.4;
}

.header-left { display: flex; align-items: center; gap: 12px; }
.header-right { display: flex; align-items: center; gap: 8px; }

.logo { font-size: 22px; line-height: 1; filter: drop-shadow(0 0 6px rgba(233,69,96,0.3)); }

header h1 {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, var(--text) 0%, var(--text2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Status Pill ── */
.status-pill {
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  position: relative;
}
.status-pill.live {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-b);
}
.status-pill.live::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  margin-right: 5px;
  animation: pulse-dot 2s ease infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.status-pill.connecting {
  background: var(--orange-bg);
  color: var(--orange);
  border: 1px solid var(--orange-b);
}
.status-pill.offline {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red-b);
}

/* ── User Badge ── */
.user-badge {
  padding: 4px 14px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 700;
  color: var(--blue);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

/* ── Header Buttons ── */
.btn-icon {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  opacity: 0.45;
  transition: var(--t-fast);
  color: var(--text);
}
.btn-icon:hover { opacity: 1; background: var(--surface2); }

.btn-advanced-view {
  color: var(--text3);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 12px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--r-full);
  transition: var(--t-fast);
  white-space: nowrap;
  letter-spacing: 0.2px;
}
.btn-advanced-view:hover {
  color: var(--text);
  background: var(--surface3);
  border-color: var(--border3);
}

/* ═══════════════════════════════════════════════════════════
   MAIN LAYOUT — TWO PANEL SPLIT
   ═══════════════════════════════════════════════════════════ */

main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: calc(100vh - 50px);
  background: var(--bg);
}

.panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}
.panel + .panel { border-left: 1px solid var(--border2); }

/* ── Panel Header ── */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  height: 40px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-header h2 {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text3);
}

.deal-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--text4);
  font-variant-numeric: tabular-nums;
}

/* ── Deal List Container ── */
.deal-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 6px;
}

/* ═══════════════════════════════════════════════════════════
   DEAL CARDS
   ═══════════════════════════════════════════════════════════ */

.deal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 12px;
  margin-bottom: 3px;
  transition: background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-base);
  animation: card-enter 0.2s var(--ease);
  cursor: default;
  position: relative;
}

.deal-card:hover {
  background: var(--surface-h);
  border-color: var(--border3);
}

/* Type indicators */
.deal-card.keyword {
  border-left: 2px solid var(--accent);
}
.deal-card.priority {
  border-left: 2px solid var(--green);
  animation: card-enter 0.2s var(--ease), pulse-priority 0.8s var(--ease);
}

@keyframes card-enter {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-priority {
  0%, 100% { background: var(--surface); }
  40% { background: var(--green-bg); }
}

/* ── Card Layout ── */
.deal-top {
  display: flex;
  gap: 10px;
  align-items: center;
}

.deal-thumb {
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  object-fit: cover;
  background: var(--surface2);
  flex-shrink: 0;
  border: 1px solid var(--border2);
}

.deal-info { flex: 1; min-width: 0; }

.deal-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
  letter-spacing: -0.1px;
}

/* ── Price Row ── */
.deal-price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 1px;
}

.deal-price strong {
  color: var(--green);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.4px;
}

.deal-price del {
  color: var(--text4);
  font-size: 11px;
  font-weight: 400;
}

/* ── Discount Badge ── */
.discount-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  border-radius: var(--r-xs);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.3px;
}
.discount-badge.hot   { background: var(--red-bg);    color: var(--red);    border: 1px solid var(--red-b); }
.discount-badge.great { background: var(--orange-bg); color: var(--orange); border: 1px solid var(--orange-b); }
.discount-badge.good  { background: var(--green-bg);  color: var(--green);  border: 1px solid var(--green-b); }

/* ── Meta Row ── */
.deal-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.deal-tag {
  padding: 1px 6px;
  background: var(--surface2);
  border-radius: var(--r-xs);
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text3);
  border: 1px solid var(--border);
  letter-spacing: 0.2px;
}

.deal-tag.kw {
  color: var(--accent-h);
  background: var(--accent-bg);
  border-color: var(--accent-b);
}

.deal-tag.restock {
  color: var(--orange);
  background: var(--orange-bg);
  border-color: var(--orange-b);
  font-weight: 700;
}

.deal-tag.wootoff {
  color: var(--purple);
  background: var(--purple-bg);
  border-color: rgba(167,139,250,0.18);
  font-weight: 700;
}

.deal-tag.review {
  color: var(--orange);
  background: var(--orange-bg);
  border-color: var(--orange-b);
}

.deal-tag.stock {
  color: var(--blue);
  background: var(--blue-bg);
  border-color: var(--blue-b);
}

.btn-amazon {
  padding: 4px 10px;
  background: var(--surface3);
  color: var(--text3);
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  font-size: 9.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: var(--t-fast);
  font-family: monospace;
  letter-spacing: 0.3px;
}
.btn-amazon:hover { background: var(--surface-h); color: var(--text); border-color: var(--border3); }

.deal-tag.sold-out {
  color: var(--red);
  background: var(--red-bg);
  border-color: var(--red-b);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.deal-card.sold-out {
  opacity: 0.55;
}
.deal-card.sold-out:hover {
  opacity: 0.75;
}

.deal-time {
  font-size: 9.5px;
  color: var(--text4);
  margin-left: auto;
  font-weight: 500;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ── Actions ── */
.deal-actions {
  margin-top: 7px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-open {
  padding: 4px 12px;
  background: var(--surface3);
  color: var(--text2);
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--t-fast);
  letter-spacing: 0.2px;
}
.btn-open:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(233,69,96,0.25);
}
.btn-open:active { transform: scale(0.97); }

.btn-atc {
  padding: 4px 12px;
  background: var(--green);
  color: #000;
  border: none;
  border-radius: var(--r-sm);
  font-size: 10.5px;
  font-weight: 800;
  cursor: pointer;
  transition: var(--t-fast);
  letter-spacing: 0.3px;
}
.btn-atc:hover { background: #4ade80; box-shadow: 0 2px 8px rgba(45,212,168,0.3); }
.btn-atc:active { transform: scale(0.97); }

/* ═══════════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════════ */

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 200px;
  color: var(--text4);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

/* ═══════════════════════════════════════════════════════════
   LOGIN OVERLAY
   ═══════════════════════════════════════════════════════════ */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(4,4,12,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(16px) saturate(150%);
}
.overlay.hidden { display: none; }
.hidden { display: none; }

.overlay-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r-lg);
  padding: 40px 36px;
  text-align: center;
  max-width: 360px;
  width: 90%;
  box-shadow: var(--shadow-xl), 0 0 80px rgba(233,69,96,0.04);
}

.overlay-icon { font-size: 36px; margin-bottom: 14px; filter: drop-shadow(0 0 8px rgba(233,69,96,0.3)); }
.overlay-card h2 { font-size: 18px; font-weight: 800; margin-bottom: 4px; letter-spacing: -0.4px; }
.overlay-card p { color: var(--text3); font-size: 12px; margin-bottom: 20px; }

/* ═══════════════════════════════════════════════════════════
   SETTINGS MODAL
   ═══════════════════════════════════════════════════════════ */

.settings-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r-lg);
  padding: 24px;
  max-width: 440px;
  width: 92%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.settings-header h3 {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.btn-close {
  background: var(--surface2);
  border: 1px solid var(--border2);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  font-size: 16px;
  color: var(--text3);
  cursor: pointer;
  transition: var(--t-fast);
}
.btn-close:hover { background: var(--surface3); color: var(--text); border-color: var(--border3); }

.settings-section {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.settings-section:last-child { border-bottom: none; margin-bottom: 0; }

.settings-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.settings-desc {
  font-size: 11px;
  color: var(--text4);
  margin-bottom: 8px;
  line-height: 1.45;
}

/* ═══════════════════════════════════════════════════════════
   FORM ELEMENTS
   ═══════════════════════════════════════════════════════════ */

.input {
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  outline: none;
  width: 100%;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.input::placeholder { color: var(--text4); }

.input-row { display: flex; gap: 8px; margin-top: 8px; }

.btn {
  padding: 8px 16px;
  border: none;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--t-fast);
  white-space: nowrap;
  letter-spacing: 0.2px;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
  margin-top: 14px;
  padding: 10px 16px;
  font-size: 13px;
  border-radius: var(--r-md);
}
.btn-primary:hover { background: var(--accent-h); box-shadow: 0 4px 12px rgba(233,69,96,0.3); }

.btn-small {
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 700;
  background: var(--surface2);
  color: var(--text2);
  border: 1px solid var(--border2);
}
.btn-small:hover { background: var(--surface3); color: var(--text); border-color: var(--border3); }

.btn-accent { background: var(--accent); color: #fff; border: none; }
.btn-accent:hover { background: var(--accent-h); }

.btn-danger { background: rgba(220,38,38,0.15); color: #fca5a5; border: 1px solid rgba(220,38,38,0.2); }
.btn-danger:hover { background: rgba(220,38,38,0.25); color: #fff; }

/* ── Tags ── */
.tag-container { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.tag.filter { background: var(--blue-bg); color: var(--blue); border: 1px solid var(--blue-b); }
.tag.autoopen { background: var(--accent-bg); color: var(--accent-h); border: 1px solid var(--accent-b); }

.tag .remove {
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  opacity: 0.35;
  transition: var(--t-fast);
}
.tag .remove:hover { opacity: 1; }

/* Checkboxes */
.settings-section input[type="checkbox"] {
  accent-color: var(--accent);
  margin-right: 5px;
  transform: translateY(0.5px);
}

/* ═══════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════ */

#toast {
  background: var(--surface3) !important;
  border: 1px solid var(--border3) !important;
  backdrop-filter: blur(8px) !important;
  box-shadow: var(--shadow-md) !important;
  border-radius: var(--r-md) !important;
  font-weight: 600 !important;
  letter-spacing: 0.2px !important;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
  header { padding: 0 14px; }
  .header-right { gap: 6px; }
}

@media (max-width: 768px) {
  main {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }
  .panel + .panel {
    border-left: none;
    border-top: 1px solid var(--border2);
  }
  .btn-advanced-view { font-size: 10px; padding: 4px 8px; }
}

@media (max-width: 480px) {
  header { padding: 0 10px; height: 44px; }
  header h1 { display: none; }
  .btn-advanced-view { display: none; }
  .panel-header { padding: 0 10px; height: 36px; }
  .panel-header h2 { font-size: 10px; }
  .deal-list { padding: 2px 4px; }
  .deal-card { padding: 8px 10px; }
  .deal-thumb { width: 36px; height: 36px; }
}
