:root {
    --bg-dark: #0a0a0f;
    --text-light: #ffffff;
    --text-muted: #a0a0a8;
    --accent: #ff3366;
    --accent-tv: #00f0ff;
    --accent-mixed: #ffcc33;
    --panel-bg: rgba(15, 15, 20, 0.75);
    --panel-border: rgba(255, 255, 255, 0.1);
    --font-primary: 'Outfit', sans-serif;
}

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

/* Filter Toggle Container */
.filter-toggle-container {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.glass-toggle {
    display: flex;
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 30px;
    border: 1px solid var(--panel-border);
    padding: 5px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.glass-toggle input[type="radio"] {
    display: none;
}

.glass-toggle label {
    padding: 8px 20px;
    cursor: pointer;
    border-radius: 25px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.glass-toggle label:hover {
    color: var(--text-light);
}

.glass-toggle input[type="radio"]:checked + label {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
}

.glass-toggle input[id="filter-movies"]:checked + label {
    color: var(--accent);
}

.glass-toggle input[id="filter-tv"]:checked + label {
    color: var(--accent-tv);
}

body,
html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-primary);
    background-color: var(--bg-dark);
    color: var(--text-light);
}

#app {
    position: relative;
    width: 100%;
    height: 100%;
}

#map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Customizing Mapbox popups and controls to be dark */
.mapboxgl-popup-content {
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    color: var(--text-light);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 15px;
    font-family: var(--font-primary);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    max-width: 280px;
}

.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip {
    border-top-color: var(--panel-bg);
}

.mapboxgl-popup-close-button {
    color: var(--text-muted);
    font-size: 1.2rem;
    padding: 5px 8px;
}

.mapboxgl-popup-close-button:hover {
    color: var(--accent);
    background: transparent;
}

/* Cluster Popup List */
.cluster-popup-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 5px;
    color: var(--accent-tv);
}

.cluster-popup-list {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.cluster-popup-list::-webkit-scrollbar {
    width: 4px;
}
.cluster-popup-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.cluster-list-item {
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cluster-list-item:hover {
    background: rgba(255, 51, 102, 0.2);
    color: white;
}

.item-icon-movie { color: var(--accent); }
.item-icon-tv { color: var(--accent-tv); }

/* Top Bar */
.top-bar {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 15px 25px;
    border-radius: 12px;
    border: 1px solid var(--panel-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    /* Let clicks pass through to map if needed */
}

.title-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 5px;
}

.app-logo {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(255, 51, 102, 0.5);
    animation: floatLogo 4s ease-in-out infinite;
}

@keyframes floatLogo {
    0% { transform: translateY(0px); box-shadow: 0 0 15px rgba(255, 51, 102, 0.5); }
    50% { transform: translateY(-4px); box-shadow: 0 0 25px rgba(0, 240, 255, 0.7); }
    100% { transform: translateY(0px); box-shadow: 0 0 15px rgba(255, 51, 102, 0.5); }
}

.top-bar h1 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 0; /* Reset margin since it's handled by container */
    background: linear-gradient(90deg, #ff3366, #ff9933);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.top-bar p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 3px;
}

.brand-link {
    display: inline-block;
    font-size: 0.75rem;
    color: #00ff88;
    text-decoration: none;
    opacity: 0.6;
    letter-spacing: 1px;
    font-weight: 300;
    transition: opacity 0.3s ease, color 0.3s ease;
}

.brand-link:hover {
    opacity: 1;
    color: #33ffaa;
    text-shadow: 0 0 8px rgba(0, 255, 136, 0.4);
}

/* Glassmorphism Panel */
.panel {
    position: absolute;
    top: 20px;
    bottom: 20px;
    right: 20px;
    width: 400px;
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    z-index: 20;
    display: flex;
    flex-direction: column;
    transform: translateX(0);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
    overflow: hidden;
}

.panel.hidden {
    transform: translateX(110%);
    opacity: 0;
    pointer-events: none;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.close-btn:hover {
    background: var(--accent);
}

#trailer-container {
    width: 100%;
    height: 225px;
    /* 16:9 aspect ratio for 400px width */
    background: #000;
    flex-shrink: 0;
}

#trailer-video {
    width: 100%;
    height: 100%;
    border: none;
}

.movie-details {
    padding: 25px;
    overflow-y: auto;
    flex-grow: 1;
}

/* Custom Scrollbar for details */
.movie-details::-webkit-scrollbar {
    width: 6px;
}

.movie-details::-webkit-scrollbar-track {
    background: transparent;
}

.movie-details::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

#movie-title {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 8px;
    line-height: 1.2;
}

