/* ==========================================================================
   NEXUS STREAM - CINEMATIC DESIGN SYSTEM
   ========================================================================== */

/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Montserrat:wght@400;600;700;800;900&display=swap');

:root {
    /* Color Palette Matrix */
    --bg-obsidian: #050505;
    --bg-surface: #121212;
    --bg-surface-elevated: #1e1e1e;
    --border-muted: #222222;
    --border-glow: #333333;

    --accent-crimson: #e50914;
    --accent-crimson-hover: #b80710;
    --accent-gold: #ffcc00;
    --accent-gold-hover: #cca300;

    --text-primary: #ffffff;
    --text-secondary: #aaaaaa;
    --text-muted: #666666;

    /* Premium Glassmorphism Tokens */
    --glass-bg: rgba(18, 18, 18, 0.75);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-blur: blur(16px);

    /* Shadows & Transitions */
    --shadow-premium: 0 12px 40px rgba(0, 0, 0, 0.7);
    --shadow-glow: 0 0 20px rgba(229, 9, 20, 0.25);
    --transition-curve: cubic-bezier(0.25, 0.8, 0.25, 1);
    --transition-speed: 0.4s;
}

/* ==========================================================================
   BASE & RESET
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    background-color: var(--bg-obsidian);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text-primary);
}

body {
    background-color: var(--bg-obsidian);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-obsidian);
}

::-webkit-scrollbar-thumb {
    background: var(--border-muted);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-crimson);
}

/* ==========================================================================
   GLASSMORPHIC NAVIGATION HIERARCHY
   ========================================================================== */
.navbar-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--glass-border);
    transition: background 0.3s ease;
}

.navbar {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand-token {
    font-family: 'Montserrat', sans-serif;
    font-weight: 900;
    font-size: 1.6rem;
    letter-spacing: 2px;
    background: linear-gradient(135deg, var(--accent-crimson) 0%, #ff4b4b 50%, var(--accent-gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-token::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    background-color: var(--accent-crimson);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent-crimson);
}

/* Dynamic Search Core */
.search-container {
    position: relative;
    flex: 0 1 400px;
}

.search-input-wrapper {
    position: relative;
    width: 100%;
}

#search-input {
    width: 100%;
    padding: 12px 20px 12px 48px;
    border-radius: 30px;
    border: 1px solid var(--border-muted);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s var(--transition-curve);
}

#search-input:focus {
    outline: none;
    border-color: var(--accent-crimson);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 15px rgba(229, 9, 20, 0.2);
}

.search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
    width: 18px;
    height: 18px;
    transition: color 0.3s ease;
}

#search-input:focus+.search-icon {
    color: var(--accent-crimson);
}

/* Category Quick Filters */
.filters-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-muted);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s var(--transition-curve);
    font-family: 'Inter', sans-serif;
}

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

.filter-btn.active {
    background: var(--accent-crimson);
    border-color: var(--accent-crimson);
    color: var(--text-primary);
    box-shadow: 0 0 15px rgba(229, 9, 20, 0.4);
}

/* Responsive Navbar Toggle Styles */
@media (max-width: 900px) {
    .navbar {
        flex-direction: column;
        padding: 16px;
        gap: 16px;
    }

    .search-container {
        width: 100%;
        flex: auto;
    }

    .filters-container {
        width: 100%;
        justify-content: center;
        overflow-x: auto;
        padding-bottom: 4px;
    }
}

/* ==========================================================================
   HERO SHOWCASE SECTION
   ========================================================================== */
.hero-wrapper {
    position: relative;
    width: 100%;
    margin-top: 72px;
    /* Compensate for fixed navbar */
}

#hero-showcase {
    position: relative;
    width: 100%;
    height: 70vh;
    min-height: 480px;
    max-height: 800px;
    background-size: cover;
    background-position: center 20%;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}

/* Hero Dark Vignette / Gradient Mask */
#hero-showcase::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom,
            rgba(5, 5, 5, 0.1) 0%,
            rgba(5, 5, 5, 0.6) 40%,
            rgba(5, 5, 5, 0.95) 85%,
            var(--bg-obsidian) 100%),
        linear-gradient(to right,
            rgba(5, 5, 5, 0.8) 0%,
            rgba(5, 5, 5, 0.4) 50%,
            rgba(5, 5, 5, 0.1) 100%);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    padding: 40px 60px;
    margin-bottom: 20px;
}

.hero-tagline {
    display: inline-block;
    color: var(--accent-gold);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 12px;
    animation: fadeIn 1s ease-out;
}

.hero-title {
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -1px;
    margin-bottom: 16px;
    text-shadow: 2px 2px 20px rgba(0, 0, 0, 0.8);
    animation: slideUp 0.8s var(--transition-curve);
}

.hero-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.meta-rating {
    background: var(--accent-gold);
    color: #000000;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
}

.meta-year,
.meta-genre {
    display: flex;
    align-items: center;
}

