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

html, body {
    width: 100%; height: 100%; overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Map */
#map {
    width: 100%;
    height: 100vh;
    padding-top: 60px;
    box-sizing: border-box;
}

/* Top bar */
#top-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.97);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

#search-wrap { flex: 1; position: relative; }

#station-search-input {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.95rem;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    outline: none;
    box-sizing: border-box;
    background: #f8fafc;
}

#station-search-input:focus {
    border-color: #3b82f6;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}

#station-search-results {
    position: absolute;
    top: 110%; left: 0; right: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    max-height: 260px;
    overflow-y: auto;
    z-index: 600;
}

.search-result-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.88rem;
    color: #1e293b;
    border-bottom: 1px solid #f1f5f9;
}
.search-result-item:hover { background: #f8fafc; }
.search-result-brand { font-size: 0.75rem; color: #94a3b8; margin-top: 2px; }
.search-result-empty { padding: 10px 14px; font-size: 0.85rem; color: #94a3b8; font-style: italic; }

/* Top bar right */
#top-bar-right { display: flex; align-items: center; gap: 8px; }

#auth-btn {
    padding: 8px 16px; font-size: 0.85rem; font-weight: 600;
    border: none; border-radius: 20px;
    background: #3b82f6; color: #fff; cursor: pointer;
}
#auth-btn:hover { background: #2563eb; }

#user-info { display: flex; align-items: center; gap: 6px; }
#user-avatar { width: 28px; height: 28px; border-radius: 50%; }

#sign-out-btn {
    background: none; border: none; font-size: 0.8rem;
    color: #ef4444; cursor: pointer; font-weight: 500;
}

/* Filter */
#station-filter { position: relative; }
#filter-toggle {
    padding: 8px 14px; font-size: 0.85rem; font-weight: 600;
    border: 1px solid #e2e8f0; border-radius: 20px;
    background: #fff; cursor: pointer; user-select: none;
}
#filter-dropdown {
    display: none; position: absolute; top: 110%; right: 0;
    background: #fff; border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    padding: 8px 0; min-width: 140px; z-index: 600;
}
#filter-dropdown.open { display: block; }
#filter-dropdown label {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px; font-size: 0.85rem; color: #1e293b; cursor: pointer;
}
#filter-dropdown label:hover { background: #f8fafc; }
#filter-dropdown hr { border: none; border-top: 1px solid #e2e8f0; margin: 4px 0; }