.location-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    margin-bottom: 25px;
}

.flag {
    font-size: 1.2rem;
}

.metadata-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px 20px;
    margin-bottom: 20px;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.meta-item.full-width {
    grid-column: 1 / -1;
    margin-bottom: 15px;
}

.meta-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 600;
}

.meta-value {
    font-size: 0.95rem;
    font-weight: 400;
    line-height: 1.4;
}

.text-muted {
    color: #cccccc;
    font-size: 0.9rem;
    font-style: italic;
}

/* --- Controls Container & Buttons --- */
.controls-container {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.glass-btn {
    background: rgba(15, 15, 20, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 30px;
    padding: 14px 28px;
    color: #ffffff;
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.glass-btn:hover {
    background: rgba(255, 51, 102, 0.3);
    border-color: rgba(255, 51, 102, 0.6);
    box-shadow: 0 8px 32px rgba(255, 51, 102, 0.4);
    transform: translateY(-3px);
}

.glass-btn:active {
    transform: translateY(0);
}

/* --- Mobile Responsive Design (PWA) --- */
@media (max-width: 768px) {
    /* Adjust top bar */
    .top-bar {
        top: 10px;
        left: 10px;
        right: 10px;
        padding: 10px 15px;
        text-align: center;
    }
    .top-bar h1 {
        font-size: 1.4rem;
    }
    .top-bar p {
        display: none; /* Hide subtitle to save space */
    }

    /* Adjust filter toggle */
    .filter-toggle-container {
        top: 70px; /* Below top bar */
        width: 90%;
    }
    .glass-toggle {
        justify-content: center;
        flex-wrap: nowrap;
        padding: 3px;
    }
    .glass-toggle label {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    /* Move controls up slightly */
    .controls-container {
        bottom: 20px;
        width: 100%;
        padding: 0 10px;
        gap: 10px;
    }
    .glass-btn {
        padding: 10px 15px;
        font-size: 0.9rem;
        flex: 1; /* Stretch buttons */
        margin: 0 !important; /* Override inline styles */
    }

    /* Redesign Panel for Mobile (Drawer sliding up from bottom) */
    .panel {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 70vh; /* Cover bottom 70% */
        border-radius: 24px 24px 0 0;
        transform: translateY(0);
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
    }

    .panel.hidden {
        transform: translateY(110%);
        opacity: 0;
    }

    /* Move close button to be more accessible */
    .close-btn {
        top: 10px;
        right: 15px;
        background: rgba(255, 51, 102, 0.8);
    }

    /* Adjust trailer height */
    #trailer-container {
        height: 30vh;
        border-radius: 24px 24px 0 0;
        overflow: hidden;
    }

    .movie-details {
        padding: 15px;
    }
    
    .metadata-grid {
        grid-template-columns: 1fr; /* Stack vertically */
        gap: 10px;
    }
}

/* --- Mobile Landscape Orientation --- */
@media (max-width: 950px) and (orientation: landscape) {
    .panel {
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 100vh;
        border-radius: 0;
        transform: translateY(0);
        display: flex;
        flex-direction: row;
    }

    .panel.hidden {
        transform: translateY(110%);
    }

    #trailer-container {
        width: 50%;
        height: 100vh;
        border-radius: 0;
    }

    #trailer-video {
        width: 100%;
        height: 100%;
    }

    .movie-details {
        width: 50%;
        height: 100vh;
        padding: 20px;
        padding-top: 40px; /* Space for close btn */
        overflow-y: auto;
    }

    /* Move close button to top right of the whole panel, which is in the details section */
    .close-btn {
        top: 10px;
        right: 15px;
    }
    
    /* Adjust controls so they don't block the screen entirely */
    .controls-container {
        bottom: 10px;
    }
}