/* === Variables & Thème === */
:root,
[data-theme="light"] {
  --bg: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F1F5F9;
  --text: #0F172A;
  --text-secondary: #64748B;
  --text-muted: #94A3B8;
  --border: #E2E8F0;
  --accent: #2563EB;
  --accent-light: #DBEAFE;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-lg: 0 4px 12px rgba(0,0,0,.1);
  --radius: 12px;
  --radius-sm: 8px;
}

[data-theme="dark"] {
  --bg: #0F172A;
  --bg-card: #1E293B;
  --bg-card-hover: #334155;
  --text: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --border: #334155;
  --accent: #3B82F6;
  --accent-light: #1E3A5F;
  --shadow: 0 1px 3px rgba(0,0,0,.3);
  --shadow-lg: 0 4px 12px rgba(0,0,0,.4);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

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

.hidden { display: none !important; }

/* === Layout === */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* === Header === */
.header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: .75rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

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

.logo {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.logo h1 {
  font-size: .95rem;
  font-weight: 700;
  margin: 0;
}

.logo i { color: var(--accent); font-size: 1.4rem; }

.search-bar {
  flex: 1;
  max-width: 400px;
  position: relative;
}

.search-bar input {
  width: 100%;
  padding: .5rem 1rem .5rem 2.5rem;
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: .875rem;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.search-bar input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.search-icon-btn {
  position: absolute;
  left: .5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: .875rem;
  padding: .25rem;
  z-index: 1;
}

.search-icon-btn:hover { color: var(--accent); }

.search-bar i {
  position: absolute;
  left: .875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: .875rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}

.btn-icon:hover {
  background: var(--bg-card-hover);
}

/* === Breadcrumb === */
.breadcrumb-bar {
  padding: .75rem 0;
}

#breadcrumb {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .85rem;
  color: var(--text-muted);
}

.breadcrumb-link {
  color: var(--accent);
}

.breadcrumb-current {
  color: var(--text);
  font-weight: 600;
}

.breadcrumb-sep { color: var(--text-muted); }

/* === Section titles === */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1.5rem 0 1rem;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.section-subtitle {
  font-size: .85rem;
  color: var(--text-muted);
}

/* === Filtres carburant === */
.filtres-bar {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.filtre-carburant {
  padding: .375rem .875rem;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: .375rem;
}

.filtre-carburant:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filtre-carburant.actif {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.filtre-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* === Prix Cards === */
.prix-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .75rem;
}

.prix-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  cursor: pointer;
  transition: all .2s;
  box-shadow: var(--shadow);
}

.prix-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--accent, var(--border));
}

.prix-card-header {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .5rem;
}

.prix-card-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.prix-card-label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.prix-card-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: .25rem;
}

.prix-card-sub {
  font-size: .75rem;
  color: var(--text-muted);
}

/* === Régions list === */
.regions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: .75rem;
}

.region-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-decoration: none;
  color: var(--text);
  transition: all .2s;
  box-shadow: var(--shadow);
}

.region-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
  text-decoration: none;
  transform: translateY(-1px);
}

.region-card-nom {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: .5rem;
}

.region-card-stats {
  display: flex;
  gap: 1rem;
  margin-bottom: .375rem;
}

.region-stat {
  font-size: .8rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: .375rem;
}

.stat-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.region-card-nb {
  font-size: .75rem;
  color: var(--text-muted);
}

/* === Départements list === */
.depts-list {
  display: flex;
  flex-direction: column;
  gap: .375rem;
}

.dept-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  transition: all .15s;
}

.dept-row:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  text-decoration: none;
}

.dept-code {
  font-weight: 800;
  font-size: .85rem;
  color: var(--accent);
  min-width: 2rem;
}

.dept-nom {
  flex: 1;
  font-weight: 600;
  font-size: .9rem;
}

.dept-prix {
  display: flex;
  align-items: center;
  gap: .375rem;
  font-size: .85rem;
  font-weight: 600;
  min-width: 6rem;
}

.dept-stations {
  font-size: .75rem;
  color: var(--text-muted);
  min-width: 5rem;
  text-align: right;
}

/* === Stations Table === */
.stations-table {
  width: 100%;
  border-collapse: collapse;
}

.stations-table thead th {
  text-align: left;
  padding: .625rem .75rem;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}

.station-row {
  transition: background .15s;
}

.station-row:hover {
  background: var(--bg-card-hover);
}