/* Map markers */
.map-marker {
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
    background: white; border-radius: 50%;
    border: 2px solid #cbd5e1;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.map-marker.fuel { color: #2563eb; border-color: #93c5fd; }
.map-marker.ev { color: #16a34a; border-color: #86efac; }
.map-marker.has-prices { border-width: 4px; }

.map-marker.fuel.has-prices { border-color: #2563eb; }
.map-marker.ev.has-prices { border-color: #16a34a; }

/* Station bottom sheet popup */
#station-popup {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 600;
    background: #fff;
    border-radius: 20px 20px 0 0;
    padding: 8px 20px 32px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    max-height: 70vh;
    overflow-y: auto;
}
.popup-drag-handle {
    width: 40px; height: 4px;
    background: #cbd5e1; border-radius: 2px;
    margin: 0 auto 12px;
}
.popup-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 8px;
}
.popup-name { font-size: 1.1rem; font-weight: 700; color: #1e293b; }
.popup-close {
    background: none; border: none; font-size: 1.4rem;
    color: #94a3b8; cursor: pointer; padding: 0 4px;
}
.popup-detail { font-size: 0.85rem; color: #64748b; margin-bottom: 4px; }
.popup-type {
    display: inline-block; font-size: 0.75rem; font-weight: 600;
    padding: 2px 10px; border-radius: 10px; margin-top: 4px;
}
.popup-type.fuel { background: #dbeafe; color: #2563eb; }
.popup-type.ev { background: #dcfce7; color: #16a34a; }

#popup-prices { margin-top: 12px; border-top: 1px solid #e2e8f0; padding-top: 10px; }
.popup-price-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 4px 0; font-size: 0.85rem;
}
.popup-fuel-type { font-weight: 600; color: #334155; text-transform: capitalize; }
.popup-price-value { font-weight: 700; color: #1e293b; }
.popup-price-meta { font-size: 0.72rem; color: #94a3b8; margin-bottom: 4px; }
.popup-no-prices { font-size: 0.82rem; color: #94a3b8; font-style: italic; padding: 6px 0; }

.badge-verified { color: #2563eb; font-size: 0.72rem; font-weight: 600; }
.badge-unverified { color: #f59e0b; font-size: 0.72rem; }
.badge-credible { color: #16a34a; font-size: 0.72rem; font-weight: 600; }

.popup-vote-row { display: flex; gap: 6px; margin: 4px 0 8px; }
.vote-btn {
    padding: 4px 12px; font-size: 0.78rem;
    border: 1px solid #e2e8f0; border-radius: 6px;
    background: #f8fafc; cursor: pointer; color: #64748b;
}
.vote-btn:hover { background: #e2e8f0; }
.vote-btn.voted { opacity: 0.5; pointer-events: none; }

#popup-submit-price {
    width: 100%; padding: 14px; margin-top: 12px;
    font-size: 1rem; font-weight: 700;
    border: none; border-radius: 12px;
    background: #3b82f6; color: #fff; cursor: pointer;
}
#popup-submit-price:hover { background: #2563eb; }

/* Floating submit */
#floating-submit {
    position: fixed;
    bottom: 24px; left: 50%;
    transform: translateX(-50%);
    z-index: 500;
    padding: 16px 36px;
    font-size: 1rem; font-weight: 700;
    border: none; border-radius: 50px;
    background: #3b82f6; color: #fff;
    box-shadow: 0 4px 16px rgba(59,130,246,0.4);
    cursor: pointer; white-space: nowrap;
}
#floating-submit:hover { background: #2563eb; }

/* Price form overlay */
#price-form-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 700;
    justify-content: center;
    align-items: center;
    padding: 20px;
}
#price-form-overlay.active { display: flex; }

#price-form {
    background: #fff; border-radius: 16px;
    padding: 24px; width: 100%; max-width: 400px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
    max-height: 90vh; overflow-y: auto;
}
#price-form h3 { margin: 0 0 4px; font-size: 1.1rem; color: #1e293b; }
#price-form .form-station { font-size: 0.85rem; color: #64748b; margin-bottom: 16px; }
#price-form label { display: block; font-size: 0.85rem; font-weight: 600; color: #334155; margin-bottom: 4px; }

#price-form select,
#price-form input[type="number"],
#price-form input[type="date"] {
    width: 100%; padding: 10px 12px; font-size: 0.95rem;
    border: 1px solid #e2e8f0; border-radius: 10px;
    outline: none; margin-bottom: 14px; box-sizing: border-box;
}
#price-form select:focus,
#price-form input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59,130,246,0.2);
}

#form-auth-prompt {
    display: none; background: #fffbeb;
    border: 1px solid #fde68a; border-radius: 10px;
    padding: 12px; margin-bottom: 14px;
    font-size: 0.82rem; color: #92400e; text-align: center;
}
#form-auth-prompt button {
    margin-top: 8px; padding: 6px 16px;
    font-size: 0.82rem; font-weight: 600;
    border: none; border-radius: 8px;
    background: #3b82f6; color: #fff; cursor: pointer;
}

.form-error { color: #ef4444; font-size: 0.8rem; margin-top: -10px; margin-bottom: 10px; display: none; }
.form-success { color: #16a34a; font-size: 0.85rem; text-align: center; margin-top: 8px; display: none; }

.form-buttons { display: flex; gap: 8px; margin-top: 4px; }
.form-buttons button { flex: 1; padding: 12px; font-size: 0.9rem; font-weight: 600; border: none; border-radius: 10px; cursor: pointer; }
#price-submit-btn { background: #3b82f6; color: #fff; }
#price-submit-btn:hover { background: #2563eb; }
#price-cancel-btn { background: #f1f5f9; color: #475569; }
#price-cancel-btn:hover { background: #e2e8f0; }

/* Notification banner */
#notif-banner {
    display: none;
    position: fixed; bottom: 80px; left: 50%;
    transform: translateX(-50%);
    z-index: 800;
    background: #1e293b; color: #fff;
    border-radius: 12px; padding: 12px 16px;
    align-items: center; gap: 10px;
    font-size: 0.85rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    max-width: 90vw;
}
#notif-allow-btn {
    padding: 6px 14px; border: none; border-radius: 8px;
    background: #3b82f6; color: #fff; font-weight: 600; cursor: pointer;
}
#notif-dismiss-btn {
    padding: 6px 10px; border: none; border-radius: 8px;
    background: transparent; color: #94a3b8; cursor: pointer;
}

/* Mobile */
@media (max-width: 768px) {
    #price-form { padding: 20px; }
    #station-popup { max-height: 60vh; }
    #floating-submit { padding: 14px 28px; font-size: 0.95rem; }
}

/* Onboarding */
#onboarding {
    position: fixed;
    inset: 0; z-index: 1000;
    background: rgba(15,23,42,0.92);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
#onboarding.hidden { display: none; }
#onboarding-card {
    background: #fff; border-radius: 20px;
    padding: 32px 24px; max-width: 380px; width: 100%;
    text-align: center;
    box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}
#onboarding-logo { font-size: 3rem; margin-bottom: 8px; }
#onboarding-card h1 { font-size: 1.4rem; color: #1e293b; margin-bottom: 4px; }
.onboarding-sub { font-size: 0.85rem; color: #000000; margin-bottom: 16px; }
#onboarding-stat {
    background: #dbeafe; color: #2563eb;
    font-weight: 700; font-size: 0.9rem;
    padding: 8px 16px; border-radius: 20px;
    display: inline-block; margin-bottom: 16px;
}
.onboarding-cta { font-size: 0.88rem; color: #475569; margin-bottom: 20px; line-height: 1.5; }
#onboarding-signin-box {
    background: #f8fafc; border-radius: 12px;
    padding: 16px; margin-bottom: 16px;
}
#onboarding-signin-btn {
    width: 100%; padding: 14px;
    font-size: 1rem; font-weight: 700;
    border: none; border-radius: 10px;
    background: #3b82f6; color: #fff;
    cursor: pointer; margin-bottom: 12px;
}
#onboarding-signin-btn:hover { background: #2563eb; }
.onboarding-nudge { font-size: 0.8rem; color: #475569; line-height: 1.5; margin: 0; }
.onboarding-nudge-sub { font-size: 0.75rem; color: #94a3b8; }
#onboarding-skip {
    background: none; border: none;
    color: #94a3b8; font-size: 0.85rem;
    cursor: pointer; text-decoration: underline;
}

#submit-search-overlay {
    display: none;
    position: fixed;
    inset: 0; z-index: 700;
    background: rgba(0,0,0,0.5);
    align-items: flex-end;
    justify-content: center;
}
#submit-search-overlay.active { display: flex; }
#submit-search-box {
    background: #fff;
    border-radius: 20px 20px 0 0;
    padding: 8px 20px 40px;
    width: 100%; max-width: 500px;
    max-height: 80vh; overflow-y: auto;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
}
#submit-search-box h3 { font-size: 1.05rem; color: #1e293b; margin-bottom: 12px; text-align: center; }
#submit-search-input {
    width: 100%; padding: 12px 14px;
    font-size: 0.95rem; border: 1px solid #e2e8f0;
    border-radius: 24px; outline: none; box-sizing: border-box;
    background: #f8fafc;
}
#submit-search-input:focus { border-color: #3b82f6; background: #fff; }
#submit-search-results { margin-top: 8px; max-height: 200px; overflow-y: auto; }
#submit-search-fallback {
    margin-top: 12px; padding: 12px;
    background: #fffbeb; border-radius: 10px;
    border: 1px solid #fde68a;
    font-size: 0.82rem; color: #92400e; text-align: center;
}
#submit-search-fallback p { margin-bottom: 8px; }
#submit-area-input {
    width: 100%; padding: 10px 12px; font-size: 0.9rem;
    border: 1px solid #fde68a; border-radius: 10px;
    outline: none; box-sizing: border-box; margin-bottom: 8px;
}
#submit-area-btn {
    width: 100%; padding: 10px; font-size: 0.9rem; font-weight: 600;
    border: none; border-radius: 10px;
    background: #f59e0b; color: #fff; cursor: pointer;
}
#submit-search-cancel {
    margin-top: 12px; width: 100%; padding: 10px;
    font-size: 0.85rem; font-weight: 600;
    border: none; border-radius: 10px;
    background: #f1f5f9; color: #475569; cursor: pointer;
}

#notif-frequency {
    padding: 6px 10px; border: none; border-radius: 8px;
    background: #334155; color: #fff; font-size: 0.82rem; cursor: pointer;
}

#onboarding-community {
    background: #f0fdf4; border-radius: 10px;
    padding: 10px 14px; margin-bottom: 14px;
    font-size: 0.85rem; color: #166534; text-align: left;
}
#onboarding-community p { margin-bottom: 6px; }
#onboarding-community p:last-child { margin-bottom: 0; }
.onboarding-coming-soon { font-size: 0.78rem; color: #64748b; }

#locate-btn {
    position: fixed;
    bottom: 100px; right: 12px;
    z-index: 500;
    width: 36px; height: 36px;
    border-radius: 4px;
    border: 2px solid rgba(0,0,0,0.2);
    background: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
#locate-btn:hover { background: #f8fafc; }

.locate-marker {
    font-size: 1.6rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}
