/* A Better BMW Charge Map Theme */
body { margin: 0; padding: 0; background: #0f172a; overflow: hidden; font-family: 'Inter', -apple-system, sans-serif; display: flex; flex-direction: column; height: 100vh; }

/* Layout */
#app-header {
    height: 60px;
    background: #0b1120;
    border-bottom: 1px solid rgba(59, 130, 246, 0.2);
    display: flex;
    align-items: center;
    padding: 0 16px;
    z-index: 1000;
}

#main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

#sidebar {
    width: 380px;
    background: #0f172a;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    z-index: 50;
    height: 100%;
}

#map-container {
    flex: 1;
    position: relative;
}

#map { height: 100%; width: 100%; outline: none; }

/* Panels inside Sidebar */
.sidebar-panel {
    display: none;
    flex-direction: column;
    padding: 16px;
    overflow-y: auto;
    height: 100%;
}
.sidebar-panel.active {
    display: flex;
}

/* Glass & UI Elements */
.glass-panel {
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Scrollbars */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(59, 130, 246, 0.3); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(59, 130, 246, 0.5); }

/* Inputs */
input[type="checkbox"]:checked { background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e"); }

input[type=range] { -webkit-appearance: none; appearance: none; background: transparent; }
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none; height: 16px; width: 16px; border-radius: 50%; background: #3b82f6;
    cursor: pointer; margin-top: -6px; box-shadow: 0 0 10px rgba(59,130,246,0.6);
}
input[type=range]::-webkit-slider-runnable-track {
    width: 100%; height: 4px; cursor: pointer; background: rgba(255,255,255,0.1); border-radius: 2px;
}

/* Leaflet Overrides */
.leaflet-control-zoom { border: none !important; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 20px rgba(0,0,0,0.5) !important; margin-bottom: 20px !important; margin-right: 20px !important;}
.leaflet-control-zoom a { background: rgba(11, 17, 32, 0.9) !important; color: white !important; border-color: rgba(255,255,255,0.05) !important; width: 44px !important; height: 44px !important; line-height: 44px !important; font-size: 18px !important; }
.leaflet-control-zoom a:hover { background: rgba(30, 41, 59, 1) !important; color: #3b82f6 !important;}

/* Mobile Bottom Sheet (Max-width 768px) */
@media (max-width: 768px) {
    body { flex-direction: column; }
    #main-container { flex-direction: column; }
    #sidebar {
        width: 100%;
        height: 40vh;
        border-right: none;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        z-index: 1000;
        background: rgba(15, 23, 42, 0.95);
        backdrop-filter: blur(20px);
        position: absolute;
        bottom: 0;
        transition: transform 0.3s ease;
    }
    #sidebar.hidden-mobile { transform: translateY(100%); }
    #map-container { height: 100vh; position: absolute; top:0; left:0; width:100%; z-index: 1;}
    .leaflet-control-zoom { margin-bottom: 45vh !important; } /* Move up above sheet */
}

/* Custom Nav Buttons */
.nav-btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
    color: #9ca3af;
    border: 1px solid transparent;
}
.nav-btn:hover { color: #fff; background: rgba(255,255,255,0.05); }
.nav-btn.active { color: #3b82f6; background: rgba(59, 130, 246, 0.1); border-color: rgba(59, 130, 246, 0.2); }

/* ═══════════════════════════ LOGIN OVERLAY ═══════════════════════════ */
#login-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #060c1a;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease, transform 0.6s ease;
}
#login-overlay.hiding {
    opacity: 0;
    transform: scale(1.06);
    pointer-events: none;
}
#login-overlay.hidden { display: none; }

