/* ===== MODERN 2-COLUMN LAYOUT ===== */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: #f8f9fa;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ===== LEFT SIDEBAR (15%) ===== */
nav {
    position: relative;
    width: 15%;
    height: 100vh;
    background: linear-gradient(135deg, rgba(255,255,255,0.98), rgba(245,247,250,0.98));
    backdrop-filter: blur(10px);
    border-right: 1px solid rgba(0,0,0,0.05);
    flex-direction: column;
    padding: 24px 16px;
    z-index: 1000;
    box-shadow: 2px 0 8px rgba(0,0,0,0.05);
    /* overflow-y: auto; */
}

/* Sidebar scrollbar styling */
nav::-webkit-scrollbar {
    width: 6px;
}

nav::-webkit-scrollbar-track {
    background: transparent;
}

nav::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.1);
    border-radius: 3px;
}

nav::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.2);
}

/* Logo and Title */
nav > h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    -webkit-font-smoothing: antialiased;
    background: linear-gradient(135deg, #0d6efd, #17a2b8);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

nav > h1::before {
    content: '⚡';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #06b6d4, #0ea5e9);
    color: #fff;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(14,165,233,0.2);
    flex-shrink: 0;
}

/* Navigation Links */
nav > a {
    display: block;
    padding: 10px 12px;
    margin: 10px 0;
    text-decoration: none;
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    border-radius: 8px;
    border-left: 3px solid transparent;
}

nav > a:hover {
    background: rgba(13, 110, 253, 0.1);
    color: #0d6efd;
    border-left-color: #0d6efd;
    transform: translateX(2px);
}

nav > a:active,
nav > a:focus-visible,
nav > a[aria-current="page"] {
    background: rgba(13, 110, 253, 0.25);
    color: #0a58ca;
    border-left-color: #0d6efd;
    transform: translateX(4px);
    box-shadow: inset 0 0 0 1px rgba(13, 110, 253, 0.25);
}

/* Filter Section Title */
nav > h2 {
    margin: 16px 0 12px 0;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #6b7280;
}

/* Filter Button Container */
.power-filter-buttons,
.price-filter-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.price-filter-buttons {
    margin-top: 8px;
}

.app-footer {
    display: flex;
    gap: 10px;
    position: absolute;
    bottom: 10px;
}

.app-footer a {
    font-size: 0.9rem;
}

.app-footer .version {
    font-size: 0.75rem;
    color: #888;
    margin-left: auto;
}

.price-filter-btn,
.power-filter-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.08), rgba(0, 198, 255, 0.08));
    border: 1px solid rgba(13, 110, 253, 0.2);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    color: #0d6efd;
    transition: all 0.2s ease;
}

.price-filter-btn:hover,
.power-filter-btn:hover {
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.15), rgba(0, 198, 255, 0.15));
    border-color: rgba(13, 110, 253, 0.4);
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.15);
}

.price-filter-btn:active,
.price-filter-btn.active {
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.35), rgba(0, 198, 255, 0.35));
    border-color: rgba(13, 110, 253, 0.4);
    color: #0c63ff;
    box-shadow: 0 4px 14px rgba(13, 110, 253, 0.25);
}

.power-filter-btn:active,
.power-filter-btn.active {
    background: linear-gradient(135deg, rgba(13,110,253,0.35), rgba(0,198,255,0.35));
    border-color: rgba(13,110,253,0.7);
    color: #0a58ca;
    box-shadow: 0 4px 12px rgba(13,110,253,0.25);
}

/* ===== MAIN CONTENT AREA (85%) ===== */
main {
    flex: 1;
    width: 85%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Leaflet Map Container */
#map-cluster {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    touch-action: none; /* Prevent browser default touch gestures (scrolling during map pan/zoom) */
}

button {
    cursor: pointer;
}

/* Geolocation Button — Map Control */
.geolocation-button-container {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 800; /* above tiles + canvas, below popups */
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.geolocation-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: #ffffff;
    border: 2px solid rgba(0,0,0,0.2);
    border-radius: 6px;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    color: #333;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    transition: all 0.15s ease;
}

.geolocation-btn:hover:not(:disabled) {
    background: #f0f0f0;
    border-color: rgba(0,0,0,0.35);
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
}

.geolocation-btn:active:not(:disabled) {
    background: #e0e0e0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.geolocation-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.geolocation-coordinates {
    font-size: 0.75rem;
    color: #334155;
    font-family: 'Menlo', 'Consolas', monospace;
    padding: 4px 8px;
    background: rgba(255,255,255,0.92);
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}

