/* ========================================
   Combustível.net — Dark Theme Fuel Tracker
   ======================================== */

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #111118;
  --bg-card: rgba(20, 20, 30, 0.7);
  --bg-card-solid: #14141e;
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-accent: rgba(0, 229, 160, 0.2);

  --text-primary: #f0f0f5;
  --text-secondary: #8a8a9a;
  --text-muted: #55556a;

  --accent: #00e5a0;
  --accent-dim: rgba(0, 229, 160, 0.15);
  --accent-glow: rgba(0, 229, 160, 0.3);

  --brand-galp: #ff6600;
  --brand-bp: #009900;
  --brand-repsol: #ff4400;
  --brand-prio: #e60000;
  --brand-intermarche: #cc0033;
  --brand-auchan: #e30613;
  --brand-moeve: #0066cc;
  --brand-alves: #1a5276;
  --brand-recheio: #ff9900;
  --brand-nova: #6633cc;
  --brand-generic: #666680;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-glow: 0 0 30px rgba(0, 229, 160, 0.1);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.2s;
}
a:hover { opacity: 0.8; }

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

/* ========================================
   HEADER
   ======================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}

.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 36px;
  height: 50px;
  flex-shrink: 0;
}

.fuel-drop {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 8px rgba(0, 229, 160, 0.4));
}

.pulse-line {
  animation: pulseLine 2s ease-in-out infinite;
}

@keyframes pulseLine {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.net-badge {
  display: inline-block;
  background: var(--accent);
  color: var(--bg-primary);
  font-size: 0.7em;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 2px;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

.tagline {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 400;
  margin-top: 1px;
}

.update-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: var(--accent-dim);
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-accent);
  white-space: nowrap;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* ========================================
   MAP SECTION
   ======================================== */

.map-section {
  position: relative;
  height: 55vh;
  min-height: 350px;
  max-height: 600px;
}

.map-container {
  width: 100%;
  height: 100%;
}

/* Leaflet dark theme overrides */
.leaflet-tile-pane {
  filter: brightness(0.7) contrast(1.1) saturate(0.3) hue-rotate(180deg) invert(1);
}

.leaflet-control-zoom a {
  background: var(--bg-card-solid) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-subtle) !important;
}

.leaflet-control-attribution {
  background: rgba(10, 10, 15, 0.8) !important;
  color: var(--text-muted) !important;
  font-size: 10px !important;
}
.leaflet-control-attribution a {
  color: var(--text-secondary) !important;
}

.map-overlay-info {
  position: absolute;
  bottom: 20px;
  left: 20px;
  z-index: 800;
  display: flex;
  gap: 8px;
}

.stat-pill {
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-number {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent);
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Custom markers */
.station-marker {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  transition: transform 0.2s;
}
.station-marker:hover {
  transform: scale(1.2);
}

.best-price-marker {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 0 20px rgba(0, 229, 160, 0.5);
  animation: bestPulse 2s ease-in-out infinite;
  position: relative;
}

.best-price-marker::after {
  content: '★';
  position: absolute;
  top: -8px;
  right: -4px;
  font-size: 12px;
  color: var(--accent);
  filter: drop-shadow(0 0 3px rgba(0, 229, 160, 0.6));
}

@keyframes bestPulse {
  0%, 100% { box-shadow: 0 0 10px rgba(0, 229, 160, 0.3); }
  50% { box-shadow: 0 0 25px rgba(0, 229, 160, 0.6); }
}

/* Leaflet popup dark theme */
.leaflet-popup-content-wrapper {
  background: var(--bg-card-solid) !important;
  color: var(--text-primary) !important;
  border-radius: var(--radius-md) !important;
  border: 1px solid var(--border-subtle) !important;
  box-shadow: var(--shadow-card) !important;
}
.leaflet-popup-tip {
  background: var(--bg-card-solid) !important;
}
.leaflet-popup-close-button {
  color: var(--text-secondary) !important;
}
.leaflet-popup-content {
  margin: 12px 16px !important;
  font-family: var(--font) !important;
  font-size: 13px !important;
  line-height: 1.5 !important;
}

.popup-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.popup-brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.popup-address {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.popup-prices {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.popup-price-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 2px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.popup-price-row:last-child { border-bottom: none; }

.popup-fuel-name {
  color: var(--text-secondary);
}

.popup-fuel-price {
  font-weight: 600;
  color: var(--accent);
}

.popup-distance {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

/* ========================================
   BEST PRICES SECTION
   ======================================== */

.best-prices-section {
  padding: 40px 0 24px;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  letter-spacing: -0.01em;
}

.best-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.best-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s;
}

.best-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-accent);
}

.best-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
}

