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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #0f172a;
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    height: 100dvh;
    overflow: hidden;
}

header {
    background: #1e293b;
    border-bottom: 1px solid #334155;
    padding: 10px 16px;
    flex-shrink: 0;
}

.header-inner h1 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #f8fafc;
}

.header-inner .subtitle {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 1px;
}

.controls {
    display: flex;
    flex-direction: column;
    background: #1e293b;
    border-bottom: 1px solid #334155;
    flex-shrink: 0;
}

.controls-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
}

.controls-row--fuel {
    border-bottom: 1px solid #1e2d40;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.controls-row--fuel::-webkit-scrollbar { display: none; }

.controls-row--actions {
    gap: 8px;
}

.fuel-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.fuel-btn {
    background: #334155;
    color: #cbd5e1;
    border: 1px solid #475569;
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.fuel-btn:hover { background: #475569; }

.fuel-btn.active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
    font-weight: 600;
}

#radius-select {
    background: #0f172a;
    color: #e2e8f0;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 0.82rem;
    cursor: pointer;
    outline: none;
}

#radius-select:focus { border-color: #2563eb; }

#cheap-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #052e16;
    color: #4ade80;
    border: 1px solid #166534;
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

#cheap-btn:hover { background: #14532d; }
#cheap-btn.active { background: #16a34a; color: #fff; border-color: #16a34a; font-weight: 600; }

#locate-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #0f172a;
    color: #60a5fa;
    border: 1px solid #1d4ed8;
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    margin-left: auto;
}

#locate-btn:hover { background: #1e3a5f; }
#locate-btn.loading { opacity: 0.6; cursor: not-allowed; }

#status-bar {
    font-size: 0.75rem;
    color: #64748b;
    white-space: nowrap;
    margin-left: auto;
    overflow: hidden;
    text-overflow: ellipsis;
}

#map {
    flex: 1;
    width: 100%;
    z-index: 0;
}

#legend {
    position: absolute;
    bottom: 30px;
    right: 10px;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.78rem;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.legend-title {
    font-weight: 700;
    color: #94a3b8;
    margin-bottom: 6px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.legend-row {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 4px;
    color: #cbd5e1;
}

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

/* Price bubble markers */
.price-marker {
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    border: 2px solid rgba(255,255,255,0.25);
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
    cursor: pointer;
    transition: transform 0.1s;
    white-space: nowrap;
}

.price-marker:hover { transform: scale(1.15); }

/* User location pulse */
.user-location-dot {
    width: 16px;
    height: 16px;
    background: #3b82f6;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 6px rgba(59,130,246,0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(59,130,246,0.4); }
    70% { box-shadow: 0 0 0 10px rgba(59,130,246,0); }
    100% { box-shadow: 0 0 0 0 rgba(59,130,246,0); }
}

/* Popup */
.leaflet-popup-content-wrapper {
    background: #1e293b;
    color: #e2e8f0;
    border: 1px solid #334155;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.leaflet-popup-tip { background: #1e293b; }

.popup-content { min-width: 180px; }
.popup-name { font-weight: 700; font-size: 0.95rem; margin-bottom: 2px; }
.popup-brand { font-size: 0.75rem; color: #94a3b8; margin-bottom: 6px; }
.popup-address { font-size: 0.75rem; color: #64748b; margin-bottom: 8px; }
.popup-price { font-size: 1.2rem; font-weight: 800; margin-bottom: 6px; }
.popup-price span { color: #94a3b8; font-size: 0.7rem; font-weight: 400; }
.popup-updated { font-size: 0.68rem; color: #475569; margin-bottom: 8px; }
.popup-link {
    display: inline-block;
    background: #2563eb;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 0.78rem;
    font-weight: 600;
}
.popup-link:hover { background: #1d4ed8; }

.popup-flag { font-size: 1rem; margin-right: 4px; }

@media (max-width: 600px) {
    header { padding: 6px 10px; }
    .header-inner h1 { font-size: 1rem; }
    .controls-row { padding: 5px 10px; }
    .fuel-btn { padding: 6px 12px; font-size: 0.8rem; }
    #cheap-btn, #locate-btn { padding: 6px 12px; font-size: 0.8rem; }
}
