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

:root {
  --amber-50: #FFFBEB;
  --amber-100: #FEF3C7;
  --amber-200: #FDE68A;
  --amber-300: #FCD34D;
  --amber-400: #FBBF24;
  --amber-500: #F59E0B;
  --amber-600: #D97706;
  --amber-700: #B45309;
  --amber-800: #92400E;
  --amber-900: #78350F;

  --green-500: #059669;
  --green-600: #047857;
  --red-500: #DC2626;
  --red-600: #B91C1C;

  --stone-50: #FAFAF9;
  --stone-100: #F5F5F4;
  --stone-200: #E7E5E4;
  --stone-300: #D6D3D1;
  --stone-500: #78716C;
  --stone-700: #44403C;
  --stone-800: #292524;
  --stone-900: #1C1917;

  --white: #FFFFFF;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.12);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 200ms ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--amber-50);
  color: var(--stone-900);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== TICKER TAPE ===== */
.ticker-bar {
  background: var(--stone-900);
  color: var(--amber-300);
  font-size: 0.8rem;
  font-weight: 500;
  overflow: hidden;
  white-space: nowrap;
  height: 32px;
  display: flex;
  align-items: center;
  position: relative;
  z-index: 100;
}

.ticker-track {
  display: inline-flex;
  gap: 3rem;
  animation: ticker-scroll 40s linear infinite;
  padding-left: 100%;
}

.ticker-track:hover { animation-play-state: paused; }

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.ticker-item .label { color: var(--stone-500); }
.ticker-item .price { color: var(--amber-300); font-weight: 600; }
.ticker-item .change { font-size: 0.75rem; }
.ticker-item .change.up { color: #4ade80; }
.ticker-item .change.down { color: #f87171; }
.ticker-item .divider { color: var(--stone-700); margin: 0 0.5rem; }
.ticker-loading { color: var(--stone-500); padding-left: 1rem; }

@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ===== HEADER ===== */
.header {
  background: var(--white);
  border-bottom: 1px solid var(--amber-100);
  padding: 0.75rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--stone-900);
}

.logo-icon { font-size: 1.5rem; }
.logo-text { font-size: 1.25rem; font-weight: 700; }
.logo-dot { color: var(--amber-500); }

.tagline {
  font-size: 0.85rem;
  color: var(--stone-500);
  font-weight: 400;
}

/* ===== HERO ===== */
.hero {
  background: linear-gradient(135deg, var(--amber-500), var(--amber-600));
  padding: 2.5rem 1.5rem 2rem;
  text-align: center;
  color: var(--white);
}

.hero-inner { max-width: 700px; margin: 0 auto; }

.hero h1 {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 700;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.highlight { color: var(--amber-100); }

.hero-sub {
  font-size: 1rem;
  opacity: 0.9;
  margin-bottom: 1.5rem;
}

/* ===== SEARCH ===== */
.search-container { position: relative; max-width: 600px; margin: 0 auto; }

.search-box {
  display: flex;
  align-items: center;
  background: var(--white);
  border-radius: 50px;
  padding: 0.35rem 0.35rem 0.35rem 1rem;
  box-shadow: var(--shadow-lg);
  gap: 0.5rem;
}

.search-icon {
  width: 20px;
  height: 20px;
  color: var(--stone-500);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  font-family: inherit;
  background: transparent;
  color: var(--stone-900);
  min-width: 0;
}

.search-input::placeholder { color: var(--stone-300); }

.search-btn {
  background: var(--amber-500);
  color: var(--white);
  border: none;
  border-radius: 50px;
  padding: 0.65rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition);
  flex-shrink: 0;
}

.search-btn:hover { background: var(--amber-600); }

.locate-btn {
  background: var(--amber-100);
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--amber-700);
  transition: background var(--transition);
  flex-shrink: 0;
}

.locate-btn:hover { background: var(--amber-200); }

.search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  list-style: none;
  max-height: 300px;
  overflow-y: auto;
  z-index: 50;
}

.search-results li {
  padding: 0.75rem 1rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--stone-700);
  border-bottom: 1px solid var(--stone-100);
  transition: background var(--transition);
}

.search-results li:last-child { border-bottom: none; }
.search-results li:hover, .search-results li.active { background: var(--amber-50); color: var(--amber-800); }

/* ===== MAIN LAYOUT ===== */
.main-content {
  flex: 1;
  display: grid;
  grid-template-columns: 360px 1fr;
  min-height: 500px;
}

/* ===== SIDEBAR ===== */
.sidebar {
  background: var(--white);
  border-right: 1px solid var(--stone-200);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid var(--stone-100);
}

