/* ═══════════════════════════════════════════════════════════════════════════
   WootDeals — Deal-First Design System
   Focus: clarity, scanability, and putting the deal front-and-center
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── CSS Custom Properties ──────────────────────────────────────────────── */

:root {
  /* Colors — Neutral Palette */
  --gray-50: #fafafa;
  --gray-100: #f4f4f5;
  --gray-200: #e4e4e7;
  --gray-300: #d4d4d8;
  --gray-400: #a1a1aa;
  --gray-500: #71717a;
  --gray-600: #52525b;
  --gray-700: #3f3f46;
  --gray-800: #27272a;
  --gray-900: #18181b;
  --gray-950: #09090b;

  /* Accent — Energetic Orange-Gold (deal energy) */
  --accent-50: #fff7ed;
  --accent-100: #ffedd5;
  --accent-200: #fed7aa;
  --accent-300: #fdba74;
  --accent-400: #fb923c;
  --accent-500: #f97316;
  --accent-600: #ea580c;
  --accent-700: #c2410c;

  /* Success Green */
  --success-50: #f0fdf4;
  --success-100: #dcfce7;
  --success-500: #22c55e;
  --success-600: #16a34a;
  --success-700: #15803d;

  /* Danger Red */
  --danger-50: #fef2f2;
  --danger-100: #fee2e2;
  --danger-500: #ef4444;
  --danger-600: #dc2626;

  /* Gradients */
  --gradient-hero: linear-gradient(135deg, #18181b 0%, #27272a 50%, #3f3f46 100%);
  --gradient-accent: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  --gradient-score-high: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  --gradient-score-mid: linear-gradient(135deg, #eab308 0%, #ca8a04 100%);
  --gradient-score-low: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);

  /* Typography */
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;

  /* Layout */
  --content-max-width: 1340px;
  --nav-height: 64px;
  --subnav-height: 52px;

  /* Radii */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-xl: 0 24px 56px rgba(0,0,0,0.12), 0 8px 24px rgba(0,0,0,0.06);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset ───────────────────────────────────────────────────────────────── */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background: var(--gray-50);
  color: var(--gray-900);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* ── Global Loading Bar ──────────────────────────────────────────────────── */

.loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  overflow: hidden;
  transition: opacity var(--transition-base);
}

.loading-bar.active {
  opacity: 1;
}

.loading-bar-progress {
  height: 100%;
  width: 0%;
  background: var(--gradient-accent);
  border-radius: 0 2px 2px 0;
  transition: width 0.15s ease;
}

.loading-bar.active .loading-bar-progress {
  animation: loading-bar-stripe 1.8s ease-in-out infinite;
}

@keyframes loading-bar-stripe {
  0%   { transform: translateX(-100%); }
  40%  { transform: translateX(-30%); }
  70%  { transform: translateX(0%); }
  100% { transform: translateX(100%); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOP NAVIGATION BAR
   ═══════════════════════════════════════════════════════════════════════════ */

.top-nav {
  background: var(--gray-950);
  border-bottom: 1px solid var(--gray-800);
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  display: flex;
  align-items: center;
}

.nav-inner {
  max-width: var(--content-max-width);
  width: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

/* Brand */
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  text-decoration: none;
}

.brand-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.brand-text {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}

.brand-accent {
  color: var(--accent-500);
}

/* Search */
.nav-search {
  flex: 1;
  max-width: 540px;
  position: relative;
}

.nav-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--gray-400);
  pointer-events: none;
  transition: color var(--transition-base);
}

.nav-search input {
  width: 100%;
  height: 42px;
  padding: 0 40px 0 42px;
  background: var(--gray-900);
  border: 1px solid var(--gray-700);
  border-radius: var(--radius-full);
  color: #fff;
  font-size: 0.9rem;
  outline: none;
  transition: all var(--transition-base);
}

.nav-search input::placeholder { color: var(--gray-500); }
.nav-search input:focus {
  border-color: var(--accent-500);
  box-shadow: 0 0 0 3px rgba(249,115,22,0.15);
}

.nav-search input:focus ~ .nav-search-icon,
.nav-search input:focus + .nav-search-icon { color: var(--accent-400); }

.nav-search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border: none;
  background: var(--gray-700);
  color: var(--gray-300);
  border-radius: 50%;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-fast);
}

.nav-search-clear.visible {
  opacity: 1;
  pointer-events: auto;
}

.nav-search-clear:hover {
  background: var(--gray-600);
  color: #fff;
}

/* Nav actions */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.nav-btn {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-900);
  border: 1px solid var(--gray-700);
  border-radius: var(--radius-full);
  color: var(--gray-300);
  transition: all var(--transition-base);
}

.nav-btn:hover {
  background: var(--gray-800);
  border-color: var(--gray-600);
  color: #fff;
}

/* Toggle switch */
.nav-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  padding: 4px 0;
}

.nav-toggle input { display: none; }

.toggle-track {
  width: 44px;
  height: 26px;
  background: var(--gray-700);
  border-radius: var(--radius-full);
  position: relative;
  transition: background var(--transition-base);
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition-base);
  box-shadow: var(--shadow-sm);
}

.nav-toggle input:checked + .toggle-track {
  background: var(--accent-500);
}

.nav-toggle input:checked + .toggle-track .toggle-thumb {
  transform: translateX(18px);
}

.toggle-label-text {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--gray-400);
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SUB NAVIGATION (Categories + Sort)
   ═══════════════════════════════════════════════════════════════════════════ */