.hero-plot {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 28px;
    max-width: 650px;
    text-shadow: 1px 1px 10px rgba(0, 0, 0, 0.8);
}

/* Call-to-Action Premium Button */
.btn-cta {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: var(--accent-crimson);
    color: var(--text-primary);
    border: none;
    padding: 16px 36px;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: var(--shadow-glow);
    transition: all 0.3s var(--transition-curve);
}

.btn-cta:hover {
    background: var(--accent-crimson-hover);
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(229, 9, 20, 0.6);
}

.btn-cta svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

@media (max-width: 768px) {
    #hero-showcase {
        height: 60vh;
        padding-top: 100px;
    }

    .hero-content {
        padding: 20px 24px;
    }

    .hero-plot {
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
        margin-bottom: 16px;
    }
}

/* ==========================================================================
   DYNAMIC CONTENT MATRIX (MOVIE GRID)
   ========================================================================== */
.catalog-section {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px 60px 24px;
}

.section-header {
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    position: relative;
    padding-left: 16px;
}

.section-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 70%;
    background-color: var(--accent-crimson);
    border-radius: 4px;
}

#movie-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 24px;
    width: 100%;
}

/* ==========================================================================
   MICRO-INTERACTIONS & MOVIE CARD
   ========================================================================== */
.movie-card {
    position: relative;
    background: var(--bg-surface);
    border: 1px solid var(--border-muted);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transition: all var(--transition-speed) var(--transition-curve);
}

/* Dynamic Hover State */
.movie-card:hover {
    transform: translateY(-8px) scale(1.03);
    border-color: var(--border-glow);
    box-shadow: var(--shadow-premium);
}

.movie-poster-wrapper {
    position: relative;
    width: 100%;
    padding-top: 148%;
    /* Cinematic Poster Aspect Ratio 1:1.48 */
    overflow: hidden;
    background-color: #0b0b0b;
}

.movie-poster {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-speed) var(--transition-curve);
}

.movie-card:hover .movie-poster {
    transform: scale(1.08);
}

/* Advanced Hover Overlay & SVG Play Mask */
.movie-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 5, 5, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    z-index: 3;
    transition: opacity var(--transition-speed) var(--transition-curve);
    padding: 20px;
    text-align: center;
}

.movie-card:hover .movie-card-overlay {
    opacity: 1;
}

.play-symbol-wrapper {
    width: 64px;
    height: 64px;
    background: var(--accent-crimson);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    box-shadow: 0 0 20px var(--accent-crimson);
    transform: scale(0.7);
    opacity: 0;
    transition: all var(--transition-speed) var(--transition-curve);
}

.movie-card:hover .play-symbol-wrapper {
    transform: scale(1);
    opacity: 1;
}

.play-symbol-wrapper svg {
    width: 28px;
    height: 28px;
    fill: var(--text-primary);
    margin-left: 4px;
    /* Optical center centering */
}

.card-overlay-btn {
    background: transparent;
    color: var(--text-primary);
    border: 2px solid var(--text-primary);
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.card-overlay-btn:hover {
    background: var(--text-primary);
    color: #000;
}

/* Card Information Details */
.movie-details {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    z-index: 2;
    background: var(--bg-surface);
}

.movie-title {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-primary);
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    font-family: 'Montserrat', sans-serif;
    transition: color 0.3s ease;
}

.movie-card:hover .movie-title {
    color: var(--accent-crimson);
}

.movie-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.card-year {
    font-weight: 500;
}

.card-tag {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-muted);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   SANDBOXED GATEWAY OVERLAY MODAL
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 5, 5, 0.95);
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: opacity 0.5s var(--transition-curve);
    padding: 24px;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-container {
    position: relative;
    width: 100%;
    max-width: 960px;
    background: var(--bg-surface);
    border: 1px solid var(--border-muted);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
    transform: translateY(40px) scale(0.95);
    transition: all 0.5s var(--transition-curve);
}

.modal-overlay.active .modal-container {
    transform: translateY(0) scale(1);
}

/* Modal Title Header */
.modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.02);
}

.modal-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text-primary);
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border-radius: 50%;
}

.modal-close-btn:hover {
    color: var(--accent-crimson);
    background: rgba(255, 255, 255, 0.05);
}

.modal-close-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

/* Secure Fluid aspect-ratio Iframe container */
.iframe-aspect-ratio {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    /* 16:9 Standard widescreen */
    background: #000000;
}

.iframe-aspect-ratio iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Modal Ads Shield Warning Indicator */
.modal-shield-banner {
    background: rgba(229, 9, 20, 0.1);
    border-top: 1px solid rgba(229, 9, 20, 0.2);
    padding: 10px 24px;
    font-size: 0.8rem;
    color: var(--accent-gold);
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-shield-banner svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    flex-shrink: 0;
}

/* ==========================================================================
   FEEDBACK MESSAGES & STATE LOADERS
   ========================================================================== */
