/* ============ Tokens — DA noir glassmorphism ============ */
:root {
  --bg: #08080a;
  --bg-glow-1: rgba(99, 91, 255, 0.10);
  --bg-glow-2: rgba(40, 90, 160, 0.10);
  --glass: rgba(255, 255, 255, 0.045);
  --glass-strong: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --fg: #f5f5f7;
  --muted: #8a8a93;
  --muted-2: #5e5e66;
  --accent: #22c55e;
  --accent-soft: rgba(34, 197, 94, 0.14);
  --radius: 18px;
  --radius-sm: 12px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

html, body {
  height: 100%;
  font-family: var(--font);
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(900px 500px at 18% 12%, var(--bg-glow-1), transparent 60%),
    radial-gradient(900px 500px at 85% 88%, var(--bg-glow-2), transparent 60%),
    var(--bg);
}

a { color: inherit; text-decoration: none; }
::selection { background: rgba(255, 255, 255, 0.15); }

/* ============ Starfield ============ */
.stars {
  position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
}
.stars::before, .stars::after {
  content: ""; position: absolute; inset: -50%;
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,.5), transparent),
    radial-gradient(1px 1px at 60% 70%, rgba(255,255,255,.35), transparent),
    radial-gradient(1px 1px at 80% 20%, rgba(255,255,255,.4), transparent),
    radial-gradient(1px 1px at 35% 85%, rgba(255,255,255,.3), transparent),
    radial-gradient(2px 2px at 50% 50%, rgba(255,255,255,.25), transparent);
  background-size: 350px 350px; opacity: .6;
}
.stars::after { background-size: 220px 220px; opacity: .35; }

/* ============ Glass primitives ============ */
.glass {
  background: var(--glass);
  border: 1px solid var(--border);
  backdrop-filter: blur(22px) saturate(120%);
  -webkit-backdrop-filter: blur(22px) saturate(120%);
}

/* ============ LOGIN ============ */
.login-wrap {
  position: relative; z-index: 1;
  min-height: 100dvh; display: grid; place-items: center; padding: 24px;
}
.login-card {
  width: 100%; max-width: 380px;
  border-radius: 24px; padding: 36px 32px 28px;
  display: flex; flex-direction: column; align-items: center;
  box-shadow: 0 30px 80px rgba(0,0,0,.55);
}
.logo {
  width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center; margin-bottom: 18px;
  background: var(--glass-strong); border: 1px solid var(--border);
}
.logo svg { width: 24px; height: 24px; color: var(--fg); }
.login-card h1 { font-size: 26px; font-weight: 600; letter-spacing: -.02em; margin-bottom: 26px; }

.field {
  width: 100%; margin-bottom: 12px; position: relative;
}
.field input {
  width: 100%; height: 50px; padding: 0 16px;
  background: rgba(255,255,255,.03); color: var(--fg);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 15px; font-family: var(--font); transition: border-color .2s, background .2s;
}
.field input::placeholder { color: var(--muted-2); }
.field input:focus { outline: none; border-color: var(--border-strong); background: rgba(255,255,255,.05); }
.field .hint { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted-2); }

.btn {
  width: 100%; height: 50px; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 600; font-family: var(--font);
  cursor: pointer; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: background .2s, border-color .2s, transform .05s;
}
.btn:active { transform: scale(.99); }
.btn-primary { background: rgba(255,255,255,.06); color: var(--fg); margin-top: 6px; }
.btn-primary:hover { background: rgba(255,255,255,.11); }
.btn-google { background: rgba(255,255,255,.03); color: var(--fg); margin-top: 10px; }
.btn-google:hover { background: rgba(255,255,255,.07); border-color: var(--border-strong); }
.btn-google svg { width: 18px; height: 18px; }

.signup { margin-top: 20px; font-size: 13px; color: var(--muted); }
.signup b { color: var(--fg); font-weight: 600; }

.social-proof { margin-top: 30px; text-align: center; color: var(--muted); font-size: 13px; }
.social-proof b { color: var(--fg); }
.avatars { display: flex; justify-content: center; margin-top: 12px; }
.avatars span {
  width: 30px; height: 30px; border-radius: 50%; margin-left: -8px;
  border: 2px solid var(--bg); background-size: cover; background-position: center;
}
.avatars span:first-child { margin-left: 0; }

/* ============ DASHBOARD ============ */
.app { position: relative; z-index: 1; display: flex; min-height: 100dvh; }