.sub-nav {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: var(--nav-height);
  z-index: 99;
  height: var(--subnav-height);
  display: flex;
  align-items: center;
  overflow: hidden;
}

.sub-nav-inner {
  max-width: var(--content-max-width);
  width: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}

/* Category Tabs */
.category-scroll {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex: 1;
  min-width: 0;
}
.category-scroll::-webkit-scrollbar { display: none; }

.cat-tab {
  padding: 8px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  background: transparent;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--gray-600);
  white-space: nowrap;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.cat-tab:hover {
  color: var(--gray-900);
  background: var(--gray-100);
}

.cat-tab.active {
  background: var(--gray-900);
  color: #fff;
  border-color: var(--gray-900);
}

/* Sort Group */
.sort-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.sort-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.sort-group select {
  padding: 9px 32px 9px 14px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-full);
  background: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-800);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: all var(--transition-fast);
}

.sort-group select:hover { border-color: var(--gray-300); }
.sort-group select:focus {
  border-color: var(--accent-500);
  box-shadow: 0 0 0 3px rgba(249,115,22,0.1);
}

.price-filter-label {
  margin-left: 4px;
}

.price-input {
  width: 84px;
  padding: 8px 10px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-full);
  background: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-800);
  outline: none;
  transition: all var(--transition-fast);
}

.price-input::placeholder {
  color: var(--gray-400);
  font-weight: 400;
}

.price-input:hover { border-color: var(--gray-300); }
.price-input:focus {
  border-color: var(--accent-500);
  box-shadow: 0 0 0 3px rgba(249,115,22,0.1);
}

.price-sep {
  color: var(--gray-400);
  font-size: 0.85rem;
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════════════════
   STATS RIBBON — compact subtle info bar
   ═══════════════════════════════════════════════════════════════════════════ */

.stats-ribbon {
  max-width: var(--content-max-width);
  margin: 16px auto 0;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.stat-item {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: none;
  box-shadow: none;
}

.stat-item:hover {
  box-shadow: none;
  transform: none;
}

.stat-icon {
  font-size: 0.85rem;
  line-height: 1;
  flex-shrink: 0;
  opacity: 0.7;
}

.stat-info {
  display: inline-flex;
  flex-direction: row;
  align-items: baseline;
  gap: 4px;
}

.stat-value {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-600);
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.stat-value.active-count { color: var(--success-600); }
.stat-value.sold-count { color: var(--danger-500); }

.stat-label {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--gray-400);
  text-transform: none;
  letter-spacing: 0.02em;
  margin-top: 0;
}

.stat-label::before { content: "· "; color: var(--gray-300); }

.stat-highlight {
  border: none;
  background: transparent;
  margin-left: auto;
}

.stat-highlight .stat-value { color: var(--accent-600); }

/* ═══════════════════════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════════════════════ */

main {
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 24px 24px 48px;
}

/* Active Filters */
.active-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-50);
  border: 1px solid var(--accent-200);
  color: var(--accent-700);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-full);
}

.filter-chip-remove {
  background: none;
  border: none;
  color: var(--accent-500);
  font-size: 1.1rem;
  padding: 0;
  line-height: 1;
  display: flex;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.filter-chip-remove:hover { color: var(--accent-700); }

.filter-clear-all {
  background: none;
  border: none;
  color: var(--gray-500);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  padding: 4px 6px;
}

.filter-clear-all:hover { color: var(--gray-800); }

/* ═══════════════════════════════════════════════════════════════════════════
   DEALS SECTION HEADER
   ═══════════════════════════════════════════════════════════════════════════ */

.deals-section-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.deals-section-header h2 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -0.02em;
}

.deals-count-pill {
  background: var(--gray-900);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: var(--radius-full);
}

/* View Toggle */
.view-toggle {
  display: flex;
  margin-left: auto;
  background: var(--gray-100);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
}

.view-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  color: var(--gray-400);
  transition: all var(--transition-fast);
}

.view-btn.active {
  background: #fff;
  color: var(--gray-900);
  box-shadow: var(--shadow-sm);
}

.view-btn:hover:not(.active) { color: var(--gray-600); }

/* ═══════════════════════════════════════════════════════════════════════════
   DEALS GRID (Card Layout)
   ═══════════════════════════════════════════════════════════════════════════ */

.deals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

/* List view override */
.deals-grid.list-view {
  grid-template-columns: 1fr;
  gap: 12px;
}

/* ── Deal Card ───────────────────────────────────────────────────────────── */

.deal-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  display: flex;
  flex-direction: column;
}

.deal-card:hover {
  border-color: var(--accent-300);
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

.deal-card:active { transform: translateY(-1px); }

/* List view card */
.deals-grid.list-view .deal-card {
  flex-direction: row;
  align-items: center;
}

/* ── Card Image ──────────────────────────────────────────────────────────── */

.card-image-wrapper {
  position: relative;
  width: 100%;
  padding-top: 66.67%;
  background: var(--gray-50);
  overflow: hidden;
  flex-shrink: 0;
}

.deals-grid.list-view .card-image-wrapper {
  width: 180px;
  padding-top: 120px;
  align-self: stretch;
}

.card-image-wrapper img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 20px;
  transition: transform var(--transition-slow);
}

.deal-card:hover .card-image-wrapper img {
  transform: scale(1.06);
}

/* ── Sold Out Overlay ────────────────────────────────────────────────────── */

.sold-out-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.78);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
}

.sold-out-overlay span {
  background: var(--gray-700);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 8px 24px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── Savings Badge ───────────────────────────────────────────────────────── */

.savings-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--gradient-accent);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  z-index: 4;
  letter-spacing: -0.01em;
  box-shadow: 0 4px 12px rgba(249,115,22,0.35);
}