.state-container {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.05);
    border-top-color: var(--accent-crimson);
    border-radius: 50%;
    animation: spin 1s infinite linear;
    margin-bottom: 20px;
}

.state-message {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 500;
    max-width: 500px;
    margin: 0 auto;
}

/* ==========================================================================
   ANIMATIONS & MEDIA QUERIES
   ========================================================================== */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   MODAL PREVIEW LAYOUT (KASIH PREVIEW DULU)
   ========================================================================== */
.modal-body-preview {
    padding: 30px;
    background: var(--bg-surface);
}

.preview-layout {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.preview-poster {
    width: 200px;
    height: 296px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--border-muted);
    box-shadow: var(--shadow-premium);
    flex-shrink: 0;
}

.preview-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex-grow: 1;
}

.preview-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.preview-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.preview-plot {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
    max-height: 160px;
    overflow-y: auto;
    padding-right: 8px;
}

.gateway-action-container {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.gateway-notice {
    font-size: 0.75rem;
    color: var(--text-muted);
}

@media (max-width: 768px) {

    /* Navbar Mobile Refinements */
    .navbar {
        flex-direction: column;
        padding: 12px 16px;
        gap: 12px;
    }

    .brand-token {
        font-size: 1.35rem;
    }

    .search-container {
        width: 100%;
    }

    .filters-container {
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 4px 0 8px 0;
        gap: 8px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        /* Firefox */
    }

    .filters-container::-webkit-scrollbar {
        display: none;
        /* Safari/Chrome */
    }

    .filter-btn {
        padding: 6px 14px;
        font-size: 0.8rem;
        flex-shrink: 0;
        /* Prevent buttons from squishing */
    }

    /* Hero Widescreen Adaptations */
    #hero-showcase {
        height: 52vh;
        min-height: 380px;
    }

    .hero-content {
        padding: 16px 20px;
        margin-bottom: 10px;
    }

    .hero-tagline {
        font-size: 0.75rem;
        letter-spacing: 2px;
        margin-bottom: 6px;
    }

    .hero-title {
        font-size: 1.8rem;
        margin-bottom: 10px;
    }

    .hero-meta {
        font-size: 0.8rem;
        gap: 12px;
        margin-bottom: 12px;
    }

    .hero-plot {
        font-size: 0.85rem;
        line-height: 1.5;
        margin-bottom: 16px;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .btn-cta {
        padding: 12px 28px;
        font-size: 0.85rem;
    }

    /* Catalog Dynamic Header */
    .catalog-section {
        padding: 0 16px 40px 16px;
    }

    .section-header {
        margin-bottom: 20px;
    }

    .section-title {
        font-size: 1.4rem;
    }

    /* Elegant 2-Column Mobile Grid Pattern */
    #movie-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 14px;
    }

    .movie-card {
        border-radius: 8px;
    }

    .movie-details {
        padding: 12px;
    }

    .movie-title {
        font-size: 0.85rem;
        line-height: 1.25;
        margin-bottom: 6px;
    }

    .movie-meta-row {
        font-size: 0.75rem;
    }

    .card-tag {
        padding: 1px 6px;
        font-size: 0.7rem;
    }

    /* Premium Hover Overlay bypass for touch devices */
    .movie-card-overlay {
        display: none;
        /* Hide hover details overlay on mobile to allow direct clean tap action */
    }

    /* Modal Screen Responsive Upgrades */
    .modal-overlay {
        padding: 12px;
    }

    .modal-container {
        border-radius: 12px;
    }

    .modal-header {
        padding: 12px 16px;
    }

    .modal-title {
        font-size: 1.05rem;
    }

    .modal-body-preview {
        padding: 20px 16px;
    }

    .preview-layout {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 16px;
    }

    .preview-poster {
        width: 130px;
        height: 192px;
        border-radius: 8px;
    }

    .preview-info {
        gap: 10px;
        width: 100%;
    }

    .preview-title {
        font-size: 1.35rem;
    }

    .preview-meta {
        justify-content: center;
        font-size: 0.8rem;
        gap: 10px;
    }

    .preview-plot {
        font-size: 0.85rem;
        line-height: 1.5;
        max-height: 100px;
        padding-right: 0;
    }

    .gateway-action-container {
        align-items: center;
        width: 100%;
        margin-top: 6px;
    }

    .gateway-notice {
        font-size: 0.7rem;
        text-align: center;
    }
}

@media (max-width: 480px) {

    /* Super Compact Viewport Overrides (Tiny Mobile Phones) */
    .brand-token {
        font-size: 1.2rem;
    }

    #search-input {
        padding: 10px 16px 10px 40px;
        font-size: 0.85rem;
    }

    .search-icon {
        width: 16px;
        height: 16px;
        left: 14px;
    }

    #movie-grid {
        gap: 10px;
    }

    .movie-details {
        padding: 8px;
    }

    .movie-title {
        font-size: 0.8rem;
    }

    #hero-showcase {
        height: 48vh;
    }
}