.geolocation-error {
    max-width: 220px;
    padding: 6px 10px;
    background: rgba(255,255,255,0.95);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    color: #ef4444;
    font-size: 0.8rem;
    font-weight: 500;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Popup styling */
.station-popup {
    display: none; /* legacy, nicht mehr genutzt */
}

/* Modern Station Popup */
.sp {
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 13px;
    color: #1e293b;
    width: 300px;
    padding: 14px 16px 12px;
}

.sp-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    padding-right: 22px; /* Platz für Leaflet Close-Button */
    border-bottom: 1px solid rgba(15,23,42,0.08);
}

.sp-name {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
    flex: 1;
    min-width: 0;
}

.sp-avail {
    font-size: 13px;
    font-weight: 700;
    padding: 2px 9px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}
.sp-avail--ok   { background: #dcfce7; color: #15803d; }
.sp-avail--none { background: #fee2e2; color: #b91c1c; }
.sp-avail--unknown { background: #f1f5f9; color: #64748b; }

.sp-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin-bottom: 10px;
    font-size: 12px;
    color: #64748b;
}

.sp-meta-item {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.sp-points {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sp-point {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: flex-start;
    gap: 8px;
    padding: 5px 8px;
    border-radius: 8px;
    background: rgba(15,23,42,0.03);
    border: 1px solid rgba(15,23,42,0.06);
    min-width: 0;
}

.sp-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-top: 1px;
}

.sp-middle {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.sp-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.sp-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
}
.sp-dot--green   { background: #22c55e; box-shadow: 0 0 0 2px rgba(34,197,94,.2); }
.sp-dot--blue    { background: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,.2); }
.sp-dot--red     { background: #ef4444; box-shadow: 0 0 0 2px rgba(239,68,68,.2); }
.sp-dot--unknown { background: #cbd5e1; }

.sp-evse {
    font-family: 'Menlo', 'Consolas', monospace;
    font-size: 11px;
    color: #475569;
    word-break: break-all;
    min-width: 0;
}

.sp-plug {
    font-size: 11px;
    font-weight: bold;
    white-space: nowrap;
}

.sp-power {
    font-size: 12px;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
}

.sp-status-label {
    font-size: 10px;
    font-weight: 500;
    color: #64748b;
    white-space: nowrap;
}

.sp-status-wrap {
    display: flex;
    flex-direction: column;
    gap: 1px;
    white-space: nowrap;
}

.sp-since {
    font-size: 9px;
    color: #94a3b8;
    white-space: nowrap;
}

.sp-price {
    font-size: 11px;
    font-weight: 600;
    color: #059669;
    white-space: nowrap;
}

.sp-cpo-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(15,23,42,0.08);
}

.sp-cpo-group:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.sp-cpo-header {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
}

.sp-more {
    text-align: center;
    font-size: 12px;
    color: #94a3b8;
    padding: 4px 0 2px;
    font-style: italic;
}

.leaflet-popup-content {
    margin: 0;
    max-width: 360px !important;
}

.leaflet-popup-content-wrapper {
    border-radius: 14px;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.18);
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(255, 255, 255, 0.98);
}

.leaflet-popup-tip {
    box-shadow: 0 12px 20px rgba(15, 23, 42, 0.12);
}


.leaflet-container a.leaflet-popup-close-button {
    font-size: 18px;
    top: 10px;
    right: 10px;
}

.leaflet-control-attribution {
    font-size: 12px;
    background: rgba(255, 255, 255, 0.9) !important;
    padding: 2px 6px !important;
    max-width: 95vw;
    white-space: normal;
}

@media (max-width: 768px) {
    .leaflet-control-attribution {
        font-size: 11px;
    }
}

@media (max-width: 768px) {
    body {
        flex-direction: column;
        height: 100vh;
        overflow: hidden;
    }

    nav {
        width: 100%;
        height: auto;
        max-height: 50vh;
        position: relative;
        padding: 16px 14px;
        overflow-y: auto;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    }

    nav > h1 {
        font-size: 1.1rem;
    }

    nav > h1::before {
        width: 36px;
        height: 36px;
    }

    nav > a {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        width: calc(50% - 10px);
        margin: 6px 5px;
    }

    .power-filter-buttons,
    .price-filter-buttons {
        flex-direction: row;
        gap: 10px;
    }

    .price-filter-btn,
    .power-filter-btn {
        flex: 1 1 calc(50% - 10px);
        min-width: 80px;
    }

    .app-footer {
        position: static;
        margin-top: 12px;
        flex-wrap: wrap;
    }

    main {
        width: 100%;
        height: calc(100vh - 50vh);
        flex: 1;
    }

    #map-cluster {
        position: absolute;
        inset: 0;
    }
}

.legal-page {
    max-width: 48rem;
    margin: 0 auto;
    padding: 2rem 1rem;
    line-height: 1.7;
    overflow: scroll;
}

.legal-page h1 {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.legal-page h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 0.5rem;
}

.legal-page ul {
    list-style-type: disc;
    padding-left: 1.5rem;
}

.legal-page a {
    color: #2563eb;
    text-decoration: underline;
}