.sidebar-header h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--stone-800);
  margin-bottom: 0.5rem;
}

.sort-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--stone-500);
}

.fuel-select {
  font-family: inherit;
  font-size: 0.8rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--stone-200);
  border-radius: var(--radius-sm);
  background: var(--stone-50);
  color: var(--stone-700);
  cursor: pointer;
}

.station-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 200px;
  color: var(--stone-500);
  text-align: center;
  padding: 2rem;
  gap: 1rem;
}

.empty-state p { font-size: 0.9rem; }

/* Station Card */
.station-card {
  background: var(--stone-50);
  border: 1px solid var(--stone-200);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: all var(--transition);
}

.station-card:hover {
  border-color: var(--amber-300);
  box-shadow: var(--shadow-sm);
  background: var(--amber-50);
}

.station-card.active {
  border-color: var(--amber-500);
  background: var(--amber-50);
}

.station-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--stone-800);
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.station-address {
  font-size: 0.78rem;
  color: var(--stone-500);
  margin-bottom: 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.station-prices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.price-tag {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: var(--amber-100);
  color: var(--amber-800);
}

.price-tag.cheapest { background: #D1FAE5; color: var(--green-600); }
.price-tag.expensive { background: #FEE2E2; color: var(--red-600); }

.station-distance {
  font-size: 0.75rem;
  color: var(--stone-500);
  margin-top: 0.4rem;
}

.station-updated {
  font-size: 0.7rem;
  color: var(--stone-500);
  margin-top: 0.2rem;
  font-style: italic;
}

/* ===== MAP ===== */
.map-wrapper {
  position: relative;
  overflow: hidden;
}

.map {
  width: 100%;
  height: 100%;
  min-height: 500px;
}

.map-loading {
  position: absolute;
  inset: 0;
  background: var(--amber-50);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  z-index: 10;
  transition: opacity 0.3s ease;
}

.map-loading.hidden { opacity: 0; pointer-events: none; }

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--amber-200);
  border-top-color: var(--amber-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Map Popups */
.popup-content {
  font-family: 'Inter', sans-serif;
  padding: 0.25rem;
  min-width: 200px;
}

.popup-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--stone-900);
  margin-bottom: 0.25rem;
}

.popup-address {
  font-size: 0.78rem;
  color: var(--stone-500);
  margin-bottom: 0.5rem;
}

.popup-prices { margin: 0; padding: 0; list-style: none; }

.popup-prices li {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  padding: 0.2rem 0;
  border-bottom: 1px solid var(--stone-100);
}

.popup-prices li:last-child { border-bottom: none; }

.popup-fuel-type { color: var(--stone-700); }
.popup-fuel-price { font-weight: 600; color: var(--amber-700); }
.popup-no-prices { font-size: 0.8rem; color: var(--stone-500); font-style: italic; }

/* ===== AD BANNER ===== */
.ad-banner {
  background: var(--stone-100);
  border-top: 1px solid var(--stone-200);
  padding: 0.75rem 1rem;
  text-align: center;
}

.ad-container { max-width: 728px; margin: 0 auto; }

.ad-placeholder {
  background: var(--stone-200);
  color: var(--stone-500);
  font-size: 0.75rem;
  padding: 1.5rem;
  border-radius: var(--radius-sm);
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== FOOTER ===== */
.footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.78rem;
  color: var(--stone-500);
  background: var(--white);
  border-top: 1px solid var(--stone-100);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .main-content {
    grid-template-columns: 1fr;
    grid-template-rows: 350px 1fr;
  }

  .sidebar {
    order: 2;
    border-right: none;
    border-top: 1px solid var(--stone-200);
    max-height: 50vh;
  }

  .map-wrapper { order: 1; }
  .map { min-height: 350px; }
}

@media (max-width: 600px) {
  .hero { padding: 1.5rem 1rem; }
  .hero h1 { font-size: 1.35rem; }
  .search-btn { padding: 0.55rem 1rem; font-size: 0.85rem; }
  .header { padding: 0.5rem 1rem; }
  .tagline { display: none; }

  .main-content {
    grid-template-rows: 280px 1fr;
  }
}

/* ===== SCROLLBAR ===== */
.station-list::-webkit-scrollbar,
.search-results::-webkit-scrollbar {
  width: 6px;
}

.station-list::-webkit-scrollbar-track,
.search-results::-webkit-scrollbar-track {
  background: transparent;
}

.station-list::-webkit-scrollbar-thumb,
.search-results::-webkit-scrollbar-thumb {
  background: var(--stone-300);
  border-radius: 3px;
}
