/* ── Custom styles for PrezzoGasolioVicino ───────────────────────────────── */

/* ── Root / tokens ────────────────────────────────────────────────────────── */
:root {
  --brand:   #f97316;
  --accent:  #06b6d4;
  --surface: #0a0a0f;
  --card:    #141420;
  --card-2:  #1a1a28;
  --border:  #252535;
  --border-2:#2e2e42;
  --text:    #e2e8f0;
  --muted:   #64748b;
  --muted-2: #475569;
}

/* ── Global ───────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { background-color: var(--surface); color: var(--text); }

/* ── SVG Icon system ──────────────────────────────────────────────────────── */
.pgv-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
  flex-shrink: 0;
}
.pgv-icon-sm  { width: 0.75rem;  height: 0.75rem; }
.pgv-icon-md  { width: 1rem;     height: 1rem; }
.pgv-icon-lg  { width: 1.25rem;  height: 1.25rem; }
.pgv-icon-xl  { width: 1.5rem;   height: 1.5rem; }

/* ── Utility classes ──────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1.1rem;
  border-radius: 0.625rem;
  background-color: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 0.875rem;
  transition: background-color 0.15s, transform 0.1s;
  cursor: pointer;
  border: none;
  line-height: 1.5;
}
.btn-primary:hover  { background-color: #fb923c; }
.btn-primary:active { transform: scale(0.97); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1.1rem;
  border-radius: 0.625rem;
  background-color: transparent;
  border: 1px solid var(--border-2);
  color: #94a3b8;
  font-weight: 600;
  font-size: 0.875rem;
  transition: border-color 0.15s, color 0.15s, transform 0.1s;
  cursor: pointer;
  line-height: 1.5;
}
.btn-secondary:hover  { border-color: var(--brand); color: var(--brand); }
.btn-secondary:active { transform: scale(0.97); }

/* ── Scrollbar utilities ─────────────────────────────────────────────────── */
.scrollbar-none { scrollbar-width: none; }
.scrollbar-none::-webkit-scrollbar { display: none; }

/* ── Fuel type toggle ─────────────────────────────────────────────────────── */
.fuel-toggle-btn {
  cursor: pointer;
  border: none;
  white-space: nowrap;
  line-height: 1.4;
}
.fuel-toggle-btn--active {
  background-color: var(--brand);
  color: #fff;
  box-shadow: 0 1px 6px rgba(249,115,22,0.35);
}
.fuel-toggle-btn--inactive {
  background-color: transparent;
  color: #64748b;
}
.fuel-toggle-btn--inactive:hover {
  color: #cbd5e1;
  background-color: rgba(255,255,255,0.04);
}
.fuel-toggle-btn:active { transform: scale(0.97); }

.input-field {
  padding: 0.5rem 0.875rem;
  border-radius: 0.625rem;
  background-color: var(--card);
  border: 1px solid var(--border-2);
  color: var(--text);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s;
}
.input-field:focus { border-color: var(--brand); }
.input-field::placeholder { color: var(--muted); }

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  border-radius: 9999px;
  background-color: var(--card);
  border: 1px solid var(--border);
  font-size: 0.7rem;
}

.dot {
  display: inline-block;
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 9999px;
  flex-shrink: 0;
}

