/* 
 * OASIS RP - WEBMAP STYLES
 * Modern, Dark Theme, Glassmorphism
 */

:root {
    /* Color Palette */
    --bg-dark: #0f172a;
    --bg-darker: #020617;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;

    /* Glassmorphism settings */
    --glass-bg: rgba(15, 23, 42, 0.65);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-blur: 12px;

    /* UI Dimensions */
    --sidebar-width: 320px;
    --transition-speed: 0.3s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    background-color: var(--bg-darker);
    overflow: hidden;
    /* Prevent scrolling, map takes full screen */
}

/* --- MAP CONTAINER --- */
#map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    /* Below UI */
    background-color: var(--bg-darker);
    /* Map background color before tiles load */
}

/* Watermark Pattern for the Void */
#map::before {
    content: "";
    position: absolute;
    /* Machen wir die Fläche viel größer als den Bildschirm, damit beim Drehen keine Ecken fehlen */
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    rotate: 10deg;
    z-index: -1;
    /* Behind map tiles */
    background-image: url('../Logo mit Shadow.png');
    background-repeat: repeat;
    background-size: 50px;
    /* Adjust logo size */
    opacity: 0.15;
    /* Subtler watermark effect */
}

/* Customizing Leaflet Controls for Dark Theme */
.leaflet-control-zoom {
    border: 1px solid var(--glass-border) !important;
    border-radius: 8px !important;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5) !important;
}

.leaflet-control-zoom a {
    background-color: var(--glass-bg) !important;
    color: var(--text-main) !important;
    backdrop-filter: blur(var(--glass-blur)) !important;
    -webkit-backdrop-filter: blur(var(--glass-blur)) !important;
    border-bottom: 1px solid var(--glass-border) !important;
    transition: background-color 0.2s;
}

.leaflet-control-zoom a:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
}

/* --- UI OVERLAY --- */
#ui-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    /* Let clicks pass through to map */
    z-index: 1000;
    /* Above Map */
    display: flex;
}

/* --- SIDEBAR --- */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-right: 1px solid var(--glass-border);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
}

#sidebar {
    width: var(--sidebar-width);
    height: 100%;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    /* Re-enable clicks for sidebar */
    transition: transform var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
}

#sidebar.collapsed {
    transform: translateX(calc(-1 * var(--sidebar-width)));
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(90deg, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-header p {
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.sidebar-content h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

/* Scrollbar styling for sidebar */
.sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

/* --- FILTER ITEMS (Checkboxes) --- */
.filter-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.filter-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--glass-border);
}

.filter-item.active {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.filter-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.filter-name {
    font-weight: 500;
    font-size: 0.95rem;
}

/* Custom Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: #94a3b8;
    transition: .3s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--accent);
}

input:checked+.slider:before {
    transform: translateX(20px);
    background-color: #fff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

/* --- SIDEBAR TOGGLE BUTTON --- */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: flex-end;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

.icon-btn i {
    transition: transform var(--transition-speed);
}

#sidebar.collapsed .icon-btn i {
    transform: rotate(180deg);
}

#sidebar.collapsed .icon-btn {
    /* Move button outside the collapsed sidebar */
    position: absolute;
    right: -60px;
    bottom: 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}


/* --- MAP MARKERS (BLIPS) --- */
.custom-blip-marker {
    background: transparent;
    border: none;
}

.blip-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.8), inset 0 0 0 2px rgba(255, 255, 255, 0.2);
    font-size: 14px;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}

.blip-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3), inset 0 0 0 2px rgba(255, 255, 255, 0.5);
    z-index: 1000 !important;
}

/* Optional glow effect underneath marker */
.blip-glow {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    opacity: 0.5;
    filter: blur(4px);
    z-index: -1;
}

/* --- LEAFLET POPUP STYLES (Modern Overrides) --- */
.leaflet-popup-content-wrapper {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(var(--glass-blur)) !important;
    -webkit-backdrop-filter: blur(var(--glass-blur)) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 12px !important;
    color: var(--text-main) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5) !important;
    padding: 0 !important;
}

.leaflet-popup-tip {
    background: var(--glass-bg) !important;
    border-top: 1px solid var(--glass-border);
    border-left: 1px solid var(--glass-border);
    box-shadow: none !important;
}

.leaflet-popup-content {
    margin: 0 !important;
    width: 250px !important;
}

.popup-custom {
    padding: 16px;
}

.popup-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.popup-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.popup-title {
    font-weight: 600;
    font-size: 1.05rem;
    margin: 0;
    line-height: 1.2;
}

.popup-body {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.popup-footer {
    margin-top: 12px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.3);
    text-align: right;
    font-family: monospace;
}

.leaflet-popup-close-button {
    color: var(--text-muted) !important;
    padding: 8px 8px 0 0 !important;
    transition: color 0.2s;
}

.leaflet-popup-close-button:hover {
    color: #fff !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #sidebar {
        width: 100%;
        max-width: 350px;
    }

    #sidebar.collapsed .icon-btn {
        right: auto;
        left: 20px;
    }
}