/* ── Card Score Bar ─────────────────────────────────────────────────────────── */

.card-score-bar {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 12px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.card-score-bar:hover {
  border-color: var(--accent-200);
  box-shadow: 0 2px 8px rgba(249,115,22,0.1);
}

.card-score-header {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.card-score-emoji {
  font-size: 0.9rem;
}

.card-score-value {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -0.02em;
}

.card-score-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--gray-400);
}

.card-score-track {
  width: 100%;
  height: 5px;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.card-score-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

/* ── Card Body ───────────────────────────────────────────────────────────── */

/* Old score badges (remove if no longer used) */
.score-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  z-index: 4;
  color: #fff;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.score-a-plus { background: var(--gradient-score-high); }
.score-a      { background: #22c55e; }
.score-b      { background: #eab308; color: var(--gray-900); }
.score-c      { background: #f97316; }
.score-d      { background: #ef4444; }
.score-f      { background: #991b1b; }

.card-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.deals-grid.list-view .card-body {
  flex: 1;
  flex-direction: row;
  align-items: center;
  gap: 20px;
}

/* Category Tag */
.card-category {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-600);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  background: var(--accent-50);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  align-self: flex-start;
  border: 1px solid var(--accent-200);
}

.deals-grid.list-view .card-category {
  flex-shrink: 0;
  min-width: 90px;
  text-align: center;
}

/* Title */
.card-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--gray-900);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Amazon comparison badge on deal cards */
.card-amazon-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.3;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-amazon-badge.amz-good {
  background: rgba(34, 197, 94, 0.12);
  color: #15803d;
  border: 1px solid rgba(34, 197, 94, 0.35);
}
.card-amazon-badge.amz-bad {
  background: rgba(239, 68, 68, 0.10);
  color: #b91c1c;
  border: 1px solid rgba(239, 68, 68, 0.35);
}
.featured-amazon {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.featured-amazon.amz-good {
  background: rgba(34, 197, 94, 0.15);
  color: #15803d;
}
.featured-amazon.amz-bad {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
}

/* Amazon comparison box in deal detail modal */
.deal-detail-amazon {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}
.deal-detail-amazon h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}
.amazon-box-prices {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-bottom: 8px;
}
.amazon-box-item {
  display: flex;
  flex-direction: column;
}
.amazon-box-item .lbl {
  font-size: 0.7rem;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.amazon-box-item .val {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gray-900);
}
.amazon-box-item .val.price-low { color: #15803d; }
.amazon-box-item .val.price-high { color: #b91c1c; }
.amazon-box-tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 6px;
}
.amazon-box-tag.amz-good { background: rgba(34,197,94,0.12); color: #15803d; }
.amazon-box-tag.amz-bad { background: rgba(239,68,68,0.10); color: #b91c1c; }
.amazon-box-tag.amz-equal { background: rgba(59,130,246,0.10); color: #1d4ed8; }
.amazon-box-rating { font-size: 0.8rem; color: var(--gray-600); margin-bottom: 6px; }
.amazon-box-actions { margin-top: 8px; }
.amazon-box-actions .btn-amazon {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 8px;
  background: #232f3e;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
}
.amazon-box-actions .btn-amazon:hover { background: #37475a; }

.deal-card:hover .card-title { color: var(--accent-600); }

.deals-grid.list-view .card-title {
  flex: 1;
  -webkit-line-clamp: 1;
  font-size: 0.95rem;
}

/* Description Snippet */
.card-description {
  font-size: 0.78rem;
  color: var(--gray-500);
  line-height: 1.4;
  margin: 2px 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Price & Savings Row */
.card-prices {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.deals-grid.list-view .card-prices {
  flex-shrink: 0;
  min-width: 180px;
  justify-content: flex-end;
}

.card-price-current {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -0.03em;
}

.card-price-original {
  font-size: 0.85rem;
  color: var(--gray-400);
  text-decoration: line-through;
  font-weight: 500;
}

.card-savings-amount {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--success-600);
  margin-left: auto;
  background: var(--success-50);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--success-100);
}

/* ── Card Footer ─────────────────────────────────────────────────────────── */

.card-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--gray-100);
  margin-top: auto;
}

.deals-grid.list-view .card-footer {
  flex-shrink: 0;
  border-top: none;
  padding-top: 0;
  margin-top: 0;
  min-width: 240px;
  justify-content: flex-end;
}

/* ── Open on Woot Button ─────────────────────────────────────────────────── */

.btn-woot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--gradient-accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(249,115,22,0.25);
}

.btn-woot:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(249,115,22,0.4);
}

.btn-woot:active {
  transform: translateY(0);
}

.btn-woot-card {
  margin-left: auto;
  flex-shrink: 0;
}

.btn-woot-detail {
  margin-top: 0;
  padding: 10px 24px;
  font-size: 0.9rem;
}

.deal-detail-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.btn-woot-share {
  margin-top: 0;
  padding: 10px 24px;
  font-size: 0.9rem;
  background: var(--gray-100);
  color: var(--gray-700);
  border-color: var(--gray-200);
}

.btn-woot-share:hover {
  background: var(--gray-200);
  color: var(--gray-900);
  transform: translateY(-1px);
}

.btn-woot-share:active {
  transform: translateY(0);
}

/* Share Button on Cards */
.vote-btn.share-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-full);
  background: var(--gray-50);
  color: var(--gray-500);
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0;
  font-size: 0.85rem;
}

.vote-btn.share-btn:hover {
  background: var(--accent-50);
  border-color: var(--accent-300);
  color: var(--accent-500);
  transform: scale(1.1);
}

/* Heat */
.card-heat {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  font-weight: 700;
}

.card-heat.hot  { color: #ef4444; }
.card-heat.warm { color: #f97316; }
.card-heat.cool { color: var(--gray-400); }

.heat-icon { font-size: 1rem; }

/* Vote Buttons */
.card-votes {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.vote-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all var(--transition-fast);
  padding: 0;
}

.vote-btn:hover:not(:disabled) {
  border-color: var(--accent-300);
  background: var(--accent-50);
  transform: scale(1.12);
}

.vote-btn:active:not(:disabled) { transform: scale(0.92); }
.vote-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.vote-btn.voted-active {
  background: var(--accent-500);
  border-color: var(--accent-500);
  color: #fff;
}

/* Time */
.card-time {
  font-size: 0.72rem;
  color: var(--gray-400);
  white-space: nowrap;
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LOADING SKELETON
   ═══════════════════════════════════════════════════════════════════════════ */

.loading-skeleton {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.skeleton-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  height: 360px;
  position: relative;
  overflow: hidden;
}

.skeleton-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════════════════════════ */

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-400);
}

.empty-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 1.15rem;
  color: var(--gray-600);
  margin-bottom: 8px;
  font-weight: 700;
}

.empty-state p {
  font-size: 0.9rem;
  max-width: 400px;
  margin: 0 auto;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PAGINATION
   ═══════════════════════════════════════════════════════════════════════════ */

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 36px;
}

.pagination button {
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-full);
  color: var(--gray-700);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pagination button:hover:not(:disabled):not(.active) {
  border-color: var(--accent-300);
  color: var(--accent-600);
  background: var(--accent-50);
}

.pagination button:disabled {
  opacity: 0.3;
  cursor: default;
}

.pagination button.active {
  background: var(--gray-900);
  color: #fff;
  border-color: var(--gray-900);
  font-weight: 700;
}

.pagination .ellipsis {
  background: none;
  border: none;
  color: var(--gray-400);
  pointer-events: none;
  min-width: 20px;
  padding: 0 6px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════════════════════ */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(8px);
  z-index: 0;
}

.modal-container {
  position: relative;
  z-index: 1;
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  max-width: 760px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-close {
  position: sticky;
  top: 12px;
  right: 12px;
  float: right;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
  border: none;
  border-radius: 50%;
  font-size: 1.4rem;
  color: var(--gray-500);
  cursor: pointer;
  z-index: 10;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--gray-200);
  color: var(--gray-900);
}

#modal-body {
  padding: 24px 28px 32px;
}

.modal-loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-400);
}

