/* ==========================================
   CSS Design System: EV-Now Dashboard
   Aesthetic Concept: Premium Dark Glassmorphism
   ========================================== */

:root {
    --bg-base: #0a0d10;
    --bg-surface: #11151a;
    --bg-glass: rgba(15, 21, 28, 0.75);
    --border-glass: rgba(255, 255, 255, 0.07);
    --border-active: rgba(0, 242, 254, 0.3);
    
    --color-text-primary: #f3f4f6;
    --color-text-secondary: #9ca3af;
    --color-text-muted: #6b7280;
    
    /* Branding Accent HSL Curated Colors */
    --color-primary: #00f2fe; /* Electric Blue/Cyan */
    --color-primary-rgb: 0, 242, 254;
    --color-success: #10b981; /* Emerald Green */
    --color-warning: #f59e0b; /* Golden Amber */
    --color-danger: #ef4444;  /* Crimson Red */
    --color-info: #3b82f6;    /* Vibrant Cobalt */
    --color-purple: #8b5cf6;  /* Royal Purple */
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-quick: all 0.15s ease;
    
    --shadow-premium: 0 16px 40px -10px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 15px rgba(0, 242, 254, 0.2);
}

/* Base Reset & Typography */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-base);
    color: var(--color-text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

h1, h2, h3, .logo {
    font-family: 'Outfit', sans-serif;
}

/* Premium Layout & Glass Panel Structs */
#app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    position: relative;
}

.glass-panel {
    background: var(--bg-glass);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-premium);
}

.glass-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 18px;
    transition: var(--transition-smooth);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
}

/* Sidebar Dashboard Navigation Styling */
#sidebar {
    width: 420px;
    height: 100%;
    z-index: 10;
    display: flex;
    flex-direction: column;
    padding: 24px;
    border-radius: 0 24px 24px 0;
    border-left: none;
}

#sidebar header {
    margin-bottom: 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: var(--color-text-primary);
    background: linear-gradient(135deg, #ffffff 40%, var(--color-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.pulse-icon {
    color: var(--color-primary);
    -webkit-text-fill-color: initial;
    filter: drop-shadow(0 0 8px rgba(0, 242, 254, 0.8));
    animation: glow-pulse 2s infinite ease-in-out;
}

#sidebar .subtitle {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-top: 4px;
    letter-spacing: 0.5px;
}

/* Metrics Dashboard Cards styling */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.metric-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
}

.metric-info {
    display: flex;
    flex-direction: column;
}

.metric-info .label {
    font-size: 11px;
    color: var(--color-text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-info .value {
    font-size: 20px;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    margin-top: 2px;
}

.metric-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.bg-blue { background: rgba(59, 130, 246, 0.12); color: var(--color-info); }
.bg-green { background: rgba(16, 185, 129, 0.12); color: var(--color-success); }
.bg-teal { background: rgba(0, 242, 254, 0.12); color: var(--color-primary); }
.bg-purple { background: rgba(139, 92, 246, 0.12); color: var(--color-purple); }

.text-green { color: var(--color-success) !important; }
.text-blue { color: var(--color-info) !important; }
.text-purple { color: var(--color-purple) !important; }

/* Filter and Search Layout */
.search-filters h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-box {
    position: relative;
    width: 100%;
    margin-bottom: 14px;
}

.search-box i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    font-size: 14px;
    transition: var(--transition-quick);
}

.search-box input {
    width: 100%;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    padding: 11px 14px 11px 40px;
    color: var(--color-text-primary);
    font-size: 13px;
    outline: none;
    transition: var(--transition-quick);
}

.search-box input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.15);
}

.search-box input:focus + i {
    color: var(--color-primary);
}

.filter-group {
    margin-bottom: 12px;
}

.filter-group label {
    font-size: 11px;
    color: var(--color-text-muted);
    font-weight: 600;
    display: block;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.button-toggle-group {
    display: flex;
    gap: 6px;
}

.toggle-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    color: var(--color-text-secondary);
    padding: 8px;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition-quick);
}

.toggle-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--color-text-primary);
}