/* ── Sort buttons ─────────────────────────────────────────────────────────── */
.sort-btn {
  padding: 0.2rem 0.65rem;
  border-radius: 9999px;
  background-color: transparent;
  border: 1px solid var(--border-2);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.sort-btn:hover, .sort-btn.active {
  background-color: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

/* ── Station ranking card ─────────────────────────────────────────────────── */
.station-card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.875rem;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  cursor: pointer;
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.12s;
  position: relative;
  overflow: hidden;
}
.station-card:hover {
  border-color: rgba(249,115,22,0.5);
  box-shadow: 0 4px 24px rgba(0,0,0,0.3), 0 0 0 1px rgba(249,115,22,0.2);
  transform: translateY(-1px);
}
.station-card:active { transform: scale(0.99); }

.station-card .rank-badge {
  position: absolute;
  top: 0.625rem;
  right: 0.625rem;
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 9999px;
  background-color: rgba(249,115,22,0.15);
  color: var(--brand);
  font-size: 0.6rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(249,115,22,0.25);
}

.station-card .price-tag {
  font-size: 1.375rem;
  font-weight: 800;
  line-height: 1;
  color: #f8fafc;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.station-card .price-tag.cheap     { color: #34d399; }
.station-card .price-tag.average   { color: #fbbf24; }
.station-card .price-tag.expensive { color: #f87171; }

/* ── Brand badge ──────────────────────────────────────────────────────────── */
.brand-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.45rem;
  border-radius: 0.3rem;
  background-color: rgba(255,255,255,0.05);
  border: 1px solid var(--border-2);
  font-size: 0.6rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brand-badge--colored {
  border-width: 1px;
}

/* ── Savings label ────────────────────────────────────────────────────────── */
.savings-label {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 0.3rem;
}
.savings-label--good { color: #34d399; background: rgba(52,211,153,0.08); }
.savings-label--bad  { color: #f87171; background: rgba(248,113,113,0.08); }

/* ── Nav buttons ─────────────────────────────────────────────────────────── */
.station-card .nav-btns {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  margin-top: 0.125rem;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.28rem 0.55rem;
  border-radius: 0.4rem;
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.12s, border-color 0.12s;
  border: 1px solid var(--border-2);
  color: #94a3b8;
  background: transparent;
}
.nav-btn:hover { background-color: rgba(255,255,255,0.05); }
.nav-btn--google { border-color: rgba(66,133,244,0.4); color: #93c5fd; }
.nav-btn--apple  { border-color: rgba(180,180,180,0.3); color: #d1d5db; }
.nav-btn--waze   { border-color: rgba(51,204,255,0.35); color: #67e8f9; }
.nav-btn--fav-active { border-color: rgba(251,191,36,0.4); color: #fbbf24; }

/* ── Smart recommendation card ───────────────────────────────────────────── */
.smart-card {
  background-color: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  cursor: pointer;
  transition: border-color 0.18s, transform 0.12s, box-shadow 0.18s;
  position: relative;
  overflow: hidden;
}
.smart-card:hover {
  border-color: rgba(6,182,212,0.4);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}

.smart-card .sc-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.1rem;
}
.smart-card .sc-icon-wrap {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 0.375rem;
  background-color: rgba(6,182,212,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
}
.smart-card .sc-label {
  font-size: 0.575rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
}
.smart-card .sc-name {
  font-size: 0.775rem;
  font-weight: 700;
  color: #f1f5f9;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.smart-card .sc-price {
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.smart-card .sc-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.1rem;
  flex-wrap: wrap;
}
.smart-card .sc-dist,
.smart-card .sc-comune {
  font-size: 0.625rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}
.smart-card .sc-comune {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 5rem;
}

/* ── Feature cards ────────────────────────────────────────────────────────── */
.feature-card {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 1.125rem;
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.875rem;
  transition: border-color 0.18s;
}
.feature-card:hover { border-color: var(--border-2); }

.feature-icon-wrap {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.625rem;
  background-color: rgba(249,115,22,0.08);
  border: 1px solid rgba(249,115,22,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  flex-shrink: 0;
}

.feature-title {
  font-size: 0.825rem;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 0.3rem;
  line-height: 1.3;
}
.feature-desc {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}

/* ── Skeleton loading ─────────────────────────────────────────────────────── */
.skeleton-card {
  background: linear-gradient(90deg, var(--card) 25%, #1e1e30 50%, var(--card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Freshness badge ──────────────────────────────────────────────────────── */
.fresh-good    { color: #34d399; }
.fresh-ok      { color: #fbbf24; }
.fresh-stale   { color: #f87171; }
.fresh-unknown { color: #475569; }

/* ── Leaflet custom markers ───────────────────────────────────────────────── */
.pgv-marker {
  width: 28px !important;
  height: 28px !important;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.pgv-marker-cheap   { background: #10b981; }
.pgv-marker-average { background: #f59e0b; }
.pgv-marker-dear    { background: #ef4444; }
.pgv-marker-user {
  background: var(--brand);
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 0 0 4px rgba(249,115,22,0.25), 0 2px 8px rgba(0,0,0,0.4);
  transform: none;
}

/* ── Leaflet popup overrides ─────────────────────────────────────────────── */
.leaflet-popup-content-wrapper {
  background-color: var(--card) !important;
  color: var(--text) !important;
  border-radius: 0.875rem !important;
  border: 1px solid var(--border-2) !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6) !important;
  padding: 0 !important;
}
.leaflet-popup-tip { background-color: var(--card) !important; }
.leaflet-popup-content { margin: 0 !important; }
.leaflet-popup-close-button { color: #94a3b8 !important; font-size: 1rem !important; padding: 8px !important; }

/* ── Ad slot placeholders ─────────────────────────────────────────────────── */
.ad-slot-top-banner    { min-height: 90px;  width: 100%; background: transparent; }
.ad-slot-infeed        { min-height: 120px; width: 100%; background: transparent; }
.ad-slot-sticky-mobile { min-height: 50px;  width: 100%; background: transparent; position: sticky; bottom: 0; }

/* ── Province insight card ───────────────────────────────────────────────── */
#province-insight-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ── Prose overrides (SEO text blocks) ───────────────────────────────────── */
.prose { max-width: none; }
.prose h2 { font-size: 1.05rem; font-weight: 700; margin-top: 1.5rem; margin-bottom: 0.5rem; }
.prose h3 { font-size: 0.9rem;  font-weight: 600; margin-top: 1.25rem; margin-bottom: 0.375rem; }
.prose p  { color: #94a3b8; line-height: 1.75; margin-bottom: 0.75rem; font-size: 0.875rem; }
.prose a  { color: var(--brand); }

/* ── Responsive map+ranking split ───────────────────────────────────────── */
@media (min-width: 1024px) {
  #main-split {
    display: grid;
    grid-template-columns: 1fr 420px;
    height: calc(100vh - 3.5rem);
    overflow: hidden;
  }
  #map { height: 100% !important; }
  #ranking-section { overflow-y: auto; height: 100%; padding-top: 1rem; }
}

/* ── Radar toast notifications ───────────────────────────────────────────── */
.pgv-toast {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background-color: var(--card);
  border: 1px solid rgba(249,115,22,0.4);
  border-radius: 0.75rem;
  padding: 0.875rem 1rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: toast-in 0.25s ease;
}
.pgv-toast-icon  { width: 1.25rem; height: 1.25rem; flex-shrink: 0; color: var(--brand); }
.pgv-toast-title { font-size: 0.8rem; color: #fff; font-weight: 700; margin: 0 0 2px; }
.pgv-toast-body  { font-size: 0.7rem; color: #94a3b8; margin: 0; }
.pgv-toast-close {
  margin-left: auto;
  flex-shrink: 0;
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1;
  padding: 0;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Radar panel ─────────────────────────────────────────────────────────── */
#radar-panel {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.875rem;
  padding: 1rem 1.125rem;
  height: 100%;
}
#radar-panel .radar-status-dot {
  width: 0.4rem; height: 0.4rem; border-radius: 50%;
  display: inline-block;
}
#radar-panel .radar-status-dot.connected    { background: #34d399; }
#radar-panel .radar-status-dot.disconnected { background: var(--muted); }
#radar-panel .radar-status-dot.subscribed   { background: var(--brand); animation: pulse-dot 1.5s infinite; }
@keyframes pulse-dot {
  0%,100% { opacity: 1; } 50% { opacity: 0.3; }
}

/* ── Route planner panel ─────────────────────────────────────────────────── */
#route-panel {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.875rem;
  padding: 1rem 1.125rem;
}
.route-stop-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.625rem;
  padding: 0.625rem 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.625rem;
}
.route-stop-card .stop-rank {
  width: 1.375rem; height: 1.375rem;
  border-radius: 50%;
  background: rgba(6,182,212,0.15);
  color: var(--accent);
  border: 1px solid rgba(6,182,212,0.25);
  font-size: 0.6rem;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