.spinner-lg {
  width: 44px;
  height: 44px;
  margin: 0 auto 16px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--accent-500);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Deal Detail Header ──────────────────────────────────────────────────── */

.deal-detail-header {
  display: flex;
  gap: 24px;
  margin-bottom: 28px;
}

.deal-detail-header img {
  width: 150px;
  height: 150px;
  object-fit: contain;
  background: var(--gray-50);
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  flex-shrink: 0;
}

.deal-detail-info {
  flex: 1;
  min-width: 0;
}

.deal-detail-info h2 {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 10px;
}

.deal-detail-info a:hover { color: var(--accent-600); }

.deal-detail-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.deal-detail-meta span {
  font-size: 0.82rem;
  color: var(--gray-500);
}

.deal-detail-price-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.deal-detail-price-current {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -0.03em;
}

.deal-detail-price-original {
  font-size: 1rem;
  color: var(--gray-400);
  text-decoration: line-through;
  font-weight: 500;
}

.deal-detail-savings {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--success-600);
  background: var(--success-50);
  padding: 4px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--success-100);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge-available {
  background: var(--success-50);
  color: var(--success-600);
  border: 1px solid var(--success-100);
}

.badge-soldout {
  background: var(--danger-50);
  color: var(--danger-600);
  border: 1px solid var(--danger-100);
}

/* Score bar */
.deal-detail-score {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
  padding: 12px 16px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
}

.score-bar-container {
  flex: 1;
  height: 8px;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s ease;
}

.score-bar-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gray-700);
}

/* ── Description Section ─────────────────────────────────────────────────── */

.deal-detail-description {
  margin-bottom: 24px;
  padding: 18px 22px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
}

.deal-detail-description h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 14px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.desc-overview {
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--gray-700);
  margin: 0 0 10px 0;
}

.desc-section {
  margin: 0 0 10px 0;
}

.desc-section:last-child {
  margin-bottom: 0;
}

.desc-heading {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--gray-800);
  margin: 0 0 6px 0;
}

.desc-section-content {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--gray-600);
  margin: 0;
}

.desc-feature-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.desc-feature-list li {
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--gray-600);
  padding: 3px 0 3px 14px;
  position: relative;
}

.desc-feature-list li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--accent-500);
  font-weight: 700;
}

.desc-spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin: 0;
}

.desc-spec-table td {
  padding: 5px 10px;
  border-bottom: 1px solid var(--gray-200);
  color: var(--gray-600);
}

.desc-spec-table tr:last-child td {
  border-bottom: none;
}

.spec-label {
  font-weight: 600;
  color: var(--gray-700);
  white-space: nowrap;
  width: 35%;
}

.spec-value {
  color: var(--gray-600);
}

.desc-disclaimer {
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--accent-50);
  border: 1px solid var(--accent-200);
  border-left: 3px solid var(--accent-400);
  border-radius: var(--radius-xs);
}

