/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f8fafc;
  color: #1e293b;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

/* ===== CUSTOM PROPERTIES ===== */
:root {
  --color-nav:         #111827;
  --color-nav-text:    #9ca3af;
  --color-accent:      #f97316;      /* overridden per category via style attribute */
  --color-success:     #16a34a;
  --color-border:      #e2e8f0;
  --color-surface:     #ffffff;
  --color-muted:       #64748b;
  --color-heading:     #0f172a;
  --radius:            8px;
  --radius-lg:         12px;
  --shadow:            0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:         0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.05);
}

/* ===== LAYOUT ===== */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* ===== NAV ===== */
.site-nav {
  background: var(--color-nav);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(255,255,255,0.08);
}

.site-nav__inner {
  display: flex;
  align-items: center;
  height: 60px;
  gap: 1.5rem;
}

.site-nav__logo {
  display: flex;
  align-items: center;
  white-space: nowrap;
  flex-shrink: 0;
}

.site-nav__logo-img {
  height: 40px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

.site-nav__logo-text {
  display: none;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--color-accent);
  letter-spacing: -0.3px;
}

.site-nav__links {
  display: flex;
  gap: 1.25rem;
  overflow-x: auto;
}

.site-nav__links a {
  color: var(--color-nav-text);
  font-size: 0.875rem;
  white-space: nowrap;
  transition: color 0.15s;
}

.site-nav__links a:hover,
.site-nav__links a.active { color: #fff; }

/* ===== HERO ===== */
.hero {
  background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
  padding: 3rem 1rem 2.5rem;
  text-align: center;
}

.hero__eyebrow {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-accent);
  margin-bottom: 0.75rem;
}

.hero__title {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}

.hero__subtitle {
  color: #9ca3af;
  font-size: 1rem;
  max-width: 500px;
  margin: 0 auto 1.5rem;
}

.hero__updated {
  font-size: 0.8rem;
  color: #6b7280;
}

.hero__updated span { color: #10b981; }

/* ===== SECTION HEADER ===== */
.section-header {
  padding: 1.75rem 0 0.75rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-muted);
}

/* ===== CATEGORY GRID (homepage) ===== */
.category-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  padding-bottom: 2rem;
}

@media (max-width: 640px) {
  .category-grid { grid-template-columns: 1fr; }
}

/* ===== CATEGORY CARD ===== */
.cat-card {
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow 0.15s, transform 0.15s;
  cursor: pointer;
}

.cat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.cat-card__header {
  padding: 1.25rem 1.25rem 1rem;
  background: linear-gradient(135deg, var(--cat-color-dark), var(--cat-color));
  position: relative;
}

.cat-card__icon { font-size: 1.75rem; margin-bottom: 0.4rem; }
.cat-card__name { font-size: 1.1rem; font-weight: 800; color: #fff; }
.cat-card__count { font-size: 0.8rem; color: rgba(255,255,255,0.7); }

.cat-card__badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(255,255,255,0.2);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

.cat-card__body { padding: 1rem 1.25rem 1.25rem; }

.cat-card__best-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  margin-bottom: 0.35rem;
}

.cat-card__best-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.cat-card__best-provider { font-weight: 700; font-size: 0.95rem; }
.cat-card__best-price { font-weight: 800; font-size: 1.15rem; color: var(--cat-color); }

.cat-card__divider { border: none; border-top: 1px solid var(--color-border); margin: 0.5rem 0; }

.cat-card__rows { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.9rem; }

.cat-card__row {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--color-muted);
}

.cat-card__row span:last-child { font-weight: 600; color: var(--color-heading); }

.cat-card__cta {
  display: block;
  background: var(--cat-color);
  color: #fff;
  text-align: center;
  padding: 0.5rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 700;
  transition: opacity 0.15s;
}

.cat-card__cta:hover { opacity: 0.88; }

.cat-card--coming .cat-card__header {
  background: linear-gradient(135deg, #6b7280, #9ca3af);
}

.cat-card--coming .cat-card__body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  color: var(--color-muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ===== HOW IT WORKS ===== */
.howto {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 1.75rem 0;
}

.howto__title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-muted);
  margin-bottom: 1rem;
}

.howto__steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 640px) {
  .howto__steps { grid-template-columns: 1fr; }
}

.howto__step { text-align: center; }

.howto__step-num {
  width: 28px;
  height: 28px;
  background: var(--color-nav);
  color: #fff;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.6rem;
}

