/* ===== CSS Variables ===== */
:root {
  --bg: #f0f2f5;
  --surface: #ffffff;
  --surface2: #e8ecf2;
  --border: #c8d0dc;
  --accent: #1769a3;
  --accent2: #1e429f;
  --text: #111827;
  --muted: #6b7280;
  --green: #059669;
  --red: #dc2626;
}

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

body {
  font-family: 'Space Grotesk', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 20% 20%, rgba(245,166,35,0.07) 0%, transparent 60%),
    radial-gradient(ellipse 50% 60% at 80% 80%, rgba(232,82,42,0.06) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ===== Layout ===== */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  position: relative;
  z-index: 1;
}

.container--narrow {
  max-width: 720px;
}

/* ===== Header ===== */
header {
  text-align: center;
  margin-bottom: 1.25rem;
  animation: fadeDown 0.6s ease both;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.logo-icon {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 0 30px rgba(245,166,35,0.3);
}

h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

h1 span {
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle { color: var(--muted); font-size: 1rem; margin-top: 0.75rem; font-weight: 400; }

/* ===== Back link (subpages) ===== */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 2rem;
  transition: color 0.2s;
}
.back-link:hover { color: var(--accent); }

/* ===== Card ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.section h2 {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.6rem;
}

.section p {
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--text);
}

.section p + p { margin-top: 0.5rem; }
.section a { color: var(--accent); text-decoration: none; }
.section a:hover { text-decoration: underline; }
.divider { height: 1px; background: var(--border); }

/* ===== Search card ===== */
.search-card { animation: fadeUp 0.6s 0.2s ease both; position: relative; z-index: 100; }

.field { display: flex; flex-direction: column; gap: 0.5rem; }
label { font-size: 0.8rem; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }

input, select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  width: 100%;
}

input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26,86,219,0.12);
}

select option { background: var(--surface2); }

.api-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
  align-items: end;
}

/* ===== Buttons ===== */
.btn {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  border-radius: 10px;
  padding: 0.75rem 1.5rem;
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(26,86,219,0.2);
}
.btn:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 6px 24px rgba(26,86,219,0.3); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-secondary {
  background: var(--surface2);
  border: 1px solid var(--border);
  box-shadow: none;
  color: var(--text);
}
.btn-secondary:hover { background: var(--border); box-shadow: none; }

/* ===== Location row ===== */
.location-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.location-status {
  font-size: 0.85rem; color: var(--muted);
  display: flex; align-items: center; gap: 0.4rem;
}

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.active { background: var(--green); box-shadow: 0 0 6px var(--green); }

/* ===== OR divider ===== */
.or-divider {
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 1.25rem;
  color: var(--muted); font-size: 0.8rem;
  text-transform: uppercase; letter-spacing: 0.1em;
}
.or-divider::before, .or-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ===== Address search ===== */
.address-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
  align-items: end;
}

@media (max-width: 600px) {
  .address-row { grid-template-columns: 1fr; }
  .api-row { grid-template-columns: 1fr; }
}

.autocomplete-wrapper { position: relative; }
.input-with-icon input { padding-right: 2.75rem; }

.gps-icon-btn {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
  z-index: 1;
}
.gps-icon-btn:hover { color: var(--accent); background: rgba(26,86,219,0.08); }
.gps-icon-btn.active { color: var(--green); }

.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px); left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  z-index: 9000;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}

.autocomplete-item {
  padding: 0.7rem 1rem;
  cursor: pointer;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  display: flex; align-items: flex-start; gap: 0.6rem;
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover, .autocomplete-item.highlighted { background: rgba(245,166,35,0.1); }
.autocomplete-item .ac-icon { color: var(--accent); flex-shrink: 0; }
.autocomplete-item .ac-text { font-size: 0.88rem; }

/* ===== Input group ===== */
.input-group {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 1rem;
  align-items: end;
}
@media (max-width: 600px) {
  .input-group { grid-template-columns: 1fr auto; }
  .input-group .btn { grid-column: auto; }
}

/* ===== Results ===== */
.results-header {
  display: flex; align-items: center; justify-content: flex-end;
  margin-bottom: 1.25rem;
  animation: fadeUp 0.4s ease both;
}
.results-header h3 {
  font-size: 0.8rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.1em;
}

.sort-btns { display: flex; gap: 0.4rem; }
.sort-btn {
  padding: 0.3rem 0.75rem; border-radius: 6px;
  border: 1px solid var(--border); background: transparent;
  color: var(--muted); font-family: inherit;
  font-size: 0.78rem; font-weight: 500; cursor: pointer;
  transition: all 0.2s;
}
.sort-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.sort-btn:hover:not(.active) { border-color: var(--accent); color: var(--text); }

.fuel-tabs { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; animation: fadeUp 0.4s 0.05s ease both; }
.tab {
  padding: 0.5rem 1.25rem; border-radius: 8px;
  border: 1px solid var(--border); background: transparent;
  color: var(--muted); font-family: inherit;
  font-size: 0.85rem; font-weight: 500; cursor: pointer;
  transition: all 0.2s;
}
.tab.active { background: var(--accent); border-color: var(--accent); color: #000; font-weight: 700; }
.tab:hover:not(.active) { border-color: var(--accent); color: var(--text); }

/* ===== Station cards ===== */
.stations-grid { display: flex; flex-direction: column; gap: 0.75rem; }

.station-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: center;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  animation: fadeUp 0.4s ease both;
}

.station-info-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}
.station-info-header h4 { font-size: 1rem; font-weight: 600; }

.station-card:hover {
  border-color: rgba(26,86,219,0.3);
  transform: translateX(4px);
  box-shadow: -4px 0 20px rgba(26,86,219,0.08);
}