.best-card-fuel {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.best-card-price {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.best-card-price small {
  font-size: 0.55em;
  font-weight: 500;
  color: var(--text-secondary);
}

.best-card-station {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--text-primary);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.best-card-brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.best-card-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ========================================
   RANKING SECTION
   ======================================== */

.ranking-section {
  padding: 16px 0 48px;
}

.fuel-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-subtle) transparent;
  -webkit-overflow-scrolling: touch;
}

.fuel-tabs::-webkit-scrollbar {
  height: 4px;
}
.fuel-tabs::-webkit-scrollbar-track {
  background: transparent;
}
.fuel-tabs::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 2px;
}

.fuel-tab {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.fuel-tab:hover {
  border-color: var(--border-accent);
  color: var(--text-primary);
}

.fuel-tab.active {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
  font-weight: 600;
}

.ranking-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.ranking-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.ranking-table thead {
  background: rgba(255, 255, 255, 0.03);
}

.ranking-table th {
  padding: 12px 16px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.ranking-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.ranking-table tbody tr:last-child td {
  border-bottom: none;
}

.ranking-table tbody tr {
  transition: background 0.15s;
}

.ranking-table tbody tr:hover {
  background: rgba(0, 229, 160, 0.04);
}

.ranking-table tbody tr.best-row {
  background: rgba(0, 229, 160, 0.08);
}

.rank-col { width: 50px; text-align: center; }
.price-col { width: 100px; text-align: right; }
.dist-col { width: 90px; text-align: right; white-space: nowrap; }

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.75rem;
}

.rank-1 { background: var(--accent); color: var(--bg-primary); }
.rank-2 { background: rgba(0, 229, 160, 0.3); color: var(--text-primary); }
.rank-3 { background: rgba(0, 229, 160, 0.15); color: var(--text-primary); }
.rank-default { color: var(--text-muted); }

.station-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.station-brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.station-details {
  display: flex;
  flex-direction: column;
}

.station-name {
  font-weight: 600;
  font-size: 0.85rem;
  line-height: 1.3;
}

.station-brand-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
}

.price-value {
  font-weight: 700;
  color: var(--accent);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dist-value {
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ========================================
   SHARE SECTION
   ======================================== */

.share-section {
  padding: 0 0 40px;
  text-align: center;
}

.whatsapp-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  border-radius: 28px;
  border: none;
  background: #25D366;
  color: #fff;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(37, 211, 102, 0.3);
}

.whatsapp-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(37, 211, 102, 0.4);
}

/* ========================================
   FOOTER
   ======================================== */

.site-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 32px 0;
  background: var(--bg-secondary);
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
}

.footer-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.footer-update {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.footer-source a {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.footer-source a:hover { color: var(--accent); }

.footer-attr {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.footer-attr:hover { color: var(--accent); }

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.best-card {
  animation: fadeInUp 0.5s ease-out both;
}

.best-card:nth-child(1) { animation-delay: 0.05s; }
.best-card:nth-child(2) { animation-delay: 0.1s; }
.best-card:nth-child(3) { animation-delay: 0.15s; }
.best-card:nth-child(4) { animation-delay: 0.2s; }
.best-card:nth-child(5) { animation-delay: 0.25s; }
.best-card:nth-child(6) { animation-delay: 0.3s; }

.ranking-table tbody tr {
  animation: fadeInUp 0.3s ease-out both;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
  .map-section {
    height: 45vh;
    min-height: 280px;
  }

  .header-inner {
    padding: 10px 16px;
  }

  .logo-icon {
    width: 28px;
    height: 40px;
  }

  .brand-name {
    font-size: 1.05rem;
  }

  .tagline {
    display: none;
  }

  .update-badge {
    font-size: 0.65rem;
    padding: 3px 8px;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .best-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .best-card {
    padding: 12px 14px;
  }

  .best-card-price {
    font-size: 1.3rem;
  }

  .section-title {
    font-size: 1rem;
  }

  .ranking-table th,
  .ranking-table td {
    padding: 10px 8px;
  }

  .ranking-table th:first-child,
  .ranking-table td:first-child {
    padding-left: 8px;
  }

  .price-value {
    font-size: 0.85rem;
  }

  .dist-value {
    font-size: 0.75rem;
  }

  .rank-col { width: 40px; }
  .price-col { width: 75px; }
  .dist-col { width: 65px; }

  .station-name {
    font-size: 0.78rem;
  }

  .footer-grid {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .container {
    padding: 0 16px;
  }

  .best-prices-section {
    padding: 28px 0 16px;
  }

  .ranking-section {
    padding: 12px 0 36px;
  }
}

@media (max-width: 420px) {
  .best-cards {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .best-card {
    padding: 10px 12px;
  }

  .best-card-price {
    font-size: 1.15rem;
  }

  .best-card-station {
    font-size: 0.72rem;
  }

  .fuel-tab {
    padding: 6px 12px;
    font-size: 0.72rem;
  }
}