/* --- LEGAL FOOTER --- */
#legal-footer {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 24px;
    border-radius: 50px;
    pointer-events: auto;
    /* Enable clicks */
    z-index: 1000;
}

.glass-panel-small {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

#legal-footer a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

#legal-footer a:hover {
    color: #fff;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

#legal-footer .separator {
    color: rgba(255, 255, 255, 0.15);
    font-size: 0.8rem;
}

/* --- EASTER EGG GAME --- */
#easter-egg-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-wrapper {
    position: relative;
    background: var(--bg-dark);
    padding: 20px;
    border-radius: 12px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
    width: 640px;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-family: monospace;
    color: #fff;
    font-size: 1.2rem;
}

.game-header h3 {
    margin: 0;
    color: var(--accent);
    letter-spacing: 2px;
}

#gameCanvas {
    background: #000;
    border-radius: 8px;
    display: block;
    margin: 0 auto;
    border: 1px inset rgba(255, 255, 255, 0.2);
    /* Retro CRT effect line */
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
}

.close-game-btn {
    position: absolute;
    top: -15px;
    right: -15px;
    background: var(--accent);
    color: #fff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    font-size: 1.2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s;
}

.close-game-btn:hover {
    transform: scale(1.1);
    background: #e11d48;
}

.game-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-family: monospace;
    font-weight: bold;
    font-size: 1.5rem;
    text-align: center;
    text-shadow: 2px 2px 0 #000;
    pointer-events: none;
}

.blink {
    animation: blinker 1s linear infinite;
}

@keyframes blinker {
    50% {
        opacity: 0;
    }
}

/* --- HIGHSCORE RGB EFFECTS --- */
.rgb-highscore-text {
    animation: rgb-text 2s linear infinite;
    font-size: 1.4rem !important;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    font-weight: 800;
}

@keyframes rgb-text {
    0% {
        color: #ff0000;
    }

    15% {
        color: #ff00ff;
    }

    33% {
        color: #0000ff;
    }

    49% {
        color: #00ffff;
    }

    67% {
        color: #00ff00;
    }

    84% {
        color: #ffff00;
    }

    100% {
        color: #ff0000;
    }
}

.rgb-highscore-box {
    animation: rgb-border 2s linear infinite;
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.5) !important;
}

@keyframes rgb-border {
    0% {
        border-color: #ff0000;
        box-shadow: 0 0 30px rgba(255, 0, 0, 0.5);
    }

    33% {
        border-color: #00ff00;
        box-shadow: 0 0 30px rgba(0, 255, 0, 0.5);
    }

    66% {
        border-color: #0000ff;
        box-shadow: 0 0 30px rgba(0, 0, 255, 0.5);
    }

    100% {
        border-color: #ff0000;
        box-shadow: 0 0 30px rgba(255, 0, 0, 0.5);
    }
}

/* --- SUBCATEGORIES UI --- */

.sub-categories-container {
    padding-left: 20px;
    margin-top: -5px;
    border-left: 2px solid rgba(255, 255, 255, 0.05);
    margin-left: 15px;

    /* Animation Properties */
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.35s ease-in-out, opacity 0.35s ease-in-out, margin-top 0.35s ease-in-out;
}

.sub-categories-container.expanded {
    max-height: 500px;
    /* Groß genug für alle möglichen Items, damit der slide-down smooth ist */
    opacity: 1;
    margin-top: 5px;
}

.sub-filter-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 2px;
}

.sub-filter-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.sub-cat-toggle {
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* --- LEAFLET MARKERCLUSTER CUSTOMIZATION --- */
.marker-cluster-small,
.marker-cluster-small div {
    background-color: rgba(255, 184, 76, 0.6) !important;
}

.marker-cluster-small div {
    background-color: rgba(255, 184, 76, 0.9) !important;
}

.marker-cluster-medium,
.marker-cluster-medium div {
    background-color: rgba(242, 102, 171, 0.6) !important;
}

.marker-cluster-medium div {
    background-color: rgba(242, 102, 171, 0.9) !important;
}

.marker-cluster-large,
.marker-cluster-large div {
    background-color: rgba(164, 89, 209, 0.6) !important;
}

.marker-cluster-large div {
    background-color: rgba(164, 89, 209, 0.9) !important;
}

.marker-cluster {
    color: white !important;
    font-weight: bold;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* --- WELCOME MODAL --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    /* Ganz oben drüber */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    width: 90%;
    max-width: 500px;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    transform: translateY(20px) scale(0.95);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .modal-content {
    transform: translateY(0) scale(1);
}

.modal-header h2 {
    font-size: 1.8rem;
    margin-bottom: 15px;
    font-weight: 700;
}

.modal-body {
    line-height: 1.6;
    color: var(--text-main);
    margin-bottom: 25px;
    font-size: 1.05rem;
}

.modal-body p {
    margin-bottom: 12px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
}

.oasis-btn {
    background-color: var(--accent);
    color: white;
    border: none;
    padding: 10px 24px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
    font-family: 'Inter', sans-serif;
}

.oasis-btn:hover {
    background-color: #e6a645;
    transform: translateY(-2px);
}