.station-card.cheapest {
  border-color: rgba(5,150,105,0.4);
  background: linear-gradient(135deg, rgba(5,150,105,0.05), var(--surface));
}

.station-dist {
  font-family: 'DM Mono', monospace;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.station-meta { font-size: 0.82rem; color: var(--muted); display: flex; flex-direction: column; gap: 0.2rem; flex-wrap: wrap; }

.price-badge { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; min-width: 70px; }

.price-value {
  font-family: 'DM Mono', monospace;
  font-size: 1.75rem; font-weight: 500; line-height: 1; letter-spacing: -0.02em;
}
.price-value .cents { font-size: 1rem; vertical-align: super; font-weight: 400; }
.price-value .cent-last { font-size: 0.7rem; vertical-align: super; font-weight: 400; line-height: 0; position: relative; top: -0.3em; }
.price-label { font-size: 0.75rem; color: var(--muted); margin-top: 0.3rem; text-align: right; }

/* ===== Badges ===== */
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 0.2rem 0.5rem; border-radius: 5px; margin-left: 0.5rem;
}
.badge-green { background: rgba(34,197,94,0.15); color: var(--green); }
.badge-open { background: rgba(34,197,94,0.1); color: var(--green); }
.badge-closed { background: rgba(239,68,68,0.1); color: var(--red); }

/* ===== Avg row ===== */
.avg-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 1rem; margin-bottom: 2rem; animation: fadeUp 0.4s 0.1s ease both; }
.avg-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1rem 1.25rem; text-align: center; }
.avg-card .fuel-name { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.4rem; }
.avg-card .avg-price { font-family: 'DM Mono', monospace; font-size: 1.4rem; font-weight: 600; color: var(--accent); }

/* ===== Loading & messages ===== */
.loading { text-align: center; padding: 3rem; color: var(--muted); }
.spinner { width: 40px; height: 40px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 1rem; }

.message { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem; text-align: center; color: var(--muted); font-size: 0.95rem; }
.message.error { border-color: rgba(239,68,68,0.3); color: var(--red); background: rgba(239,68,68,0.05); }
.message.info { border-color: rgba(245,166,35,0.2); }

/* ===== Mobile station card ===== */
@media (max-width: 600px) {
  .station-card {
    grid-template-columns: auto 1fr auto;
    padding: 1rem;
    gap: 0.75rem;
  }
}

/* ===== Action buttons ===== */
.station-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.6rem;
  flex-wrap: wrap;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.action-btn:hover {
  background: rgba(26,86,219,0.08);
  border-color: rgba(26,86,219,0.3);
  color: var(--accent);
  transform: translateY(-1px);
}

/* ===== Utility ===== */
.hidden { display: none !important; }

/* ===== Brand section ===== */
.brand-section { margin-top: 2rem; }
.brand-section-title {
  font-size: 0.75rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.75rem;
}
.brand-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.brand-chip {
  display: inline-flex; align-items: center;
  padding: 0.4rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem; font-weight: 500;
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s, background 0.2s, transform 0.15s;
}
.brand-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(26,86,219,0.05);
  transform: translateY(-1px);
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  backdrop-filter: blur(2px);
}
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%; max-width: 420px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.15);
  animation: fadeUp 0.25s ease both;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 1.1rem; font-weight: 600; }
.modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 1.4rem; color: var(--muted); line-height: 1;
  padding: 0.1rem 0.3rem; border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}
.modal-close:hover { color: var(--text); background: var(--surface2); }
.modal-body {
  padding: 1.5rem;
  display: flex; flex-direction: column; gap: 0.85rem;
  font-size: 0.92rem; line-height: 1.6; color: var(--text);
}
.modal-body a { color: var(--accent); text-decoration: none; }
.modal-body a:hover { text-decoration: underline; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: var(--text);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.75rem 1.25rem;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  white-space: nowrap;
  z-index: 9999;
  transition: opacity 0.3s, transform 0.3s;
}
.toast.hidden { display: none; }
.toast.fade-out { opacity: 0; transform: translateX(-50%) translateY(8px); }

/* ===== Legal note ===== */
.legal-note {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.6;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

/* ===== Footer ===== */
footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
footer a { color: var(--accent); text-decoration: none; }

/* ===== Info section ===== */
.info-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.75rem 2rem;
  margin-top: 2rem;
}
.info-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.75rem;
  margin-top: 1.5rem;
}
.info-section-title:first-child { margin-top: 0; }
.info-section-text {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 0.6rem;
}

/* ===== City list ===== */
.city-list-styled {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding: 0;
}
.city-list-styled li {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.3rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  cursor: pointer;
}
.city-list-styled li:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(26,86,219,0.05);
}

/* ===== Animations ===== */
@keyframes fadeDown { from { opacity:0; transform:translateY(-20px); } to { opacity:1; transform:translateY(0); } }
@keyframes fadeUp { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Contact form ===== */
.contact-info-row {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}
.contact-info-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.contact-info-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}
.contact-info-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.15rem;
}
.contact-info-value {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}
.contact-info-value:hover { text-decoration: underline; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
}

textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  width: 100%;
  resize: vertical;
  min-height: 140px;
}
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26,86,219,0.12);
}

.input-error {
  border-color: var(--red) !important;
  box-shadow: 0 0 0 3px rgba(220,38,38,0.1) !important;
}

.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}
.form-hint {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
  flex: 1;
  min-width: 200px;
}

.success-msg {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.5rem 0;
}
.success-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(5,150,105,0.12);
  color: var(--green);
  font-size: 1.2rem;
  font-weight: 700;
  flex-shrink: 0;
}
.success-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.3rem;
}
.success-text {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.6;
}