.toggle-btn.active {
    background: rgba(0, 242, 254, 0.12);
    border-color: var(--color-primary);
    color: var(--color-primary);
    font-weight: 600;
    box-shadow: 0 0 8px rgba(0, 242, 254, 0.1);
}

.btn {
    width: 100%;
    border: none;
    padding: 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition-quick);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    color: var(--color-text-secondary);
    margin-top: 8px;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--color-text-primary);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Charging Station List Area Styling */
.station-list-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-top: 20px;
    overflow: hidden;
}

.list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-glass);
}

.list-header h3 {
    font-size: 13px;
    color: var(--color-text-secondary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge {
    background: rgba(0, 242, 254, 0.12);
    border: 1px solid rgba(0, 242, 254, 0.3);
    color: var(--color-primary);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

.station-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 4px;
}

/* Premium Scrollbar styling */
.station-list::-webkit-scrollbar {
    width: 6px;
}
.station-list::-webkit-scrollbar-track {
    background: transparent;
}
.station-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}
.station-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.list-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    height: 100%;
    color: var(--color-text-muted);
    text-align: center;
    padding: 20px;
}

.list-placeholder i {
    font-size: 38px;
    color: rgba(255, 255, 255, 0.05);
}

.list-placeholder p {
    font-size: 12px;
    line-height: 1.5;
}

/* Station Item card style inside sidebar */
.station-item {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 14px;
    cursor: pointer;
    transition: var(--transition-quick);
}

.station-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(0, 242, 254, 0.2);
    transform: translateY(-2px);
}

.station-item.active {
    background: rgba(0, 242, 254, 0.04);
    border-color: var(--color-primary);
    box-shadow: 0 4px 15px rgba(0, 242, 254, 0.08);
}

.station-item h4 {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 4px;
    line-height: 1.4;
    word-break: keep-all;
}

.station-item .address {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-bottom: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.station-item .charger-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chg-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 3px 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chg-badge.available { background: rgba(16, 185, 129, 0.12); color: var(--color-success); border: 1px solid rgba(16, 185, 129, 0.2); }
.chg-badge.charging { background: rgba(59, 130, 246, 0.12); color: var(--color-info); border: 1px solid rgba(59, 130, 246, 0.2); }
.chg-badge.etc { background: rgba(107, 114, 128, 0.12); color: var(--color-text-secondary); border: 1px solid rgba(107, 114, 128, 0.2); }

/* Sidebar footer area */
#sidebar footer {
    margin-top: 18px;
    padding-top: 12px;
    border-top: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#sidebar footer .update-time {
    font-size: 10.5px;
    color: var(--color-primary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

#sidebar footer .credits {
    font-size: 10px;
    color: var(--color-text-muted);
}

/* Interactive Map Structure */
#map-container {
    flex: 1;
    height: 100%;
    position: relative;
    background-color: #0b0e11;
}

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

/* Leaflet Map Custom Overrides (Sleek Dark Theme) */
.leaflet-container {
    background: #0b0e11 !important;
}

.leaflet-bar {
    border: 1px solid var(--border-glass) !important;
    box-shadow: var(--shadow-premium) !important;
    border-radius: 12px !important;
    overflow: hidden;
}

.leaflet-bar a {
    background-color: var(--bg-glass) !important;
    color: var(--color-text-primary) !important;
    border-bottom: 1px solid var(--border-glass) !important;
    backdrop-filter: blur(10px);
    transition: var(--transition-quick);
}

.leaflet-bar a:hover {
    background-color: rgba(255, 255, 255, 0.08) !important;
    color: var(--color-primary) !important;
}

/* Floating Overlay Map Controls style */
.map-overlay-controls {
    position: absolute;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.floating-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-glass);
    color: var(--color-text-primary);
    box-shadow: var(--shadow-premium);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: var(--transition-quick);
}

.floating-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--color-primary);
    border-color: var(--color-primary);
    transform: translateY(-2px);
}