.desc-disclaimer p {
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--gray-600);
  margin: 0;
}

/* ── History Summary ─────────────────────────────────────────────────────── */

.history-summary {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  margin-bottom: 24px;
}

.history-summary h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-summary-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: 0.88rem;
  color: var(--gray-600);
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
}

.history-summary-entry {
  white-space: nowrap;
}

.history-summary-sep {
  color: var(--gray-300);
  font-weight: 300;
  margin: 0 2px;
}

.history-summary-entry .price-high { color: var(--danger-500); }
.history-summary-entry .price-low { color: var(--success-600); }

.appearance-list {
  max-height: 200px;
  overflow-y: auto;
  margin-top: 16px;
}

.appearance-list h4 {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-500);
  margin-bottom: 8px;
}

.appearance-list ul {
  list-style: none;
  font-size: 0.82rem;
}

.appearance-list li {
  padding: 7px 12px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  color: var(--gray-600);
  gap: 12px;
}

.appearance-price {
  font-weight: 700;
  color: var(--gray-800);
  white-space: nowrap;
}

.appearance-list li:last-child { border-bottom: none; }

/* ── Price History Table ─────────────────────────────────────────────────── */

.price-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 18px;
}

.price-history-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 2px solid var(--gray-200);
}

.price-history-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}

/* ═══════════════════════════════════════════════════════════════════════════
   SCORE EXPLANATION POPUP
   ═══════════════════════════════════════════════════════════════════════════ */

.score-popup {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.score-popup.active {
  display: flex;
}

.score-popup-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(6px);
  z-index: 0;
}

.score-popup-card {
  position: relative;
  z-index: 1;
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  max-width: 600px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  animation: modalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.score-popup-close {
  position: sticky;
  top: 16px;
  right: 16px;
  float: right;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
  border: none;
  border-radius: 50%;
  font-size: 1.4rem;
  color: var(--gray-500);
  cursor: pointer;
  z-index: 10;
  transition: all var(--transition-fast);
}

.score-popup-close:hover {
  background: var(--gray-200);
  color: var(--gray-900);
}

.score-popup-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 32px 32px 12px;
  margin-bottom: 4px;
}

.score-popup-icon {
  font-size: 1.8rem;
}

.score-popup-header h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--gray-900);
}

.score-popup-body {
  padding: 0 32px 32px;
}

.score-popup-loading {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray-400);
}

.score-popup-loading .spinner-lg {
  margin-bottom: 12px;
}

/* ── Total Score Header ───────────────────────────────────────────── */

.score-total-header {
  text-align: center;
  padding: 18px 0 24px;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 20px;
}

.score-total-big {
  font-size: 3.5rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 6px;
}

.score-total-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray-500);
}

.score-total-grade {
  font-size: 1.3rem;
  font-weight: 800;
  padding: 3px 12px;
  border-radius: var(--radius-full);
  color: #fff;
}

/* ── Factor Breakdown ──────────────────────────────────────────────── */

.score-factors-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.score-factor {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: border-color var(--transition-fast);
}

.score-factor:hover {
  border-color: var(--accent-200);
}

.score-factor-icon {
  font-size: 1.5rem;
  line-height: 1;
  margin-top: 1px;
  flex-shrink: 0;
}

.score-factor-info {
  flex: 1;
  min-width: 0;
}

.score-factor-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 3px;
}

.score-factor-desc {
  font-size: 0.78rem;
  color: var(--gray-500);
  margin-bottom: 8px;
  line-height: 1.4;
}

.score-factor-bar-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.score-factor-bar {
  flex: 1;
  height: 6px;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.score-factor-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

.score-factor-pts {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gray-700);
  white-space: nowrap;
  min-width: 60px;
  text-align: right;
}

.score-factor-max {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--gray-400);
}

.score-factor-extra {
  margin-top: 6px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--accent-600);
  background: var(--accent-50);
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--accent-200);
}

.score-factor-extra.negative {
  color: var(--danger-500);
  background: var(--danger-50);
  border-color: var(--danger-100);
}

/* ── Score Popup Footer ────────────────────────────────────────────── */

.score-popup-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--gray-200);
  text-align: center;
  font-size: 0.78rem;
  color: var(--gray-400);
  line-height: 1.5;
}

.score-popup-footer strong {
  color: var(--gray-600);
}

/* Make score badges interactive */
.score-badge {
  cursor: pointer;
  position: relative;
}

.score-badge::after {
  content: '?';
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  background: rgba(255,255,255,0.35);
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.score-badge:hover::after {
  opacity: 1;
}

/* ── Responsive: Score Popup ───────────────────────────────────────── */

@media (max-width: 640px) {
  .score-popup { padding: 10px; }
  .score-popup-card { border-radius: var(--radius-md); max-height: 92vh; }
  .score-popup-header { padding: 24px 20px 12px; }
  .score-popup-body { padding: 0 20px 24px; }
  .score-total-big { font-size: 2.8rem; }
}

/* ═══════════════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════════════════════ */

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--gray-900);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  max-width: 360px;
}

.toast.success { border-left: 3px solid var(--success-500); }
.toast.error   { border-left: 3px solid var(--danger-500); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════════════════════ */

footer {
  border-top: 1px solid var(--gray-200);
  background: #fff;
  padding: 24px 0;
  margin-top: 48px;
}

.footer-inner {
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--gray-400);
}