.howto__step p { font-size: 0.82rem; color: var(--color-muted); line-height: 1.5; }

/* ===== CATEGORY PAGE HERO ===== */
.cat-hero {
  background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
  padding: 2rem 1rem 1.5rem;
  border-bottom: 3px solid var(--color-accent);
}

.cat-hero__eyebrow {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-accent);
  margin-bottom: 0.4rem;
}

.cat-hero__title { font-size: 1.75rem; font-weight: 800; color: #fff; margin-bottom: 0.25rem; }
.cat-hero__desc  { color: #9ca3af; font-size: 0.9rem; }

/* ===== FILTER BAR ===== */
.filter-bar {
  background: #f1f5f9;
  border-bottom: 1px solid var(--color-border);
  padding: 0.75rem 0;
}

.filter-bar__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.filter-bar__label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-muted);
  white-space: nowrap;
}

.filter-bar__select {
  appearance: none;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 8px center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.35rem 2rem 0.35rem 0.65rem;
  font-size: 0.82rem;
  color: var(--color-heading);
  cursor: pointer;
  min-width: 120px;
}

.filter-bar__select:focus { outline: 2px solid var(--color-accent); outline-offset: 1px; }

.filter-bar__sort {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.filter-bar__count {
  font-size: 0.78rem;
  color: var(--color-muted);
  white-space: nowrap;
}

/* ===== COMPARISON TABLE ===== */
.comparison-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.comparison-table thead th {
  background: #e8f0fe;
  padding: 0.6rem 0.75rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-muted);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.comparison-table thead th:hover { background: #dde7fc; }
.comparison-table thead th.sorted { color: var(--color-accent); }
.comparison-table thead th .sort-arrow { margin-left: 4px; font-size: 0.65rem; }

.comparison-table tbody tr {
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  transition: background 0.1s;
}

.comparison-table tbody tr:nth-child(even) { background: #f8fafc; }
.comparison-table tbody tr:hover { background: #f0f9ff; }
.comparison-table tbody tr[hidden] { display: none; }

.comparison-table td {
  padding: 0.65rem 0.75rem;
  vertical-align: middle;
}

.td-provider { font-weight: 700; }
.td-price    { font-weight: 800; color: var(--color-success); font-size: 0.95rem; }
.td-price--mid { color: #ea580c; }

.td-cta a {
  display: inline-block;
  background: var(--color-success);
  color: #fff;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  transition: opacity 0.15s;
}

.td-cta a:hover { opacity: 0.85; }

/* ===== AD SLOTS ===== */
.ad-slot { display: flex; justify-content: center; align-items: center; }

/* Desktop ad visibility */
@media (max-width: 767px) {
  .ad-slot--desktop { display: none; }
}
@media (min-width: 768px) {
  .ad-slot--mobile  { display: none; }
}

/* ===== FOOTER ===== */
.site-footer {
  background: var(--color-nav);
  padding: 1rem 0;
  margin-top: auto;
}

.site-footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.site-footer span { font-size: 0.8rem; color: #6b7280; }

.site-footer__links { display: flex; gap: 1rem; }
.site-footer__links a { font-size: 0.8rem; color: #6b7280; }
.site-footer__links a:hover { color: #9ca3af; }

/* ===== RESPONSIVE: mobile table → card rows ===== */
@media (max-width: 640px) {
  .comparison-table thead { display: none; }

  .comparison-table tbody tr {
    display: block;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: 0.6rem;
    padding: 0.75rem;
  }

  .comparison-table td {
    display: flex;
    justify-content: space-between;
    padding: 0.2rem 0;
    font-size: 0.82rem;
  }

  .comparison-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--color-muted);
    font-size: 0.75rem;
    margin-right: 0.5rem;
  }

  .td-provider { font-size: 1rem; margin-bottom: 0.25rem; }
  .td-cta { margin-top: 0.5rem; }
  .td-cta a { display: block; text-align: center; width: 100%; padding: 0.4rem; }
}

/* Hide less important columns on tablet */
@media (max-width: 900px) and (min-width: 641px) {
  .col-hide-tablet { display: none; }
}

/* ===== PROVIDER LOGOS ===== */
.provider-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.provider-logo {
  height: 28px;
  width: auto;
  max-width: 80px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 4px;
}

.provider-name { font-weight: 700; }

/* CategoryCard logo */
.cat-card__logo {
  height: 20px;
  width: auto;
  max-width: 60px;
  object-fit: contain;
  border-radius: 3px;
  margin-right: 4px;
  vertical-align: middle;
}