.sidebar {
  width: 248px; flex-shrink: 0; padding: 22px 16px;
  border-right: 1px solid var(--border);
  background: rgba(255,255,255,.02);
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100dvh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 22px; }
.brand .logo { width: 34px; height: 34px; margin: 0; }
.brand .logo svg { width: 16px; height: 16px; }
.brand span { font-weight: 600; font-size: 16px; letter-spacing: -.01em; }

.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-2); padding: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--muted); font-size: 14px; cursor: pointer;
  border: 1px solid transparent; transition: background .15s, color .15s;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.04); color: var(--fg); }
.nav-item.active { background: var(--glass-strong); color: var(--fg); border-color: var(--border); }

.main { flex: 1; padding: 28px 32px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; gap: 16px; }
.topbar h2 { font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.topbar .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.controls { display: flex; gap: 10px; align-items: center; }
.src-toggle { display: flex; gap: 6px; }
.chip {
  padding: 8px 14px; border-radius: 999px; font-size: 13px; cursor: pointer;
  background: rgba(255,255,255,.03); border: 1px solid var(--border); color: var(--muted);
  transition: all .15s;
}
.chip.on { background: var(--glass-strong); color: var(--fg); border-color: var(--border-strong); }
.price-input {
  width: 130px; height: 38px; padding: 0 12px; font-size: 13px;
  background: rgba(255,255,255,.03); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--fg); font-family: var(--font);
}
.price-input:focus { outline: none; border-color: var(--border-strong); }
.btn-run {
  height: 38px; padding: 0 18px; border-radius: var(--radius-sm); cursor: pointer;
  background: var(--accent-soft); border: 1px solid rgba(34,197,94,.4); color: #86efac;
  font-weight: 600; font-size: 13px; font-family: var(--font); transition: background .15s;
}
.btn-run:hover { background: rgba(34,197,94,.22); }

/* RAM filters */
.ram-filters {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 22px;
  padding: 14px; border-radius: var(--radius);
  background: rgba(255,255,255,.025); border: 1px solid var(--border);
}
.filter-sel {
  height: 38px; padding: 0 12px; font-size: 13px; font-family: var(--font);
  background: rgba(255,255,255,.04); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--fg); cursor: pointer; transition: border-color .15s;
}
.filter-sel:focus { outline: none; border-color: var(--border-strong); }
.filter-sel option { background: #15151a; color: var(--fg); }
.filter-sel.price-min { width: 90px; cursor: text; }
/* Slider double poignée (filtre prix) */
.price-range { display: flex; flex-direction: column; gap: 6px; min-width: 200px; padding: 2px 6px; }
.pr-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.pr-val { color: var(--fg); font-variant-numeric: tabular-nums; }
.pr-track { position: relative; height: 22px; }
.pr-track::before { content: ""; position: absolute; top: 50%; left: 0; right: 0; height: 4px; transform: translateY(-50%); background: rgba(255,255,255,.10); border-radius: 4px; }
.pr-fill { position: absolute; top: 50%; height: 4px; transform: translateY(-50%); background: var(--accent); border-radius: 4px; }
.pr-track input[type=range] { position: absolute; top: 0; left: 0; width: 100%; height: 22px; margin: 0; background: none; pointer-events: none; -webkit-appearance: none; appearance: none; }
.pr-track input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; pointer-events: auto; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.pr-track input[type=range]::-moz-range-thumb { pointer-events: auto; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); cursor: pointer; }
.pr-track input[type=range]::-webkit-slider-runnable-track { background: none; }
.filter-reset {
  height: 38px; padding: 0 14px; margin-left: auto; cursor: pointer;
  background: transparent; border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--muted); font-size: 13px; font-family: var(--font); transition: color .15s, border-color .15s;
}
.filter-reset:hover { color: var(--fg); border-color: var(--border-strong); }

