/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --black: #0a0a0a;
  --white: #fff;
  --gray: #f2f2f4;
  --gray2: #e5e5ea;
  --gray3: #aaaabc;
  --text: #1a1a2e;
  --text2: #555570;
  --text3: #888899;
  --accent: #4f46e5;
  --accent-h: #3730a3;
  --purple: #7c3aed;
  --score-bg: #3730a3;
  --border: #e5e5ea;
  --radius: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
}
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; color: var(--text); background: #f6f6f9; font-size: 14px; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; outline: none; font-family: inherit; }
input, select { font-family: inherit; outline: none; }

/* ── Header ── */
.header { background: var(--black); position: sticky; top: 0; z-index: 200; }
.header-inner { display: flex; align-items: center; gap: 20px; max-width: 1380px; margin: 0 auto; padding: 0 24px; height: 56px; }

.logo { font-size: 22px; font-weight: 900; color: var(--white); letter-spacing: -1px; flex-shrink: 0; }
.logo span { color: #a78bfa; }

/* Search */
.search-wrap { position: relative; flex: 1; max-width: 320px; }
.search-ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: #999; pointer-events: none; }
.search-input { width: 100%; background: #1a1a2e; border: 1px solid #333; border-radius: 20px; padding: 7px 14px 7px 33px; color: var(--white); font-size: 13px; transition: border .2s; }
.search-input::placeholder { color: #666; }
.search-input:focus { border-color: #555; background: #222; }
.search-dropdown { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #1a1a2e; border: 1px solid #333; border-radius: var(--radius); overflow: hidden; display: none; z-index: 300; box-shadow: 0 8px 32px rgba(0,0,0,.6); }
.search-dropdown.show { display: block; }
.search-item { padding: 10px 14px; display: flex; align-items: center; gap: 10px; cursor: pointer; transition: background .15s; }
.search-item:hover { background: #252540; }
.search-item img { width: 36px; height: 24px; object-fit: contain; }
.search-item .si-name { color: var(--white); font-size: 13px; font-weight: 600; }
.search-item .si-score { background: var(--score-bg); color: #fff; border-radius: 50%; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; margin-left: auto; }

/* Nav */
.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav-item { color: #ccc; font-size: 12px; font-weight: 700; letter-spacing: .5px; padding: 8px 12px; border-radius: 4px; transition: all .15s; display: flex; align-items: center; gap: 4px; cursor: pointer; position: relative; white-space: nowrap; }
.nav-item:hover, .nav-item.active { color: var(--white); }
.nav-item.active { border-bottom: 2px solid #a78bfa; border-radius: 0; }
.has-dropdown:hover .dropdown-menu { display: block; }
.dropdown-menu { display: none; position: absolute; top: 100%; left: 0; background: #1a1a2e; border: 1px solid #333; border-radius: var(--radius); min-width: 180px; z-index: 300; box-shadow: 0 8px 32px rgba(0,0,0,.6); overflow: hidden; }
.dropdown-menu a { display: block; padding: 11px 18px; color: #ccc; font-size: 13px; font-weight: 600; transition: background .15s; }
.dropdown-menu a:hover { background: #252540; color: var(--white); }

.header-icons { display: flex; gap: 6px; flex-shrink: 0; }
.icon-btn { background: none; color: #aaa; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 6px; transition: all .15s; }
.icon-btn:hover { background: #222; color: var(--white); }

/* ── Hero ── */
.hero { background: linear-gradient(135deg, var(--black) 0%, #1a0a3d 50%, #4c1d95 100%); padding: 48px 0 52px; }
.hero-inner { max-width: 1380px; margin: 0 auto; padding: 0 24px; }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 12px; color: rgba(255,255,255,.5); margin-bottom: 20px; }
.breadcrumb a:hover { color: rgba(255,255,255,.9); }
.breadcrumb span:last-child { color: rgba(255,255,255,.8); }
.hero h1 { font-size: clamp(28px, 4vw, 44px); font-weight: 900; color: var(--white); line-height: 1.1; margin-bottom: 24px; }
.top10-btn { display: inline-flex; align-items: center; border: 2px solid rgba(255,255,255,.7); color: rgba(255,255,255,.9); padding: 6px 20px; border-radius: 20px; font-size: 13px; font-weight: 700; letter-spacing: 1px; transition: all .2s; }
.top10-btn:hover { background: rgba(255,255,255,.1); border-color: var(--white); }

/* ── Layout ── */
.content-wrap { max-width: 1380px; margin: 28px auto; padding: 0 24px; display: flex; gap: 24px; align-items: flex-start; }

/* ── Sidebar ── */
.sidebar { width: 240px; flex-shrink: 0; background: var(--white); border-radius: 12px; border: 1px solid var(--border); overflow: hidden; }
.filter-section { padding: 16px 18px; border-bottom: 1px solid var(--border); }
.filter-section:last-of-type { border-bottom: none; }
.filter-label { font-size: 11px; font-weight: 800; letter-spacing: .8px; color: var(--text2); text-transform: uppercase; margin-bottom: 10px; }
.filter-label-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.help-btn { background: var(--gray); border: none; border-radius: 50%; width: 18px; height: 18px; font-size: 10px; font-weight: 700; color: var(--text3); cursor: pointer; }

/* Select */
.select-wrap { position: relative; }
.select-wrap::after { content: '▾'; position: absolute; right: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--text3); font-size: 12px; }
.select-wrap select { width: 100%; background: var(--gray); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 28px 8px 10px; font-size: 13px; color: var(--text); -webkit-appearance: none; cursor: pointer; }

/* Histogram */
.price-histogram { height: 44px; display: flex; align-items: flex-end; gap: 2px; margin-bottom: 8px; }
.histo-bar { flex: 1; background: #dde; border-radius: 2px 2px 0 0; min-height: 4px; transition: background .2s; }
.histo-bar.active { background: var(--accent); }

/* Dual range */
.dual-range-wrap { position: relative; height: 20px; margin-bottom: 6px; }
.dual-range-wrap input[type=range] { position: absolute; width: 100%; height: 4px; background: transparent; -webkit-appearance: none; pointer-events: none; top: 50%; transform: translateY(-50%); }
.dual-range-wrap input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); cursor: pointer; pointer-events: all; border: 2px solid var(--white); box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.dual-range-wrap input[type=range]::-webkit-slider-runnable-track { background: transparent; }

/* Single range */
input[type=range] { -webkit-appearance: none; height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--accent) var(--pct, 0%), var(--border) var(--pct, 0%)); cursor: pointer; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); cursor: pointer; border: 2px solid var(--white); box-shadow: 0 1px 4px rgba(0,0,0,.25); }

.price-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--text3); }

/* Brand list */
.brand-search-wrap { display: flex; align-items: center; gap: 7px; background: var(--gray); border: 1px solid var(--border); border-radius: var(--radius); padding: 7px 10px; margin-bottom: 10px; }
.brand-search-wrap input { background: none; border: none; font-size: 13px; color: var(--text); flex: 1; }
.brand-search-wrap input::placeholder { color: var(--text3); }
.brand-list { max-height: 180px; overflow-y: auto; }
.brand-list::-webkit-scrollbar { width: 4px; }
.brand-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.brand-item { display: flex; align-items: center; gap: 8px; padding: 5px 2px; cursor: pointer; }
.brand-item input[type=checkbox] { accent-color: var(--accent); width: 14px; height: 14px; flex-shrink: 0; cursor: pointer; }
.brand-item label { font-size: 13px; color: var(--text2); cursor: pointer; }

/* VRAM pills */
.vram-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { background: var(--gray); border: 1px solid var(--border); border-radius: 16px; padding: 4px 10px; font-size: 11px; font-weight: 700; color: var(--text2); transition: all .15s; }
.pill:hover { border-color: var(--accent); color: var(--accent); }
.pill.active { background: var(--accent); border-color: var(--accent); color: var(--white); }

.clear-btn { display: block; width: calc(100% - 36px); margin: 14px 18px; background: none; border: 1.5px solid var(--border); border-radius: var(--radius); padding: 9px; font-size: 13px; font-weight: 700; color: var(--text2); transition: all .2s; }
.clear-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Cards Area ── */
.cards-area { flex: 1; min-width: 0; }
.results-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.results-bar span { font-size: 13px; color: var(--text3); }
.view-toggle { display: flex; gap: 4px; }
.view-btn { background: var(--white); border: 1px solid var(--border); border-radius: 6px; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; color: var(--text3); transition: all .15s; }
.view-btn:hover, .view-btn.active { background: var(--accent); border-color: var(--accent); color: var(--white); }

/* ── Card Grid ── */
.cards-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.cards-grid.list-view { grid-template-columns: 1fr; }

/* ── Card ── */
.gpu-card { background: var(--white); border: 1.5px solid var(--border); border-radius: 12px; display: flex; align-items: center; gap: 14px; padding: 16px; transition: all .2s; cursor: pointer; position: relative; }
.gpu-card:hover { border-color: var(--accent); box-shadow: 0 4px 20px rgba(79,70,229,.12); transform: translateY(-1px); }

/* Score badge */
.score-badge { flex-shrink: 0; width: 52px; height: 52px; border-radius: 50%; background: var(--score-bg); display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(55,48,163,.4); }
.score-badge .score-num { font-size: 18px; font-weight: 900; color: var(--white); line-height: 1; }
.score-badge .score-lbl { font-size: 7px; font-weight: 700; color: rgba(255,255,255,.7); text-transform: uppercase; letter-spacing: .3px; line-height: 1.2; }
.score-badge.s-99 { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.score-badge.s-98 { background: linear-gradient(135deg, #2563eb, #4f46e5); }
.score-badge.s-97 { background: linear-gradient(135deg, #0891b2, #2563eb); }
.score-badge.s-low { background: linear-gradient(135deg, #64748b, #475569); }

/* Card image */
.card-img-wrap { flex-shrink: 0; width: 100px; height: 100px; display: flex; align-items: center; justify-content: center; background: #f8f8fb; border-radius: 10px; overflow: hidden; border: 1px solid #f0f0f5; }
.card-product-img { width: 100%; height: 100%; object-fit: contain; padding: 6px; display: block; }
.card-product-icon { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.card-img-placeholder { width: 80px; height: 44px; display: flex; align-items: center; justify-content: center; }
.card-img-placeholder svg { color: var(--gray3); }

/* Card info */
.card-info { flex: 1; min-width: 0; }
.card-name { font-size: 14px; font-weight: 700; color: var(--text); line-height: 1.3; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-price { font-size: 13px; font-weight: 700; color: #16a34a; margin-bottom: 8px; }
.card-specs { display: flex; flex-wrap: wrap; gap: 8px; }
.spec-item { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text3); }
.spec-item svg { flex-shrink: 0; color: var(--gray3); }
.spec-item .spec-val { font-weight: 700; color: var(--text2); }

/* Add to compare */
.card-add-btn { position: absolute; top: 12px; right: 12px; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--white); font-size: 18px; line-height: 1; display: flex; align-items: center; justify-content: center; transition: all .2s; flex-shrink: 0; }
.card-add-btn:hover { background: var(--accent-h); transform: scale(1.1); }
.card-add-btn.added { background: #16a34a; }
.card-add-btn.added::after { content: '✓'; font-size: 14px; }
.card-add-btn.added span { display: none; }

/* List view adjustments */
.list-view .gpu-card { padding: 14px 16px; }
.list-view .card-img-wrap { width: 84px; height: 84px; }
.list-view .card-specs { flex-direction: row; }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text3); }
.empty-state p { margin-top: 12px; font-size: 14px; }

/* ── Compare Bar ── */
.compare-bar { position: fixed; bottom: 0; left: 0; right: 0; background: #1a1a2e; border-top: 2px solid var(--purple); z-index: 100; padding: 12px 24px; }
.compare-bar-inner { max-width: 1380px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.compare-slots { display: flex; gap: 10px; flex: 1; }
.compare-slot { background: rgba(255,255,255,.08); border: 1.5px dashed rgba(255,255,255,.3); border-radius: var(--radius); padding: 7px 14px; font-size: 12px; color: rgba(255,255,255,.5); display: flex; align-items: center; gap: 8px; min-width: 160px; }
.compare-slot.filled { border-style: solid; border-color: var(--purple); color: var(--white); }
.compare-slot .slot-remove { margin-left: auto; cursor: pointer; color: rgba(255,255,255,.4); font-size: 14px; }
.compare-slot .slot-remove:hover { color: #f87171; }
.compare-go-btn { background: var(--purple); color: var(--white); padding: 9px 24px; border-radius: var(--radius); font-size: 13px; font-weight: 700; transition: all .15s; border: none; cursor: pointer; white-space: nowrap; }
.compare-go-btn:hover { background: #6d28d9; }
.compare-go-btn:disabled { opacity: .4; cursor: not-allowed; }
.compare-clear { background: none; color: rgba(255,255,255,.4); font-size: 20px; padding: 4px 8px; transition: color .15s; }
.compare-clear:hover { color: #f87171; }

/* ── Footer ── */
.footer { background: var(--black); color: rgba(255,255,255,.5); padding: 40px 24px; margin-top: 60px; }
.footer-inner { max-width: 1380px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.footer-logo { font-size: 22px; font-weight: 900; color: var(--white); letter-spacing: -1px; }
.footer-links { display: flex; gap: 24px; flex-wrap: wrap; justify-content: center; }
.footer-links a { font-size: 13px; transition: color .15s; }
.footer-links a:hover { color: rgba(255,255,255,.9); }
.footer-copy { font-size: 12px; }

/* ── Compare Page ── */
.compare-page-wrap { max-width: 1380px; margin: 32px auto; padding: 0 24px; }
.compare-hero { background: var(--black); color: var(--white); border-radius: 12px; padding: 32px; margin-bottom: 28px; }
.compare-hero h1 { font-size: 28px; font-weight: 900; margin-bottom: 8px; }
.compare-hero p { color: rgba(255,255,255,.6); font-size: 14px; }
.compare-table-wrap { overflow-x: auto; }
.compare-table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--white); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.compare-table th { background: var(--gray); padding: 16px; text-align: center; font-size: 13px; border-bottom: 2px solid var(--border); }
.compare-table td { padding: 14px 16px; text-align: center; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
.compare-table tr:last-child td { border-bottom: none; }
.compare-table td:first-child { text-align: left; font-weight: 700; color: var(--text3); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; background: var(--gray); }
.compare-table .winner { background: rgba(79,70,229,.06); font-weight: 700; color: var(--accent); }
.compare-score { font-size: 22px; font-weight: 900; color: var(--accent); }
.compare-card-head { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.compare-card-head img { width: 100px; height: 64px; object-fit: contain; }
.compare-card-head .cch-name { font-size: 13px; font-weight: 700; line-height: 1.3; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .content-wrap { flex-direction: column; }
  .sidebar { width: 100%; }
  .cards-grid { grid-template-columns: 1fr; }
  .nav { display: none; }
}
@media (max-width: 600px) {
  .header-inner { gap: 10px; }
  .search-wrap { max-width: 160px; }
}

/* ── Smart Home Additions ── */

/* Category label above product name */
.cat-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 3px;
  line-height: 1;
}

/* Protocol badges */
.proto-badge {
  display: inline-block;
  border-radius: 10px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  line-height: 1.4;
}
.proto-matter   { background: #4f46e5; }
.proto-thread   { background: #d97706; }
.proto-zigbee   { background: #2563eb; }
.proto-zwave    { background: #059669; }
.proto-wifi     { background: #6b7280; }
.proto-bluetooth{ background: #3b82f6; }

/* Assistant badge */
.assistant-badge {
  display: inline-block;
  border-radius: 10px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #e5e7eb;
  line-height: 1.4;
}

/* Make card-specs wrap nicely with badges */
.card-specs { flex-wrap: wrap; row-gap: 5px; }

/* Card icon area — center the SVG icon */
.card-img-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  /* sizing handled by inline rule above */
}

/* ── Mini-spec blocks in cards ───────────────────────────────────────────── */
.card-mini-specs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid #f0f0f0;
}
.mini-spec-block {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.mini-spec-block-title {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: #6366f1;
}
.mini-spec-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 10px;
}
.mini-spec-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.mini-spec-lbl {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #aaa;
}
.mini-spec-val {
  font-size: 11px;
  font-weight: 600;
  color: #374151;
  line-height: 1.3;
}
/* Suggest link */
/* Card description */
.card-desc {
  margin: 8px 0 0;
  font-size: 11.5px;
  line-height: 1.55;
  color: #6b7280;
}
.list-view .card-desc { margin-top: 5px; }

.suggest-link {
  font-size: 10px;
  font-style: italic;
  color: #a5b4fc;
  text-decoration: none;
  cursor: pointer;
}
.suggest-link:hover { color: #6366f1; text-decoration: underline; }

/* List view — blocks side by side */
.list-view .card-mini-specs { flex-direction: row; gap: 16px; flex-wrap: wrap; }
.list-view .mini-spec-grid { grid-template-columns: repeat(2, max-content); gap: 4px 12px; }

/* ── Compare table group headers ─────────────────────────────────────────── */
.compare-table .spec-group-header td {
  background: #f5f5ff;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: #6366f1;
  padding: 10px 14px 5px;
  border-bottom: none;
}

/* ── Amazon badge & price row ─────────────────────────────────────────────── */
.card-price-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 2px 0; }
.amazon-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #ff9900;
  color: #111;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 10px;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s;
}
.amazon-badge:hover { background: #e68900; }