.footer-inner strong { color: var(--gray-600); }
.footer-version { font-family: var(--font-mono); font-size: 0.75rem; }

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — Tablet (<1024px)
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
  .deals-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
  }

  .nav-search { max-width: 400px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — Phone (<640px)
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 640px) {
  :root {
    --nav-height: 56px;
    --subnav-height: 48px;
  }

  .nav-inner {
    padding: 0 12px;
    gap: 10px;
  }
  .brand-text { font-size: 1.1rem; }
  .brand-icon { font-size: 1.3rem; }
  .nav-search { max-width: none; }
  .toggle-label-text { display: none; }

  .sub-nav-inner { padding: 0 12px; }
  .sort-label { display: none; }

  .stats-ribbon {
    gap: 12px;
    padding: 0 12px;
    margin-top: 12px;
  }
  #stat-best { display: none !important; }

  main { padding: 16px 12px 32px; }

  .deals-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .deals-grid.list-view .deal-card {
    flex-direction: column;
  }
  .deals-grid.list-view .card-image-wrapper {
    width: 100%;
    padding-top: 56%;
    height: auto;
  }
  .deals-grid.list-view .card-body {
    flex-direction: column;
    align-items: flex-start;
  }
  .deals-grid.list-view .card-prices,
  .deals-grid.list-view .card-footer {
    min-width: 0;
    justify-content: flex-start;
  }

  .modal { padding: 10px; }
  .modal-container { border-radius: var(--radius-md); max-height: 95vh; }
  #modal-body { padding: 0 16px 24px; }

  .deal-detail-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .deal-detail-header img { width: 120px; height: 120px; }
  .deal-detail-meta { justify-content: center; }
  .deal-detail-price-row { justify-content: center; }


  .pagination { gap: 4px; }
  .pagination button { min-width: 34px; height: 34px; font-size: 0.78rem; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PRICE HISTORY CHART
   ═══════════════════════════════════════════════════════════════════════════ */

.price-history-chart-container {
  margin-top: 20px;
  padding: 24px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
}

.price-history-chart-container h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-800);
  margin: 0 0 20px 0;
}

.price-history-chart-container canvas {
  width: 100% !important;
  height: 300px !important;
  display: block;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ACCESSIBILITY — Reduced Motion
   ═══════════════════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* Focus visible */
:focus-visible {
  outline: 2px solid var(--accent-500);
  outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   User Authentication & Profile Styles
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Auth Modal ─────────────────────────────────────────────────────────── */

.auth-container {
  max-width: 420px;
  width: 90vw;
  background: var(--gray-50);
  border-radius: var(--radius-lg);
  padding: 0;
  overflow: hidden;
}

.auth-tabs {
  display: flex;
  border-bottom: 2px solid var(--gray-200);
  background: var(--gray-100);
}

/* Shared link bar that lives at the BOTTOM of the auth modal (after both
   forms). Stays visible on both Sign In and Create Account tabs so users
   can always reach the password-reset flow (v0.8.18). */
.auth-sublink {
  padding: 12px 20px 16px;
  text-align: center;
  background: var(--gray-50);
  border-top: 1px solid var(--gray-200);
}
.auth-sublink a {
  color: var(--accent-500, #58a6ff);
  font-size: 0.85rem;
  text-decoration: none;
  transition: color 0.15s ease;
}
.auth-sublink a:hover,
.auth-sublink a:focus {
  color: var(--accent-600, #2563eb);
  text-decoration: underline;
}

.auth-tab {
  flex: 1;
  padding: 14px 20px;
  border: none;
  background: transparent;
  font-family: 'Inter', sans-serif;
  font-size: 0.925rem;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.auth-tab.active {
  color: var(--accent-600);
  background: var(--gray-50);
}

.auth-tab.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--accent-500);
}

.auth-tab:hover:not(.active) {
  color: var(--gray-700);
  background: var(--gray-200);
}

.auth-form {
  display: none;
  padding: 24px;
}

.auth-form.active {
  display: block;
}

.auth-form .form-group {
  margin-bottom: 16px;
}

.auth-form label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.auth-form input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-family: 'Inter', sans-serif;
  font-size: 0.925rem;
  color: var(--gray-900);
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

.auth-form input:focus {
  border-color: var(--accent-500);
  box-shadow: 0 0 0 3px var(--accent-100);
  outline: none;
}

.auth-form input:invalid {
  border-color: var(--danger-500);
}

.form-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: 4px;
}

.form-error {
  display: none;
  padding: 10px 14px;
  background: var(--danger-50);
  border: 1px solid var(--danger-100);
  border-radius: var(--radius-md);
  color: var(--danger-600);
  font-size: 0.8125rem;
  margin-bottom: 12px;
}

.form-error.visible {
  display: block;
}

/* ── Inline availability indicators (v0.8.23) ─────────────────── */
.input-with-status {
  position: relative;
  display: flex;
  align-items: center;
}
.input-with-status input {
  flex: 1;
  padding-right: 36px;
}
.field-status {
  position: absolute;
  right: 12px;
  display: none;
  font-size: 1.1rem;
  line-height: 1;
  pointer-events: none;
}
.field-status.show { display: inline-block; }
.field-status.ok    { color: #3fb950; }
.field-status.bad   { color: #f85149; }
.field-status.checking { color: #58a6ff; opacity: 0.7; }
.field-hint {
  display: block;
  font-size: 0.75rem;
  margin-top: 4px;
  min-height: 0;
  color: #8b949e;
  transition: color 0.15s;
}
.field-hint.ok  { color: #3fb950; }
.field-hint.bad { color: #f85149; }

.btn-auth-submit {
  width: 100%;
  padding: 12px 20px;
  background: var(--gradient-accent);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 0.925rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.15s ease;
}

.btn-auth-submit:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.btn-auth-submit:active {
  transform: translateY(0);
}

/* ── User Dropdown ──────────────────────────────────────────────────────── */

.user-dropdown {
  position: fixed;
  top: 56px;
  right: 160px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
  min-width: 200px;
  z-index: 1000;
  overflow: hidden;
  animation: dropdownIn 0.15s ease;
}

@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.user-dropdown-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-100);
}

.user-dropdown-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-700);
}

.user-dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: transparent;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  color: var(--gray-700);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.user-dropdown-item:hover {
  background: var(--gray-100);
}

/* ── Profile Modal ──────────────────────────────────────────────────────── */

.profile-container {
  max-width: 680px;
  width: 92vw;
  background: var(--gray-50);
  border-radius: var(--radius-lg);
  padding: 0;
  overflow: hidden;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-200);
}

.profile-avatar {
  font-size: 2rem;
}

.profile-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0;
}

.profile-tabs {
  display: flex;
  border-bottom: 2px solid var(--gray-200);
  background: var(--gray-100);
  padding: 0 12px;
  flex-shrink: 0;
}

.profile-tab {
  padding: 12px 16px;
  border: none;
  background: transparent;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  white-space: nowrap;
}

.profile-tab.active {
  color: var(--accent-600);
}

.profile-tab.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 10%;
  right: 10%;
  height: 2px;
  background: var(--accent-500);
}

