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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#map {
  width: 100%;
  height: 100%;
}

#seo-title,
#seo-description {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

#seo-description a {
  color: inherit;
}

#stale-banner {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1002;
  background: #e74c3c;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  font-weight: 700;
  padding: 12px 24px;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  text-align: center;
  white-space: nowrap;
}

#stale-banner.hidden {
  display: none;
}

#fuel-selector {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  gap: 0;
  background: #fff;
  border-radius: 10px;
  padding: 3px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.fuel-btn {
  border: none;
  background: transparent;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #777;
  cursor: pointer;
  border-radius: 7px;
  transition: all 0.2s ease;
  line-height: 1;
}

.fuel-btn:hover {
  color: #333;
  background: #f0f0f0;
}

.fuel-btn.active {
  background: #333;
  color: #fff;
}

#bottom-right {
  position: absolute;
  bottom: 30px;
  right: 10px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  width: 120px;
}

#geolocate-btn {
  width: 100%;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

#geolocate-btn:hover {
  background: #f0f0f0;
}

#cp-input {
  width: 100%;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: #fff;
  padding: 0 10px;
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  text-align: center;
  outline: none;
}

#cp-input:focus {
  box-shadow: 0 2px 8px rgba(0,0,0,0.15), 0 0 0 2px #3b6cb5;
}

#cp-input.cp-error {
  box-shadow: 0 2px 8px rgba(0,0,0,0.15), 0 0 0 2px #e74c3c;
  animation: shake 0.3s;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

#bottom-left {
  position: absolute;
  bottom: 30px;
  left: 10px;
  z-index: 1000;
}

#info-bar {
  background: #fff;
  padding: 8px 12px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#info-logo {
  cursor: pointer;
  flex-shrink: 0;
}

#legend {
  display: flex;
  gap: 10px;
  font-size: 13px;
}

#info-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#info-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

#legend-sep {
  width: 1px;
  height: 16px;
  background: #ddd;
  flex-shrink: 0;
}

#station-count {
  font-size: 11px;
  color: #999;
  white-space: nowrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

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

.dot.cheap { background: #2ecc71; }
.dot.average { background: #f39c12; }
.dot.expensive { background: #e74c3c; }

.leaflet-control-zoom {
  border: none !important;
  border-radius: 10px !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
  overflow: hidden;
}

.leaflet-control-zoom a {
  border-bottom: 1px solid #eee !important;
}

#loading {
  position: absolute;
  top: 19px;
  right: 16px;
  z-index: 1001;
}

.pulse-dot {
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #2ecc71;
}

#loading.active .pulse-dot {
  animation: pulse 1.2s ease-in-out infinite;
}

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

.hidden {
  display: none !important;
}

/* Marker styles */
.fuel-marker {
  padding: 0 7px;
  height: 20px;
  border-radius: 20px;
  border: 1.5px solid rgba(255,255,255,0.9);
  box-shadow: 0 2px 8px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.06);
  display: block;
  text-align: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  line-height: 17px;
  white-space: nowrap;
  letter-spacing: -0.1px;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  font-variant-numeric: tabular-nums;
}

.fuel-marker:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 14px rgba(0,0,0,0.25), 0 0 0 1px rgba(0,0,0,0.08);
}

