/* ============================================================
   COMPARETHESPECS — Main Stylesheet
   Clean, fast, accessible. No framework dependencies.
   ============================================================ */

:root {
  --c-bg: #ffffff;
  --c-surface: #f8f9fa;
  --c-border: #e2e8f0;
  --c-text: #1a202c;
  --c-muted: #718096;
  --c-accent: #2b6cb0;
  --c-accent-h: #2c5282;
  --c-green: #276749;
  --c-red: #c53030;
  --c-yellow: #d69e2e;
  --c-score: #3182ce;
  --radius: 6px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--c-text);
  background: var(--c-bg);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

a {
  color: var(--c-accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* ── HEADER ─────────────────────────────────────────────── */
.site-header {
  background: var(--c-text);
  padding: 14px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  text-decoration: none;
}
.logo-compare {
  color: #90cdf4;
}
.logo-the {
  color: #bee3f8;
  font-weight: 400;
}
.logo-specs {
  color: #ffffff;
}

.site-nav a {
  color: #a0aec0;
  font-size: 14px;
}
.site-nav a:hover {
  color: #fff;
  text-decoration: none;
}

/* ── BREADCRUMB ──────────────────────────────────────────── */
.breadcrumb {
  font-size: 13px;
  color: var(--c-muted);
  padding: 16px 0 8px;
}
.breadcrumb a {
  color: var(--c-muted);
}
.breadcrumb a:hover {
  color: var(--c-accent);
}

/* ── PAGE HEADER ─────────────────────────────────────────── */
.page-header {
  padding: 24px 0 20px;
  border-bottom: 1px solid var(--c-border);
  margin-bottom: 20px;
}

.page-header h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--c-text);
  line-height: 1.3;
}

.name-zh {
  color: var(--c-muted);
  font-size: 15px;
  margin-top: 4px;
}

.page-description {
  color: var(--c-muted);
  margin-top: 10px;
  max-width: 700px;
  font-size: 15px;
}

.page-question {
  color: var(--c-accent);
  margin-top: 8px;
  font-size: 15px;
}

.data-links {
  margin-top: 12px;
  font-size: 13px;
  color: var(--c-muted);
}
.data-link {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border: 1px solid var(--c-border);
  border-radius: 3px;
  font-size: 12px;
  color: var(--c-muted);
}
.data-link:hover {
  border-color: var(--c-accent);
  color: var(--c-accent);
  text-decoration: none;
}

/* ── FILTER BAR ──────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--c-border);
}

.filter-label {
  font-size: 13px;
  color: var(--c-muted);
  font-weight: 500;
}

.country-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.country-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}

.country-tag.included {
  background: var(--c-accent);
  color: white;
}
.country-tag.included:hover {
  background: var(--c-accent-h);
  text-decoration: none;
}
.country-tag.excluded {
  background: var(--c-surface);
  color: var(--c-muted);
  border: 1px solid var(--c-border);
  text-decoration: line-through;
  opacity: 0.7;
}
.country-tag.excluded:hover {
  opacity: 1;
  text-decoration: none;
}

.filter-reset {
  font-size: 12px;
  color: var(--c-red);
  padding: 3px 8px;
}

.result-count {
  margin-left: auto;
  font-size: 13px;
  color: var(--c-muted);
}

/* ── SPEC TABLE ──────────────────────────────────────────── */
.table-scroll {
  overflow-x: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--c-border);
}

.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: white;
}