/* Map Popups Design styling */
.leaflet-popup-content-wrapper {
    background: var(--bg-glass) !important;
    backdrop-filter: blur(12px) !important;
    border: 1px solid var(--border-glass) !important;
    box-shadow: var(--shadow-premium) !important;
    color: var(--color-text-primary) !important;
    border-radius: 16px !important;
    padding: 4px;
}

.leaflet-popup-tip {
    background: var(--bg-glass) !important;
    border: 1px solid var(--border-glass) !important;
}

.leaflet-popup-content {
    margin: 12px 14px !important;
    width: 280px !important;
}

.map-popup-card h3 {
    font-size: 14.5px;
    font-weight: 700;
    margin-bottom: 4px;
    color: #fff;
    line-height: 1.3;
}

.map-popup-card .pop-addr {
    font-size: 11px;
    color: var(--color-text-secondary);
    margin-bottom: 12px;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.map-popup-card .pop-addr i {
    margin-top: 2px;
}

.popup-charger-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
}

.popup-charger-table th {
    font-size: 10px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-align: left;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    text-transform: uppercase;
}

.popup-charger-table td {
    padding: 6px 0;
    font-size: 11.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.popup-charger-table tr:last-child td {
    border-bottom: none;
}

.pop-status-dot {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 10.5px;
}

.pop-status-dot::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.pop-status-dot.stat-2::before { background: var(--color-success); box-shadow: 0 0 6px var(--color-success); }
.pop-status-dot.stat-2 { color: var(--color-success); }

.pop-status-dot.stat-3::before { background: var(--color-info); box-shadow: 0 0 6px var(--color-info); }
.pop-status-dot.stat-3 { color: var(--color-info); }

.pop-status-dot.stat-etc::before { background: var(--color-text-muted); }
.pop-status-dot.stat-etc { color: var(--color-text-secondary); }

.map-popup-card .pop-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    font-size: 10px;
    color: var(--color-text-muted);
}

/* Leaflet Marker Clustering Style Customization */
.marker-cluster-small {
    background-color: rgba(16, 185, 129, 0.2) !important;
}
.marker-cluster-small div {
    background-color: rgba(16, 185, 129, 0.6) !important;
    color: #fff !important;
    font-weight: bold;
}
.marker-cluster-medium {
    background-color: rgba(59, 130, 246, 0.2) !important;
}
.marker-cluster-medium div {
    background-color: rgba(59, 130, 246, 0.6) !important;
    color: #fff !important;
    font-weight: bold;
}
.marker-cluster-large {
    background-color: rgba(139, 92, 246, 0.2) !important;
}
.marker-cluster-large div {
    background-color: rgba(139, 92, 246, 0.6) !important;
    color: #fff !important;
    font-weight: bold;
}

/* Loading Overlay Screen styling */
#loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

#loading-overlay.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(0, 242, 254, 0.1);
    border-radius: 50%;
    border-top-color: var(--color-primary);
    animation: spin 1s ease-in-out infinite;
    filter: drop-shadow(0 0 10px rgba(0, 242, 254, 0.5));
    margin-bottom: 24px;
}

.loading-text {
    text-align: center;
    max-width: 320px;
}

.loading-text h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}

.loading-text p {
    font-size: 12px;
    color: var(--color-text-secondary);
    line-height: 1.5;
    margin-bottom: 20px;
}

.progress-bar-container {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 10%;
    background: linear-gradient(90deg, var(--color-primary), #0072ff);
    border-radius: 10px;
    box-shadow: 0 0 8px var(--color-primary);
    transition: width 0.4s ease-out;
}

/* Animations declarations */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes glow-pulse {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 5px rgba(0, 242, 254, 0.6));
    }
    50% {
        transform: scale(1.1);
        filter: drop-shadow(0 0 15px rgba(0, 242, 254, 1));
    }
}

/* Responsive adjustments for Tablets/Mobile */
@media (max-width: 900px) {
    #app-container {
        flex-direction: column-reverse;
    }
    #sidebar {
        width: 100%;
        height: 60vh;
        border-radius: 24px 24px 0 0;
    }
    #map-container {
        height: 40vh;
    }
}