.profile-tab:hover:not(.active) {
  color: var(--gray-700);
}

.profile-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

.profile-panel {
  display: none;
}

.profile-panel.active {
  display: block;
}

.profile-loading {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray-400);
  font-size: 0.925rem;
}

/* Profile deal list items */
.profile-deal-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  transition: background 0.15s ease;
  cursor: pointer;
}

.profile-deal-item:hover {
  background: var(--gray-100);
}

.profile-deal-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  background: var(--gray-100);
  flex-shrink: 0;
}

.profile-deal-info {
  flex: 1;
  min-width: 0;
}

.profile-deal-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-deal-meta {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-top: 2px;
}

.profile-deal-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.profile-action-btn {
  padding: 6px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  background: transparent;
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.profile-action-btn:hover {
  background: var(--gray-100);
  border-color: var(--gray-400);
}

.profile-action-btn.danger {
  border-color: var(--danger-500);
  color: var(--danger-500);
}

.profile-action-btn.danger:hover {
  background: var(--danger-50);
}

/* Sold-out indicator in profile */
.profile-deal-soldout {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--danger-500);
  background: var(--danger-50);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Profile Settings Form */
#profile-settings-form .form-group {
  margin-bottom: 14px;
}

#profile-settings-form label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

#profile-settings-form input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-family: 'Inter', sans-serif;
  font-size: 0.925rem;
  color: var(--gray-900);
  background: #fff;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

#profile-settings-form input:focus {
  border-color: var(--accent-500);
  box-shadow: 0 0 0 3px var(--accent-100);
  outline: none;
}

/* ── Deal Card Action Buttons (Bookmark/Follow) ─────────────────────────── */