.spec-table thead {
  background: var(--c-text);
  color: white;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.spec-table th {
  padding: 11px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.spec-table th .unit {
  font-weight: 400;
  opacity: 0.7;
  font-size: 11px;
}

.spec-table tbody tr.product-row {
  border-bottom: 1px solid var(--c-border);
  transition: background 0.1s;
}

.spec-table tbody tr.product-row:hover {
  background: #ebf8ff;
}

.spec-table tbody tr.product-row.expanded {
  background: #ebf8ff;
}

.spec-table td {
  padding: 11px 14px;
  vertical-align: middle;
}

/* Product detail row — hidden by default */
.product-detail-row {
  display: none;
  background: var(--c-surface);
  border-bottom: 2px solid var(--c-accent);
}
.product-detail-row.open {
  display: table-row;
}

.product-detail {
  padding: 16px;
}

.detail-summary {
  color: var(--c-text);
  margin-bottom: 12px;
  font-size: 14px;
}

.detail-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 12px;
}

.detail-col h4 {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detail-col p {
  font-size: 13px;
  color: var(--c-text);
}

.detail-sources {
  font-size: 12px;
  color: var(--c-muted);
  padding-top: 10px;
  border-top: 1px solid var(--c-border);
}
.detail-sources a {
  color: var(--c-muted);
}

/* Column widths */
.col-product {
  min-width: 160px;
}
.col-price {
  min-width: 80px;
  white-space: nowrap;
}
.col-spec {
  min-width: 90px;
  text-align: center;
}
.col-score {
  min-width: 80px;
}
.col-buy {
  min-width: 70px;
}

/* Product name cell */
.product-name {
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.verified-badge {
  color: var(--c-green);
  font-size: 12px;
  font-weight: 700;
}

.origin-tag {
  display: inline-block;
  font-size: 11px;
  color: var(--c-muted);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 3px;
  padding: 1px 5px;
  margin-top: 3px;
}

/* Spec cell types */
.bool-yes {
  color: var(--c-green);
  font-weight: 700;
  font-size: 16px;
}
.bool-no {
  color: var(--c-red);
  font-weight: 700;
  font-size: 16px;
}
.no-data {
  color: var(--c-border);
}
.num-val .unit {
  color: var(--c-muted);
  font-size: 12px;
}

/* Price */
.price {
  font-weight: 600;
  color: var(--c-text);
}

/* Score bar */
.score-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
}
.score-val {
  font-weight: 700;
  font-size: 13px;
  min-width: 28px;
}
.score-bar {
  flex: 1;
  height: 5px;
  background: var(--c-border);
  border-radius: 3px;
  overflow: hidden;
  min-width: 40px;
}
.score-fill {
  height: 100%;
  background: var(--c-score);
  border-radius: 3px;
}

/* Buy button */
.buy-btn {
  display: inline-block;
  padding: 5px 12px;
  background: var(--c-accent);
  color: white;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s;
}
.buy-btn:hover {
  background: var(--c-accent-h);
  text-decoration: none;
  color: white;
}

/* ── QUESTION PAGES GRID ─────────────────────────────────── */
.question-pages {
  margin: 32px 0;
}
.question-pages h2 {
  font-size: 18px;
  margin-bottom: 14px;
  color: var(--c-text);
}
.qpage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.qpage-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--c-text);
  text-decoration: none;
  transition: all 0.15s;
}
.qpage-card:hover {
  border-color: var(--c-accent);
  background: #ebf8ff;
  text-decoration: none;
  color: var(--c-accent);
}
.qpage-arrow {
  color: var(--c-muted);
}

/* ── RELATED TERMS ───────────────────────────────────────── */
.related-terms {
  margin: 28px 0;
}
.related-terms h2 {
  font-size: 16px;
  margin-bottom: 12px;
  color: var(--c-muted);
  font-weight: 600;
}
.terms-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.term-tag {
  padding: 4px 10px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 20px;
  font-size: 13px;
  color: var(--c-muted);
}

/* ── FAQ ─────────────────────────────────────────────────── */
.faq-section {
  margin: 32px 0;
  border-top: 1px solid var(--c-border);
  padding-top: 24px;
}
.faq-section h2 {
  font-size: 18px;
  margin-bottom: 16px;
}
.faq-item {
  margin-bottom: 20px;
}
.faq-q {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--c-text);
}
.faq-a {
  font-size: 14px;
  color: var(--c-muted);
  line-height: 1.7;
}