/* Grid */
.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.card {
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--border);
  transition: border-color .2s, transform .15s;
}
.card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.card .thumb {
  aspect-ratio: 4/3; background: rgba(255,255,255,.03); position: relative; overflow: hidden;
}
.thumb-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .src {
  position: absolute; top: 10px; left: 10px; padding: 4px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; backdrop-filter: blur(8px);
  background: rgba(0,0,0,.45); border: 1px solid var(--border);
}
.src.leboncoin { color: #ff8a3d; }
.src.vinted { color: #3ad6c0; }
.src.ebay { color: #3b82f6; }
.card .badges {
  position: absolute; top: 10px; right: 10px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
}
.card .badge {
  padding: 4px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .03em;
  backdrop-filter: blur(8px); display: flex; align-items: center; gap: 5px;
}
.card .badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.card .hs-badge { color: #ff6b6b; background: rgba(60,12,12,.6); border: 1px solid rgba(239,68,68,.5); }
.card .hs-badge::before { background: #ef4444; }
.card .box-badge { color: #fbbf24; background: rgba(60,45,8,.6); border: 1px solid rgba(245,158,11,.5); }
.card .box-badge::before { background: #f59e0b; }
.card .cooler-badge { color: #67e8f9; background: rgba(8,42,52,.6); border: 1px solid rgba(34,211,238,.5); }
.card .cooler-badge::before { background: #22d3ee; }
.card .low-badge { color: #d8b4fe; background: rgba(40,12,55,.6); border: 1px solid rgba(168,85,247,.5); }
.card .low-badge::before { background: #a855f7; }
.card .swap-badge { color: #fcd34d; background: rgba(55,38,6,.6); border: 1px solid rgba(245,158,11,.5); }
.card .swap-badge::before { background: #f59e0b; }
.card .body { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card .title { font-size: 13.5px; line-height: 1.4; color: var(--fg);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 38px; }
.card .meta { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.card .price { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.card .cond { font-size: 11px; color: var(--muted); }
.card .specs { display: flex; gap: 6px; flex-wrap: wrap; }
.spec { font-size: 11px; padding: 3px 8px; border-radius: 6px; background: rgba(255,255,255,.05); color: var(--muted); }
.buy {
  margin-top: 4px; height: 38px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; gap: 7px;
  background: rgba(255,255,255,.05); border: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--fg); cursor: pointer; transition: background .15s;
}
.buy:hover { background: rgba(255,255,255,.1); }
.buy svg { width: 14px; height: 14px; }

/* Sidebar bottom */
.sidebar-bottom { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); }
.nav-item.active#compareTab, #compareTab.active { background: var(--accent-soft); color: #86efac; border-color: rgba(34,197,94,.4); }

/* Comparateur */
.cmp-sections { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.cmp-search { display: flex; gap: 10px; margin-bottom: 18px; }
.cmp-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.stat-box { flex: 1; min-width: 90px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,.03); border: 1px solid var(--border); }
.stat-k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat-v { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 4px; }

.cmp-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.cmp-retailers { display: flex; flex-wrap: wrap; gap: 8px; }
.cmp-controls-right { display: flex; gap: 10px; align-items: center; }
.ret-chip { position: relative; padding-left: 24px; }
.ret-chip::before { content: ""; position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 8px; height: 8px; border-radius: 50%; background: var(--rc, #999); }
.ret-chip:not(.on) { opacity: .4; text-decoration: line-through; }
.ret-tag { font-size: 11px; padding: 2px 9px 2px 18px; border-radius: 999px; position: relative;
  color: var(--rc, #aaa); background: rgba(255,255,255,.05); border: 1px solid var(--border); }
.ret-tag::before { content: ""; position: absolute; left: 7px; top: 50%; transform: translateY(-50%);
  width: 6px; height: 6px; border-radius: 50%; background: var(--rc, #999); }
.cmp-info { font-size: 13px; color: var(--muted); padding: 12px 14px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,.03); border: 1px dashed var(--border); }

.cmp-layout { display: grid; grid-template-columns: 340px 1fr; gap: 18px; align-items: start; }
.cmp-list { display: flex; flex-direction: column; gap: 8px; max-height: 78vh; overflow-y: auto; padding-right: 6px; }
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.10) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: rgba(255,255,255,.10); border-radius: 8px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.18); }
.cmp-row { padding: 11px 13px; border-radius: var(--radius-sm); cursor: pointer;
  background: rgba(255,255,255,.03); border: 1px solid var(--border); transition: border-color .15s, background .15s; }
.cmp-row:hover { background: rgba(255,255,255,.06); }
.cmp-row.sel { border-color: rgba(34,197,94,.5); background: var(--accent-soft); }
.cmp-row-name { font-size: 13px; line-height: 1.35; margin-bottom: 6px; }
.cmp-row-meta { display: flex; justify-content: space-between; align-items: center; }
.cmp-price { font-weight: 700; font-variant-numeric: tabular-nums; }
.cmp-off { font-size: 11px; color: var(--muted); }

.cmp-detail { border: 1px solid var(--border); border-radius: var(--radius);
  background: rgba(255,255,255,.02); padding: 20px; min-height: 300px; }
.cmp-title { font-size: 17px; font-weight: 600; margin-bottom: 12px; }
.cmp-best { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.cmp-price-lg { font-size: 26px; font-weight: 700; color: #86efac; font-variant-numeric: tabular-nums; }
.cmp-age { display: flex; gap: 6px; margin-bottom: 8px; }
.age-chip { padding: 5px 12px; font-size: 12px; }
.cmp-block-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; }
.cmp-hist { width: 100%; max-width: 720px; border-radius: 10px; background: #fff; padding: 6px; }
.cmp-canvas-wrap { position: relative; height: 360px; }
.bench-list { display: flex; flex-direction: column; gap: 6px; }
.bench-row { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,.03); border: 1px solid var(--border); font-size: 13px; }
.bench-row.bench-me { background: rgba(34,197,94,.10); border-color: rgba(34,197,94,.45); }
.bench-name { flex: 0 0 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.bench-row.bench-me .bench-name { font-weight: 700; }
.bench-bar { flex: 1; height: 8px; background: rgba(255,255,255,.06); border-radius: 6px; overflow: hidden; }
.bench-fill { display: block; height: 100%; border-radius: 6px; }
.bench-score { flex: 0 0 60px; text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.bench-price { flex: 0 0 70px; text-align: right; font-weight: 700; color: #22c55e; }
.bench-go { flex: 0 0 70px; text-align: right; color: var(--muted); cursor: pointer; font-size: 12px; }
.bench-go:hover { color: var(--accent); }

@media (max-width: 900px) { .cmp-layout { grid-template-columns: 1fr; } }

/* States */
.state { text-align: center; padding: 80px 20px; color: var(--muted); }
.state svg { width: 40px; height: 40px; opacity: .4; margin-bottom: 14px; }
/* ==== Ghost cards (effet fantôme) ==== */
/* Variables locales pour piloter le shimmer en un endroit */
:root { --ghost-bg: rgba(255,255,255,.04); --ghost-hi: rgba(255,255,255,.10); }

/* Grille de ghost cards qui imite la grille de produits */
.skeleton-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

.skeleton {
  position: relative; border-radius: var(--radius); overflow: hidden;
  background: var(--ghost-bg); border: 1px solid rgba(255,255,255,.05);
  display: flex; flex-direction: column;
  animation: ghost-pulse 2.4s ease-in-out infinite;
}
/* Thumb (zone image) */
.skeleton::before {
  content: ""; display: block; aspect-ratio: 4/3;
  background: linear-gradient(100deg, var(--ghost-bg) 30%, var(--ghost-hi) 50%, var(--ghost-bg) 70%);
  background-size: 220% 100%; animation: ghost-shimmer 1.6s linear infinite;
}
/* Lignes (titre + prix) */
.skeleton::after {
  content: ""; flex: 1;
  padding: 16px;
  background-image:
    linear-gradient(var(--ghost-hi), var(--ghost-hi)),                    /* ligne titre 70% */
    linear-gradient(var(--ghost-hi), var(--ghost-hi)),                    /* ligne titre 45% */
    linear-gradient(var(--ghost-hi), var(--ghost-hi));                    /* ligne prix 30% */
  background-repeat: no-repeat;
  background-size: 70% 10px, 45% 10px, 30% 14px;
  background-position: 16px 16px, 16px 34px, 16px 60px;
}
@keyframes ghost-shimmer { from { background-position: 220% 0; } to { background-position: -220% 0; } }
@keyframes ghost-pulse { 0%,100% { opacity: 1; } 50% { opacity: .82; } }

/* Lignes ghost pour le comparateur (liste verticale) */
.skeleton-rows { display: flex; flex-direction: column; gap: 8px; padding: 6px 0; }
.skeleton-row {
  height: 64px; border-radius: 12px; padding: 12px 14px;
  background: var(--ghost-bg); border: 1px solid rgba(255,255,255,.05);
  background-image:
    linear-gradient(100deg, transparent 30%, var(--ghost-hi) 50%, transparent 70%),
    linear-gradient(var(--ghost-hi), var(--ghost-hi)),
    linear-gradient(var(--ghost-hi), var(--ghost-hi));
  background-size: 220% 100%, 60% 10px, 30% 14px;
  background-position: 0 0, 14px 18px, 14px 40px;
  background-repeat: no-repeat;
  animation: ghost-shimmer 1.6s linear infinite, ghost-pulse 2.4s ease-in-out infinite;
}

/* Compat : si .spinner reste utilisé quelque part, on le rend invisible */
.spinner { display: none; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

@media (max-width: 820px) {
  .sidebar { position: fixed; left: -260px; z-index: 50; transition: left .2s; }
  .sidebar.open { left: 0; }
  .main { padding: 20px 16px; }
  .topbar { flex-direction: column; align-items: flex-start; }
}