.station-row td {
  padding: .75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.station-rank {
  font-weight: 800;
  color: var(--accent);
  font-size: .85rem;
  width: 2rem;
}

.station-ville {
  font-weight: 700;
  font-size: .9rem;
}

.station-adresse {
  font-size: .8rem;
  color: var(--text-muted);
}

.station-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-top: .25rem;
}

.btn-maps {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .7rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  padding: .15rem .5rem;
  border: 1px solid var(--accent);
  border-radius: 99px;
  transition: all .15s;
}

.btn-maps:hover {
  background: var(--accent);
  color: white;
  text-decoration: none;
}

.btn-maps i { font-size: .65rem; }

.badge {
  display: inline-block;
  padding: .125rem .5rem;
  border-radius: 99px;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-top: .25rem;
}

.badge-24h {
  background: #DCFCE7;
  color: #166534;
}

[data-theme="dark"] .badge-24h {
  background: #14532D;
  color: #86EFAC;
}

.station-prix-principal {
  white-space: nowrap;
}

.prix-highlight {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
}

.prix-maj {
  display: block;
  font-size: .7rem;
  color: var(--text-muted);
  margin-top: .125rem;
}

.station-autres-prix {
  display: flex;
  flex-wrap: wrap;
  gap: .375rem;
}

.mini-prix {
  display: flex;
  align-items: center;
  gap: .25rem;
  font-size: .75rem;
  color: var(--text-secondary);
  padding: .125rem .375rem;
  border-radius: 4px;
  background: var(--bg);
}

.mini-prix.actif {
  font-weight: 700;
  color: var(--text);
}

.mini-prix-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

/* === Hero Stats === */
.hero-stats {
  background: linear-gradient(135deg, #1E40AF 0%, #3B82F6 100%);
  border-radius: var(--radius);
  padding: 1.5rem;
  color: white;
  margin: 1rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.hero-main h1 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: .25rem;
}

.hero-main p {
  font-size: .9rem;
  opacity: .85;
}

.hero-badges {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}

.hero-badge {
  background: rgba(255,255,255,.15);
  backdrop-filter: blur(8px);
  padding: .5rem 1rem;
  border-radius: var(--radius-sm);
  text-align: center;
}

.hero-badge-value {
  font-size: 1.25rem;
  font-weight: 800;
}

.hero-badge-label {
  font-size: .7rem;
  opacity: .8;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* === Loading / Error states === */
.loader-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  padding: 2rem;
  color: var(--text-muted);
  font-size: .9rem;
}

.loader {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.error-state {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

.error-state i {
  font-size: 2rem;
  color: #EF4444;
  margin-bottom: .5rem;
}

.btn-retry {
  margin-top: .75rem;
  padding: .5rem 1.25rem;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: .85rem;
}

.btn-retry:hover { opacity: .9; }

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 2.5rem;
  margin-bottom: .75rem;
  opacity: .5;
}

/* === Footer === */
.footer {
  margin-top: 3rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: .8rem;
  color: var(--text-muted);
}

.footer a { color: var(--accent); }

/* === Mentions légales === */
.mentions-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: .75rem;
}

.mentions-section h3 {
  font-size: .95rem;
  font-weight: 700;
  margin-bottom: .5rem;
  color: var(--text);
}

.mentions-section p {
  font-size: .85rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: .375rem;
}

.mentions-section p:last-child { margin-bottom: 0; }

/* === Responsive === */
@media (max-width: 768px) {
  .header .container {
    flex-wrap: wrap;
  }

  .search-bar {
    order: 3;
    max-width: 100%;
    flex-basis: 100%;
  }

  .hero-stats {
    flex-direction: column;
    text-align: center;
  }

  .hero-main h1 { font-size: 1.25rem; }

  .prix-cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .regions-grid {
    grid-template-columns: 1fr;
  }

  .station-autres-prix {
    display: none;
  }

  .stations-table thead th:last-child,
  .stations-table td:last-child {
    display: none;
  }

  .dept-row {
    flex-wrap: wrap;
  }

  .dept-stations {
    flex-basis: 100%;
    text-align: left;
    margin-top: .25rem;
  }
}

@media (max-width: 480px) {
  .prix-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .filtres-bar {
    gap: .375rem;
  }

  .filtre-carburant {
    padding: .25rem .625rem;
    font-size: .7rem;
  }
}
