/* Estilos de las páginas de precios (provincias, municipios, marcas, gasolineras) que genera el
   servidor (server/seo-render.js). Son páginas sin React, ligeras y rápidas. Usan la misma paleta
   y escala de letra que la app (client/src/styles.css) y el modo día/noche que fija theme-init.js. */
:root {
  --bg: #edf3fa; --surface: #fafcff; --surface-2: #e5eef8; --text: #172a3e; --muted: #4f6278; --border: #d2deeb;
  --accent: #1661c2; --accent-fg: #fff; --accent-soft: #dae7f8; --primary: #183a63; --primary-fg: #fafcff; --ok: #157549;
  --radius: 16px; --fs-base: 17px; --fs-sm: calc(0.85rem + 2px); --fs-h1: calc(1.5rem + 2px); --fs-h2: calc(1.1rem + 2px);
  color-scheme: light;
}
[data-theme='dark'] {
  --bg: #0a1220; --surface: #111c2e; --surface-2: #19283f; --text: #e5eefa; --muted: #98abc4; --border: #233651;
  --accent: #5ca4f7; --accent-fg: #06121f; --accent-soft: #15315a; --primary: #e5eefa; --primary-fg: #0a1220; --ok: #3ad29a;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); font-size: var(--fs-base); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: var(--fs-h1); letter-spacing: -0.02em; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-base); }
p { margin: 0; }

/* Barra superior y barra inferior: copia de las de la app (client/src/styles.css) para que
   el logo, el menú y los botones se vean exactamente igual en todas las páginas. */
.topbar { position: sticky; top: 0; z-index: 1000; height: 68px; display: flex; align-items: center; gap: 20px; padding: 0 max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left)); background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.5rem; color: var(--text); text-decoration: none; letter-spacing: -0.02em; }
.topnav { display: flex; gap: 4px; margin-left: 12px; }
.topnav a { display: flex; align-items: center; gap: 7px; height: 42px; padding: 0 15px; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 1.08rem; }
.topnav a:hover { background: var(--surface-2); color: var(--text); }
.topnav a.active { background: var(--accent-soft); color: var(--accent); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn { display: inline-grid; place-items: center; border-radius: 50%; cursor: pointer; flex-shrink: 0; }
.theme-toggle { width: 42px; height: 42px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); }
.theme-toggle .when-dark { display: none; }
[data-theme='dark'] .theme-toggle .when-dark { display: block; }
[data-theme='dark'] .theme-toggle .when-light { display: none; }
.btn-entrar { display: inline-flex; align-items: center; height: 42px; padding: 0 18px; border-radius: 999px; background: var(--primary); color: var(--primary-fg); font-weight: 600; font-size: 1.08rem; text-decoration: none; }
.btn-entrar:hover { opacity: 0.9; }
.avatar-link { text-decoration: none; }
.avatar { width: 42px; height: 42px; font-size: 1.08rem; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-fg); font-weight: 700; }
.bottomnav { display: none; }
@media (max-width: 760px) {
  .topnav { display: none; }
  .topbar { height: 60px; padding-left: 14px; padding-right: 10px; }
  .brand { font-size: 1.35rem; }
  body { padding-bottom: calc(70px + env(safe-area-inset-bottom)); } /* sitio para la barra inferior */
  .bottomnav { display: grid; grid-template-columns: repeat(var(--items, 3), 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000; background: var(--surface); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px; color: var(--muted); text-decoration: none; font-size: 0.72rem; font-weight: 600; border-radius: 12px; }
  .bottomnav a.active { color: var(--accent); }
  .bottomnav a.active .icon { background: var(--accent-soft); border-radius: 999px; padding: 2px 14px; width: 52px; }
}

/* Contenido */
.page { max-width: 1100px; margin: 0 auto; padding: 18px 16px 48px; display: flex; flex-direction: column; gap: 16px; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; font-size: var(--fs-sm); color: var(--muted); }
.crumbs li + li::before { content: '›'; margin-right: 6px; }
.crumbs a { color: var(--muted); }
.hero, .block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; display: flex; flex-direction: column; gap: 12px; }
.lead { font-size: 1.1rem; }
.updated { color: var(--muted); font-size: var(--fs-sm); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 999px; background: var(--accent); color: var(--accent-fg); font-weight: 700; text-decoration: none; }
.btn:hover { opacity: 0.92; }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-big { align-self: flex-start; padding: 12px 22px; font-size: 1.05rem; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.muted { color: var(--muted); font-size: var(--fs-sm); }

/* Tarjetas de precio medio */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); color: var(--text); text-decoration: none; border: 1px solid transparent; }
a.stat:hover { border-color: var(--accent); }
.stat-label { font-size: var(--fs-sm); color: var(--muted); font-weight: 650; }
.stat strong { font-size: 1.5rem; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: var(--fs-sm); color: var(--muted); }