.fuel-marker.cheap { background: linear-gradient(135deg, #43d17a, #2ecc71); }
.fuel-marker.average { background: linear-gradient(135deg, #f5b041, #f39c12); }
.fuel-marker.expensive { background: linear-gradient(135deg, #ec6b56, #e74c3c); }
.fuel-marker.no-price { background: linear-gradient(135deg, #b0b8bf, #95a5a6); }
.fuel-marker.stale { background: linear-gradient(135deg, #b0b8bf, #95a5a6); }

.leaflet-popup-tip-container {
  display: none;
}

/* Popup */
.station-popup {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-width: 180px;
}

.popup-brand {
  font-size: 14px;
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 2px;
}

.popup-brand-unknown {
  font-weight: 400;
  font-style: italic;
  color: #95a5a6;
}

.popup-address {
  color: #555;
  font-size: 12px;
  line-height: 1.4;
  margin-bottom: 8px;
}

.popup-notice {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  margin-bottom: 6px;
  text-align: center;
}

.popup-notice.stale {
  color: #e74c3c;
  background: #fdf0ef;
}

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

.popup-fuel-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #f5f5f5;
}

.popup-fuel-row.popup-current {
  font-weight: 700;
  background: #eef7ee;
}

.popup-fuel-label {
  flex: 1;
  color: #555;
  white-space: nowrap;
}

.popup-fuel-warn {
  cursor: help;
  margin-right: 4px;
}

.popup-fuel-price {
  flex: 0 0 auto;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.popup-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  gap: 8px;
}

.popup-data-age {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 8px;
}

.popup-data-age.fresh {
  color: #2ecc71;
  background: #eafaf1;
}

.popup-data-age.warn {
  color: #e67e22;
  background: #fef5e7;
}

.popup-data-age.stale {
  color: #e74c3c;
  background: #fdf0ef;
}

.popup-automate {
  margin-left: auto;
}

.badge-247 {
  display: inline-flex;
  border-radius: 6px;
  overflow: hidden;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.badge-247-left {
  background: #3b6cb5;
  color: #fff;
  padding: 3px 4px 3px 6px;
}

.badge-247-right {
  background: #e8505b;
  color: #fff;
  padding: 3px 6px 3px 3px;
}

/* About overlay */
#about-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

#about-overlay.hidden {
  display: none;
}

#about-panel {
  background: #fff;
  border-radius: 12px;
  padding: 32px;
  max-width: 480px;
  width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

#about-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #999;
  line-height: 1;
}

#about-close:hover {
  color: #333;
}

.about-logo {
  display: block;
  margin: 0 auto 12px;
}

#about-panel h2 {
  text-align: center;
  margin: 0 0 4px;
  font-size: 22px;
  color: #2c3e50;
}

.about-subtitle {
  text-align: center;
  color: #888;
  margin: 0 0 20px;
  font-size: 14px;
}

.about-section {
  margin-bottom: 16px;
}

.about-section h3 {
  font-size: 14px;
  color: #2c3e50;
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.about-section ol,
.about-section ul {
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
  line-height: 1.6;
  color: #555;
}

.about-section p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: #555;
}

.about-note {
  margin-top: 8px;
  padding: 8px 10px;
  background: #fef5e7;
  border-left: 3px solid #f39c12;
  border-radius: 4px;
  font-size: 12px;
  color: #7d6608;
}

.about-section a {
  color: #3b6cb5;
  text-decoration: none;
}

.about-section a:hover {
  text-decoration: underline;
}

/* Small screens */
@media (max-width: 600px) {
  #fuel-selector {
    top: 6px;
    padding: 2px;
    border-radius: 16px;
  }

  .fuel-btn {
    padding: 5px 8px;
    font-size: 11px;
  }

  .leaflet-top.leaflet-left {
    top: 40px;
  }

  #loading {
    top: 12px;
    right: 10px;
  }

  #bottom-left {
    bottom: 50px;
    left: 6px;
  }

  #info-bar {
    padding: 4px 8px;
    gap: 4px;
  }

  #info-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  #legend {
    gap: 8px;
    font-size: 11px;
  }

  #legend-sep {
    display: none;
  }

  #station-count {
    font-size: 10px;
  }

  #bottom-right {
    bottom: 10px;
    right: 6px;
    flex-direction: row;
    width: auto;
    gap: 6px;
  }

  #geolocate-btn {
    width: 36px;
    height: 36px;
  }

  #cp-input {
    width: 100px;
    height: 36px;
    font-size: 13px;
    padding: 0 6px;
  }

  #cp-input::placeholder {
    font-size: 11px;
  }

  #about-panel {
    padding: 20px;
    max-height: 80vh;
  }
}