#login-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Card */
#login-card {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 400px;
    margin: 20px;
    padding: 44px 40px 40px;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 24px;
    box-shadow: 0 0 80px rgba(59, 130, 246, 0.1), 0 40px 80px rgba(0,0,0,0.6);
    text-align: center;
    animation: loginCardIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes loginCardIn {
    from { opacity: 0; transform: translateY(30px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Logo */
#login-logo {
    position: relative;
    width: 72px;
    height: 72px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}
#login-logo span {
    position: relative;
    z-index: 2;
    font-size: 28px;
    font-weight: 800;
    color: white;
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 30px rgba(59,130,246,0.5);
}
#login-logo-ring {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid transparent;
    background: linear-gradient(135deg, #3b82f6, #06b6d4) border-box;
    -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: destination-out;
    mask-composite: exclude;
    animation: spinRing 4s linear infinite;
}
@keyframes spinRing {
    to { transform: rotate(360deg); }
}

/* Title */
#login-title {
    font-size: 22px;
    font-weight: 800;
    color: white;
    margin: 0 0 6px;
    line-height: 1.25;
}
#login-title span {
    background: linear-gradient(90deg, #3b82f6, #06b6d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
#login-subtitle {
    font-size: 13px;
    color: #64748b;
    margin: 0 0 32px;
}

/* Form */
#login-form { display: flex; flex-direction: column; gap: 16px; }

.login-field { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.login-field label { font-size: 12px; font-weight: 600; color: #94a3b8; letter-spacing: 0.05em; text-transform: uppercase; }
.login-field input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 16px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    color: white;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.login-field input::placeholder { color: #475569; }
.login-field input:focus {
    border-color: rgba(59,130,246,0.6);
    background: rgba(59,130,246,0.06);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

/* Error */
#login-error {
    font-size: 13px;
    color: #f87171;
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.2);
    border-radius: 10px;
    padding: 10px 14px;
    text-align: center;
    display: none;
}
#login-error.visible { display: block; }

#login-form.shake { animation: loginShake 0.45s cubic-bezier(0.36,0.07,0.19,0.97) both; }
@keyframes loginShake {
    10%, 90% { transform: translateX(-3px); }
    20%, 80% { transform: translateX(5px); }
    30%, 50%, 70% { transform: translateX(-5px); }
    40%, 60% { transform: translateX(5px); }
}

/* Button */
#login-btn {
    margin-top: 6px;
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #2563eb, #0891b2);
    color: white;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: opacity 0.2s, transform 0.15s, box-shadow 0.3s;
    box-shadow: 0 0 20px rgba(37,99,235,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
#login-btn:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 0 35px rgba(37,99,235,0.6);
}
#login-btn:active:not(:disabled) { transform: translateY(0); }
#login-btn:disabled { cursor: not-allowed; opacity: 0.7; }

#login-btn-check { display: none; width: 22px; height: 22px; stroke: white; }
#login-btn::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.15) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0s;
}
#login-btn:hover::before { transform: translateX(100%); transition: transform 0.4s ease; }

/* Spinner */
#login-btn-spinner {
    display: none;
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: btnSpin 0.7s linear infinite;
}
@keyframes btnSpin { to { transform: rotate(360deg); } }

/* Flash & Burst */
#login-flash {
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(59,130,246,0.8) 0%, rgba(6,182,212,0.4) 40%, transparent 70%);
    opacity: 0;
    pointer-events: none;
    z-index: 9998;
    transition: opacity 0.05s;
}
#login-flash.active { opacity: 1; }

#login-burst {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9997;
    overflow: hidden;
}
.burst-particle {
    position: absolute;
    left: 50%; top: 50%;
    width: 3px;
    border-radius: 3px;
    background: linear-gradient(to bottom, #60a5fa, #06b6d4);
    transform-origin: 0 0;
    animation: burstOut 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
@keyframes burstOut {
    0%   { opacity: 1;  transform: rotate(var(--angle)) translateX(0) scaleY(1); }
    80%  { opacity: 1; }
    100% { opacity: 0;  transform: rotate(var(--angle)) translateX(var(--dist)) scaleY(0.3); }
}
/* ═══════════════════════════════════════════════════════════════════ */