/* Lista de gasolineras */
.stations { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; counter-reset: st; }
.stations li { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); counter-increment: st; }
.stations li::before { content: counter(st); display: grid; place-items: center; min-width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: var(--fs-sm); }
.stations a { display: flex; flex-direction: column; flex: 1; min-width: 0; text-decoration: none; color: var(--text); }
.st-name { font-weight: 700; }
.st-sub { font-size: var(--fs-sm); color: var(--muted); overflow-wrap: anywhere; }
.st-price { font-weight: 800; font-size: 1.15rem; color: var(--ok); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Tablas */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: none; }
thead th { background: var(--surface-2); font-size: var(--fs-sm); color: var(--muted); }
tbody th { font-weight: 600; }

/* Enlaces, preguntas frecuentes */
.links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.links a { display: inline-block; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); text-decoration: none; color: var(--text); font-weight: 600; font-size: var(--fs-sm); }
.faq { display: flex; flex-direction: column; gap: 8px; }
.bullets { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.bullets li::marker { color: var(--accent); }
.faq h3 { margin-top: 8px; }

/* Pie con enlaces (server/seo-render.js → footerHtml). Ocupa todo el ancho de la ventana, con el
   mismo margen lateral que la barra superior. Columnas: marca · precio hoy · provincias · marcas. */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); margin-top: 32px; }
.footer-cols { display: grid; grid-template-columns: minmax(240px, 1.3fr) minmax(190px, 1fr) minmax(360px, 2.6fr) minmax(220px, 1.1fr); gap: 32px 48px; padding: 40px max(20px, env(safe-area-inset-right)) 32px max(20px, env(safe-area-inset-left)); }
.site-footer h2 { position: relative; font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: 0.05em; color: var(--text); margin: 0 0 16px; padding-bottom: 10px; }
.site-footer h2::after { content: ''; position: absolute; left: 0; bottom: 0; width: 28px; height: 3px; border-radius: 3px; background: var(--accent); }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer ul.stack { display: flex; flex-direction: column; gap: 10px; }
.site-footer ul.columns { columns: 4 130px; column-gap: 24px; }
.site-footer ul.columns.two { columns: 2 110px; }
.site-footer ul.columns li { break-inside: avoid; padding: 0 0 9px; }
.site-footer a { color: var(--muted); text-decoration: none; font-size: var(--fs-sm); transition: color 0.15s; }
.site-footer a:hover { color: var(--accent); }
.fcol-about { display: flex; flex-direction: column; gap: 12px; color: var(--muted); font-size: var(--fs-sm); line-height: 1.55; }
.fcol-about p { margin: 0; }
.site-footer .footer-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; font-size: 1.3rem; letter-spacing: -0.02em; }
.footer-badge { display: inline-block; margin-right: 4px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: calc(0.72rem + 2px); }
.footer-legal { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px; padding: 16px max(20px, env(safe-area-inset-right)) 18px max(20px, env(safe-area-inset-left)); border-top: 1px solid var(--border); background: var(--surface-2); color: var(--muted); font-size: var(--fs-sm); }
.footer-legal p { margin: 0; }
.footer-legal ul { display: flex; flex-wrap: wrap; gap: 6px 22px; }
@media (max-width: 1200px) { .footer-cols { grid-template-columns: minmax(220px, 1fr) minmax(190px, 1fr); } .fcol-provinces { grid-column: 1 / -1; } .fcol-brands { grid-column: 1 / -1; } .site-footer ul.columns.two { columns: 4 130px; } }
@media (max-width: 640px) { .footer-cols { grid-template-columns: 1fr; gap: 28px; padding-top: 32px; } .site-footer ul.columns { columns: 2; } .site-footer ul.columns.two { columns: 2; } .footer-legal { flex-direction: column-reverse; align-items: flex-start; } }

@media (max-width: 640px) {
  .hero, .block { padding: 16px; }
  h1 { font-size: calc(1.3rem + 2px); }
  .btn-big { align-self: stretch; }
  th, td { padding: 7px 7px; white-space: normal; font-size: var(--fs-sm); } /* en el móvil las celdas pasan a varias líneas: sin scroll lateral */
  thead th { font-size: calc(0.75rem + 2px); }
}