/* ── AD SLOTS ────────────────────────────────────────────── */
.ad-slot {
  background: var(--c-surface);
  border: 1px dashed var(--c-border);
  border-radius: var(--radius);
  text-align: center;
  padding: 20px;
  color: var(--c-border);
  font-size: 12px;
  margin: 20px 0;
}

/* ── HOME PAGE ───────────────────────────────────────────── */
.home-header {
  padding: 40px 0 28px;
  text-align: center;
}
.home-header h1 {
  font-size: 32px;
  font-weight: 800;
}
.home-tagline {
  color: var(--c-muted);
  margin-top: 10px;
  font-size: 16px;
}
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding: 20px 0 40px;
}
.category-card {
  display: block;
  padding: 20px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--c-text);
  transition: all 0.15s;
  box-shadow: var(--shadow);
}
.category-card:hover {
  border-color: var(--c-accent);
  box-shadow: 0 4px 12px rgba(43, 108, 176, 0.1);
  text-decoration: none;
}
.category-name {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}
.category-zh {
  font-size: 14px;
  color: var(--c-muted);
  margin-bottom: 8px;
}
.category-desc {
  font-size: 13px;
  color: var(--c-muted);
  line-height: 1.5;
  margin-bottom: 12px;
}
.category-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--c-accent);
}

/* ── FOOTER ──────────────────────────────────────────────── */
.site-footer {
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
  padding: 24px 0;
  margin-top: 48px;
  font-size: 13px;
  color: var(--c-muted);
  text-align: center;
}
.footer-note {
  margin-top: 6px;
}

.back-link {
  margin: 20px 0;
}

.no-results {
  padding: 40px;
  text-align: center;
  color: var(--c-muted);
  background: var(--c-surface);
  border-radius: var(--radius);
  border: 1px solid var(--c-border);
}

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .page-header h1 {
    font-size: 20px;
  }
  .filter-bar {
    flex-direction: column;
    align-items: flex-start;
  }
  .result-count {
    margin-left: 0;
  }
  .detail-cols {
    grid-template-columns: 1fr;
  }
}

/* ── SEARCH ──────────────────────────────────────────────── */
.search-wrap {
  flex: 1;
  min-width: 180px;
  max-width: 280px;
}
.product-search {
  width: 100%;
  padding: 6px 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.15s;
}
.product-search:focus {
  border-color: var(--c-accent);
}

/* ── SORTABLE HEADERS ────────────────────────────────────── */
.sortable {
  -webkit-user-select: none;
  user-select: none;
}
.sortable:hover {
  background: #2d3748;
}
.sort-icon {
  font-size: 11px;
  opacity: 0.6;
  margin-left: 4px;
}

/* ── SOURCE LINKS ────────────────────────────────────────── */
.source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.source-link {
  display: inline-block;
  padding: 3px 10px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 3px;
  font-size: 12px;
  color: var(--c-muted);
  text-decoration: none;
}
.source-link:hover {
  border-color: var(--c-accent);
  color: var(--c-accent);
}
.source-link.buy-source {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: white;
  font-weight: 600;
}
.source-link.buy-source:hover {
  background: var(--c-accent-h);
}

/* ── LANGUAGE SWITCHER ───────────────────────────────────── */
.lang-switch {
  display: inline-block;
  margin-left: 16px;
  padding: 4px 12px;
  border: 1px solid #4a5568;
  border-radius: 20px;
  color: #a0aec0;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s;
}
.lang-switch:hover {
  border-color: #90cdf4;
  color: #90cdf4;
  text-decoration: none;
}

/* ── CATEGORY COUNT ──────────────────────────────────────── */
.category-count {
  font-size: 12px;
  color: var(--c-muted);
  margin-bottom: 8px;
}
.fx-approx {
  display: none;
  font-size: 0.75em;
  color: var(--c-muted);
}
