/* Gas.rimwi.es v2 — Map-only with price labels */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #ffffff;
  --bg2: #f8f9fa;
  --bg3: #e9ecef;
  --text: #212529;
  --text2: #6c757d;
  --accent: #0d6efd;
  --border: rgba(0,0,0,0.1);
  --header-h: 48px;
  --sb-w: 260px;
}

html, body {
  height: 100%; width: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg); color: var(--text); overflow: hidden;
}

/* HEADER */
#header {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 900; height: var(--header-h);
  background: var(--bg); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 10px; gap: 8px;
}
.btn-menu {
  width: 40px; height: 40px; padding: 0;
  display: grid; place-items: center;
  background: none; border: 1px solid var(--border); border-radius: 12px;
  font-size: 1.2rem; cursor: pointer; color: var(--text);
}
.btn-menu:hover { background: var(--bg3); }
#header-info { font-size: 0.85rem; font-weight: 600; flex: 1; }
.header-pill {
  display: none;
}

/* MAP — full height below header */
#map {
  position: fixed; top: var(--header-h); left: 0; right: 0; bottom: 0; z-index: 1;
}

/* SIDEBAR */
#sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sb-w); z-index: 1100;
  background: var(--bg); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  transform: translateX(0); transition: transform 0.25s ease;
  box-shadow: 2px 0 12px rgba(0,0,0,0.1);
}
#sidebar.collapsed { transform: translateX(calc(-1 * var(--sb-w) - 2px)); }

.sb-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
}
.sb-header h1 { font-size: 1.1rem; font-weight: 700; }
.sb-close {
  background: none; border: none; font-size: 1.5rem; cursor: pointer;
  color: var(--text2); line-height: 1; padding: 0 4px;
}
.sb-close:hover { color: var(--text); }

.sb-section { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.sb-label {
  font-size: 0.72rem; color: var(--text2); text-transform: uppercase;
  font-weight: 600; letter-spacing: 0.5px; margin-bottom: 8px; display: block;
}

#sidebar select {
  width: 100%; background: var(--bg2); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; font-size: 0.85rem; cursor: pointer; outline: none;
}
#sidebar select:focus { border-color: var(--accent); }

.adblue-toggle {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.85rem; font-weight: 500; cursor: pointer; user-select: none;
}
.adblue-toggle input { accent-color: var(--accent); margin: 0; cursor: pointer; width: 16px; height: 16px; }

.sb-btn-locate {
  width: 100%; padding: 10px; background: var(--accent); color: #fff;
  border: none; border-radius: 8px; font-size: 0.85rem; font-weight: 600;
  cursor: pointer; transition: opacity 0.2s;
}
.sb-btn-locate:hover { opacity: 0.85; }

#sb-overlay {
  position: fixed; inset: 0; z-index: 1050; background: rgba(0,0,0,0.4);
  opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
#sb-overlay.show { opacity: 1; pointer-events: auto; }

/* PRICE MARKERS on map */
.price-marker {
  display: flex; flex-direction: column; align-items: center;
  background: none; border: 0; padding: 0; cursor: pointer;
}
.price-label {
  position: relative;
  display: inline-block;
  padding: 5px 9px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #fff;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  border: 2px solid #fff;
}
.price-label::after {
  content: '';
  position: absolute;
  left: 50%; bottom: -6px;
  width: 8px; height: 8px;
  background: inherit;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: translateX(-50%) rotate(45deg);
}

/* Popup */
.popup-price { font-size: 1.3rem; font-weight: 800; margin-bottom: 4px; }
.popup-name { font-size: 0.9rem; font-weight: 600; margin-bottom: 2px; }
.popup-addr { font-size: 0.78rem; color: var(--text2); }
.popup-dist { font-size: 0.75rem; color: var(--text2); margin-top: 4px; }
.popup-gmaps {
  display: inline-block; margin-top: 6px; padding: 5px 10px;
  background: #4285f4; color: #fff; border-radius: 4px;
  text-decoration: none; font-size: 12px; font-weight: 600;
}
.popup-gmaps:hover { opacity: 0.9; }

.maplibregl-popup-content { border-radius: 10px; padding: 12px 14px; }
.maplibregl-ctrl-attrib { font-size: 9px; }

.user-marker {
  width: 18px; height: 18px; border-radius: 50%;
  border: 3px solid #fff; background: #2453d4;
  box-shadow: 0 1px 5px rgba(0,0,0,.35); cursor: pointer;
}

.btn-follow {
  position: fixed; right: 14px; bottom: 18px; z-index: 850;
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: #123d35; color: #fff; font-size: 25px; line-height: 1;
  box-shadow: 0 3px 12px rgba(0,0,0,.28); cursor: pointer;
}
.btn-follow:hover { background: #0b2e28; }

/* Loading */
#loading {
  position: fixed; inset: 0; z-index: 9999; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  transition: opacity 0.3s;
}
#loading.hidden { opacity: 0; pointer-events: none; }
.spinner {
  width: 36px; height: 36px; border: 3px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading-text { color: var(--text2); font-size: 0.9rem; }

/* Toast */
#toast {
  position: fixed; top: calc(var(--header-h) + 10px); left: 50%;
  transform: translateX(-50%); z-index: 9999;
  background: var(--text); color: var(--bg); padding: 8px 18px;
  border-radius: 20px; font-size: 0.85rem; opacity: 0;
  transition: opacity 0.3s; pointer-events: none; white-space: nowrap;
}
#toast.show { opacity: 1; }

/* AdBlue price label on map pin */
.adblue-label {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  color: #123d35;
  background: #f7faf8;
  white-space: nowrap;
  text-shadow: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  border: 1px solid #123d35;
  margin-top: 8px;
}
.popup-adblue {
  font-size: 0.8rem; color: #2196f3; font-weight: 600; margin-top: 4px;
}