.card-actions-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.card-action-btn {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  background: transparent;
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.card-action-btn:hover {
  background: var(--gray-100);
  border-color: var(--gray-400);
  color: var(--gray-700);
}

.card-action-btn.active-bookmark {
  border-color: #eab308;
  color: #ca8a04;
  background: #fef9c3;
}

.card-action-btn.active-follow {
  border-color: var(--accent-500);
  color: var(--accent-600);
  background: var(--accent-50);
}

/* ── Responsive adjustments ─────────────────────────────────────────────── */

@media (max-width: 768px) {
  .auth-container {
    width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
  }

  .profile-container {
    width: 95vw;
    max-height: 95vh;
  }

  .profile-tabs {
    overflow-x: auto;
    padding: 0 8px;
  }

  .profile-tab {
    padding: 10px 12px;
    font-size: 0.8rem;
  }

  .user-dropdown {
    right: 80px;
    min-width: 180px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   WootDeals v2 visual refresh — conversion-first deal discovery
   ═══════════════════════════════════════════════════════════════════════════ */

.top-nav {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  box-shadow: 0 1px 8px rgba(24,24,27,.04);
}

.brand-text { color: var(--gray-900); }
.nav-search input {
  background: var(--gray-50);
  border-color: var(--gray-200);
  color: var(--gray-900);
}
.nav-search input::placeholder { color: var(--gray-400); }
.nav-search-clear { background: var(--gray-200); color: var(--gray-600); }
.nav-search-clear:hover { background: var(--gray-300); color: var(--gray-900); }
.nav-btn {
  background: #fff;
  border-color: var(--gray-200);
  color: var(--gray-600);
}
.nav-btn:hover { background: var(--gray-50); border-color: var(--gray-300); color: var(--gray-900); }
.toggle-track { background: var(--gray-200); }
.toggle-label-text { color: var(--gray-600); }

.featured-wrap {
  max-width: var(--content-max-width);
  margin: 24px auto 0;
  padding: 0 24px;
}
.featured-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--gray-900);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.featured-live {
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: var(--success-50);
  color: var(--success-700);
  border: 1px solid var(--success-100);
  font-size: .62rem;
  letter-spacing: .1em;
}
.featured-deal {
  min-height: 250px;
  display: grid;
  cursor: pointer;
  grid-template-columns: minmax(300px, 1.05fr) minmax(360px, 1fr);
  overflow: hidden;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl);
  background: #fff;
  box-shadow: var(--shadow-lg);
  transition: opacity var(--transition-base), transform var(--transition-base);
}
.featured-wrap:not(.is-ready) .featured-deal { opacity: .72; }
.featured-media {
  position: relative;
  min-height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(135deg, #f4f4f5, #fff7ed);
}
.featured-media img {
  width: 100%;
  height: 100%;
  padding: 28px;
  object-fit: contain;
  transition: transform var(--transition-slow);
}
.featured-deal:hover .featured-media img { transform: scale(1.04); }
.featured-placeholder { font-size: 5rem; opacity: .5; }
.featured-discount {
  position: absolute;
  top: 18px;
  right: 18px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  background: var(--gradient-accent);
  color: #fff;
  font-size: 1rem;
  font-weight: 900;
  box-shadow: 0 5px 16px rgba(249,115,22,.3);
}
.featured-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 30px 38px;
}
.featured-category {
  margin-bottom: 8px;
  color: var(--accent-600);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.featured-content h1 {
  max-width: 620px;
  color: var(--gray-900);
  font-size: clamp(1.35rem, 2.3vw, 2rem);
  line-height: 1.18;
  letter-spacing: -.04em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.featured-subtitle {
  max-width: 600px;
  margin-top: 10px;
  color: var(--gray-500);
  font-size: .9rem;
  line-height: 1.45;
}
.featured-price-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.featured-price { color: var(--gray-950); font-size: 2.15rem; font-weight: 900; letter-spacing: -.05em; }
.featured-original { color: var(--gray-400); font-size: .95rem; text-decoration: line-through; }
.featured-saving { color: var(--success-700); font-size: .9rem; font-weight: 800; }
.featured-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 8px;
  color: var(--gray-500);
  font-size: .78rem;
  font-weight: 600;
}
.btn-featured {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 48px;
  margin-top: 20px;
  padding: 0 26px;
  border-radius: var(--radius-full);
  background: var(--success-500);
  color: #fff;
  font-size: .92rem;
  font-weight: 800;
  box-shadow: 0 5px 14px rgba(34,197,94,.22);
  transition: transform var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}
.btn-featured:hover { background: var(--success-600); box-shadow: 0 8px 20px rgba(34,197,94,.3); transform: translateY(-2px); }
.btn-featured-share {
  background: #fff;
  color: var(--success-700);
  border: 1px solid var(--success-200);
  margin-left: 10px;
  cursor: pointer;
}
.btn-featured-share:hover { background: var(--success-50); box-shadow: none; }

.stats-ribbon {
  margin-top: 14px;
  padding-top: 10px;
  padding-bottom: 10px;
  border-top: 1px solid var(--gray-100);
  border-bottom: 1px solid var(--gray-100);
}
main { padding-top: 20px; }
.deals-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.deal-card { border-radius: var(--radius-md); box-shadow: var(--shadow-xs); }
.deal-card:hover { box-shadow: var(--shadow-lg); }
.card-image-wrapper { padding-top: 72%; background: #f8fafc; }
.card-image-wrapper img { padding: 16px; }
.card-body { padding: 15px; gap: 8px; }
.card-category { font-size: .64rem; padding: 3px 8px; }
.card-title { font-size: .9rem; line-height: 1.35; }
.card-score-bar { padding: 7px 9px; gap: 3px; background: transparent; border: 0; }
.card-score-track { height: 4px; }
.card-prices { gap: 7px; margin-top: 3px; }
.card-price-current { font-size: 1.55rem; }
.card-savings-amount { margin-left: 0; padding: 3px 8px; font-size: .74rem; }
.btn-woot-card {
  width: 100%;
  min-height: 44px;
  margin: 4px 0 0;
  background: var(--success-500);
  box-shadow: 0 3px 9px rgba(34,197,94,.18);
  justify-content: center;
  font-size: .82rem;
}
.btn-woot-card:hover { background: var(--success-600); box-shadow: 0 5px 14px rgba(34,197,94,.28); }
.card-footer { padding-top: 9px; }

@media (max-width: 1100px) {
  .deals-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .featured-wrap { margin-top: 16px; padding: 0 12px; }
  .featured-deal { grid-template-columns: 1fr; }
  .featured-media { min-height: 190px; height: 190px; }
  .featured-content { padding: 22px 20px 24px; }
  .featured-content h1 { font-size: 1.35rem; }
  .featured-price { font-size: 1.85rem; }
  .featured-meta { gap: 8px; }
  .btn-featured { width: 100%; }
  .deals-grid { grid-template-columns: 1fr; gap: 12px; }
  .deal-card { display: grid; grid-template-columns: 112px 1fr; min-height: 160px; }
  .card-image-wrapper { height: 100%; min-height: 160px; padding-top: 0; }
  .card-image-wrapper img { padding: 10px; }
  .card-body { min-width: 0; padding: 13px; gap: 6px; }
  .card-title { font-size: .86rem; }
  .card-score-bar { display: none; }
  .card-price-current { font-size: 1.25rem; }
  .card-savings-amount { font-size: .68rem; }
  .btn-woot-card { min-height: 40px; margin-top: 2px; font-size: .76rem; }
  .card-footer { display: none; }
  .savings-badge { top: 8px; right: 8px; padding: 4px 8px; font-size: .68rem; }
  .sort-group { max-width: 100%; overflow-x: auto; }
  .sort-group .price-filter-label, .sort-group .price-input, .sort-group .price-sep { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .featured-deal, .featured-media img, .btn-featured { transition: none; }
}
