:root {
    --primary-color: #e50914;
    --primary-hover: #ff0f1a;
    --bg-color: #050505; 
    --surface-color: #141414; 
    --surface-hover: #262626;
    --text-color: #ffffff;
    --text-muted: #a3a3a3;
    --border-color: rgba(255, 255, 255, 0.1);
    --glass-bg: rgba(10, 10, 10, 0.85);
}


* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-color); }
::-webkit-scrollbar-thumb { background: #333; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-color); }

.container { max-width: 1280px; margin: 0 auto; padding: 0 20px; }


header {
    position: fixed;
    top: 0; left: 0; width: 100%;
    z-index: 1000;
    background-color: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.header-main-container { display: flex; flex-direction: column; }


.header-top-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
    position: relative; z-index: 10;
}

h1 { font-size: 32px; font-weight: 800; letter-spacing: -1px; margin: 0; text-transform: uppercase;}
h1 span { color: var(--primary-color); }


.header-bottom-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 0;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative; z-index: 5;
}


header.hide-bottom-row .header-bottom-row {
    margin-top: -65px;
    transform: translateY(-15px);
    opacity: 0;
    pointer-events: none;
}

.nav-links-wrapper { display: flex; align-items: center; gap: 30px; }
.nav-links-wrapper .menu { display: flex; flex-direction: row; gap: 20px; }


.genre-menu, .country-menu, .year-menu { position: relative; }

.menu-title, .nav-home-btn {
    font-size: 15px; font-weight: 500; color: #e5e5e5;
    cursor: pointer; padding: 8px 12px; border-radius: 8px;
    transition: all 0.2s ease;
    background: transparent;
    border: none;
    font-family: inherit;
}
.menu-title:hover, .nav-home-btn:hover { color: #fff; background-color: var(--surface-hover); }


.genre-dropdown, .country-dropdown, .year-dropdown, .list-dropdown {
    position: absolute; top: calc(100% + 15px); left: 0;
    background: #18181b;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 15px; min-width: 320px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.8);
    display: none; 
    grid-template-columns: repeat(2, 1fr); gap: 8px;
    opacity: 0; animation: dropFade 0.3s forwards;
    
    
    max-height: 350px; 
    overflow-y: auto;
}


.genre-dropdown::-webkit-scrollbar, .country-dropdown::-webkit-scrollbar, .year-dropdown::-webkit-scrollbar, .list-dropdown::-webkit-scrollbar {
    width: 5px;
}
.genre-dropdown::-webkit-scrollbar-track, .country-dropdown::-webkit-scrollbar-track, .year-dropdown::-webkit-scrollbar-track, .list-dropdown::-webkit-scrollbar-track {
    background: transparent; 
}
.genre-dropdown::-webkit-scrollbar-thumb, .country-dropdown::-webkit-scrollbar-thumb, .year-dropdown::-webkit-scrollbar-thumb, .list-dropdown::-webkit-scrollbar-thumb {
    background: #444; border-radius: 10px;
}
.genre-dropdown::-webkit-scrollbar-thumb:hover, .country-dropdown::-webkit-scrollbar-thumb:hover, .year-dropdown::-webkit-scrollbar-thumb:hover, .list-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

@keyframes dropFade { to { opacity: 1; transform: translateY(-5px); } }

.genre-dropdown a, .country-dropdown a, .year-dropdown a, .list-dropdown a {
    color: var(--text-muted); text-decoration: none;
    padding: 8px 12px; border-radius: 8px; font-size: 14px;
    transition: 0.2s; background: transparent;
}
.genre-dropdown a:hover, .country-dropdown a:hover, .year-dropdown a:hover, .list-dropdown a:hover {
    background: var(--surface-hover); color: #fff; transform: translateX(5px);
}


.search-box { display: flex; align-items: center; gap: 10px; }
.search-box input {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 10px 20px; border-radius: 30px; color: #fff;
    width: 250px; font-size: 14px; outline: none; transition: 0.3s;
}
.search-box input:focus { background: rgba(255,255,255,0.15); border-color: #555; width: 280px; }
.search-box button {
    background: var(--primary-color); color: #fff;
    border: none; padding: 10px 24px; border-radius: 30px;
    font-weight: 600; cursor: pointer; transition: 0.3s; box-shadow: 0 4px 15px rgba(229, 9, 20, 0.3);
}
.search-box button:hover { background: var(--primary-hover); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(229, 9, 20, 0.5); }


main.container {
    min-height: 80vh;
    margin-top: 80px;
}


.filter-panel {
    background: var(--surface-color); border: 1px solid var(--border-color);
    padding: 20px; border-radius: 16px; margin: 15px 0 30px 0;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    animation: fadeIn 0.3s ease;
}
.filter-group { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 15px; }
.filter-group select {
    background: #0a0a0a; color: #fff; border: 1px solid #333;
    padding: 12px 15px; border-radius: 10px; font-size: 14px; outline: none; cursor: pointer;
}
.filter-group select:hover { border-color: #666; }


.btn-filter-primary { background: var(--primary-color); color: #fff; padding: 12px; border: none; border-radius: 10px; font-weight: bold; cursor: pointer; transition: 0.2s; }
.btn-filter-primary:hover { background: var(--primary-hover); }
.btn-filter-secondary { background: transparent; color: #fff; border: 1px solid #444; padding: 12px; border-radius: 10px; font-weight: bold; cursor: pointer; transition: 0.2s; }
.btn-filter-secondary:hover { background: #333; }


.movie-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 25px; margin-top: 10px;
}
.movie-card {
    background: transparent; cursor: pointer; position: relative;
    border-radius: 12px; transition: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.img-wrapper {
    position: relative; border-radius: 12px; overflow: hidden; aspect-ratio: 2/3;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.05);
}
.img-wrapper img {
    width: 100%; height: 100%; object-fit: cover; transition: 0.5s ease;
}

.img-wrapper::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(0deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 40%);
    opacity: 0.6; transition: 0.3s;
}
.movie-card:hover { transform: translateY(-8px); z-index: 10;}
.movie-card:hover .img-wrapper img { transform: scale(1.08); filter: brightness(1.1); }
.movie-card:hover .img-wrapper { box-shadow: 0 15px 30px rgba(0,0,0,0.8); border-color: rgba(255,255,255,0.15); }


.badge {
    position: absolute; top: 12px; left: 12px; z-index: 2;
    padding: 5px 10px; font-size: 11px; font-weight: 700; text-transform: uppercase;
    border-radius: 6px; box-shadow: 0 4px 10px rgba(0,0,0,0.5); backdrop-filter: blur(5px);
}

.movie-info { padding: 15px 5px 0 5px; }
.movie-info h3 {
    font-size: 16px; font-weight: 600; margin: 0 0 5px 0; color: #fff;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.movie-info p { font-size: 13px; color: var(--text-muted); margin: 0; font-weight: 500;}


.pagination-container { display: flex; justify-content: center; gap: 8px; margin: 14px 0; }
.pg-item {
    background: var(--surface-color); color: #fff; border: 1px solid #333;
    border-radius: 50%; width: 42px; height: 42px; font-size: 14px; font-weight: 600;
    display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s;
}
.pg-item:hover:not(:disabled):not(.ellipsis) { background: #333; border-color: #555; transform: translateY(-2px); }
.pg-item.active { background: var(--primary-color); border-color: var(--primary-color); box-shadow: 0 5px 15px rgba(229,9,20,0.4); }
.pg-item:disabled { opacity: 0.3; cursor: not-allowed; }
.pg-item.ellipsis { background: transparent; border: none; }



@media (max-width: 900px) {
    main.container { padding-top: 10px; } 
    .header-top-row { border-bottom: none; padding: 10px 0; }
    h1 { font-size: 26px; } 
    .menu-toggle { display: block; }
    
    .header-bottom-row {
        display: none; position: absolute; top: 100%; left: 0; width: 100%;
        background: rgba(10, 10, 10, 0.98); backdrop-filter: blur(25px);
        flex-direction: column; padding: 15px 20px 30px; border-top: 1px solid #222;
        box-shadow: 0 15px 30px rgba(0,0,0,0.9);
        max-height: 80vh; overflow-y: auto; 
    }
    .header-bottom-row.active { display: flex !important; animation: slideDown 0.3s ease; }
    @keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

    .nav-links-wrapper, .nav-links-wrapper .menu, .search-box { flex-direction: column; width: 100%; gap: 12px; }
    .search-box input { width: 100% !important; padding: 12px 20px; font-size: 15px; }
    .search-box button { width: 100%; padding: 12px; font-size: 15px; }
    
    .menu-title, .nav-home-btn { 
        background: #1a1a1a; padding: 12px; text-align: center; 
        font-size: 15px; border-radius: 10px; width: 100%; 
    }
    
    .genre-dropdown, .country-dropdown, .year-dropdown, .list-dropdown {
        position: static; box-shadow: none; border: none; padding: 10px 0; 
        background: transparent; max-height: max-content; 
    }
    
    
    .genre-dropdown[style*="grid"], .country-dropdown[style*="grid"], .year-dropdown[style*="grid"], .list-dropdown[style*="grid"] {
        grid-template-columns: repeat(3, 1fr) !important; gap: 8px;
    }
    .genre-dropdown a, .country-dropdown a, .year-dropdown a, .list-dropdown a {
        background: #222; padding: 8px 5px; text-align: center; font-size: 13px; border-radius: 6px;
    }

    .filter-group { display: flex; flex-direction: column; }
    .filter-group select, .filter-group button { width: 100%; }
}


@media (max-width: 600px) {
    main.container { padding-left: 10px; padding-right: 10px; }

    
    .movie-grid { 
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important; 
        gap: 10px !important; 
    }
    
    
    .genre-dropdown[style*="grid"], .country-dropdown[style*="grid"], .year-dropdown[style*="grid"], .list-dropdown[style*="grid"] {
        grid-template-columns: repeat(2, 1fr) !important; 
    }
    
    .movie-info { padding: 10px 5px 0 5px; }
    .movie-info h3 { font-size: 13px; }
    .movie-info p { font-size: 11px; }
    .badge { padding: 3px 6px; font-size: 10px; top: 8px; left: 8px; }
    
    
    .pagination-container { flex-wrap: wrap; justify-content: center; gap: 5px; }
    .pg-item { width: 32px; height: 32px; font-size: 13px; margin: 2px; }

    #authModal > div, #movieOptionModal > div, #logoutConfirmModal > div { 
        width: 90% !important; padding: 25px 20px !important; 
    }
}


.menu-toggle {
    display: none !important;
}


@media (max-width: 900px) {
    .menu-toggle {
        display: block !important;
        cursor: pointer;
    }
}

* {
    -webkit-touch-callout: none; 
    -webkit-user-select: none;   
    user-select: none;
    -webkit-tap-highlight-color: transparent; 
    -webkit-text-size-adjust: 100%; 
}

input, textarea, select {
    -webkit-user-select: auto !important;
    user-select: auto !important;
}

input, textarea, select {
    font-size: 16px !important; 
}

html, body {
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overscroll-behavior-y: none; 
    overscroll-behavior-x: none;
    -webkit-overflow-scrolling: touch; 
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}


::-webkit-scrollbar {
    display: none; 
}
* {
    -ms-overflow-style: none;  
    scrollbar-width: none;  
}


body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

    
        #indexHero.index-hero { 
            position: relative !important;
            width: 96% !important; 
            max-width: 1400px !important; 
            
            margin: 160px auto 40px auto !important; 
            height: 75vh !important; 
            min-height: 500px !important; 
            max-height: 750px !important; 
            background-size: cover !important; 
            background-position: center 20% !important; 
            background-repeat: no-repeat !important; 
            display: flex;
            align-items: center !important; 
            background-color: #000 !important; 
            border-radius: 16px !important; 
            overflow: hidden !important; 
            box-shadow: 0 20px 50px rgba(0,0,0,0.8) !important; 
            z-index: 2 !important;
        }

        #indexHero .hero-overlay { 
            position: absolute !important; inset: 0 !important; 
            
            background: linear-gradient(to right, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.7) 45%, rgba(0,0,0,0) 100%),
                        linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0) 35%) !important;
            z-index: 1 !important;
        }

        #indexHero .hero-content { position: relative !important; z-index: 2 !important; width: 100% !important; padding: 0 60px !important; display: flex !important; align-items: center !important; }
        #indexHero .hero-text-block { width: 100% !important; max-width: 650px !important; margin-top: 180px; }

        #indexHero .hero-title { 
            font-size: 2.45rem !important; 
            font-weight: 900 !important; 
            margin: 0 0 5px 0 !important; 
            color: #fff !important; 
            text-shadow: 2px 2px 8px rgba(0,0,0,0.9) !important; 
            line-height: 1.25 !important; 
            padding-top: 5px !important; 
            display: -webkit-box !important; 
            -webkit-line-clamp: 2 !important; 
            -webkit-box-orient: vertical !important; 
            overflow: visible !important; 
            text-transform: uppercase !important;
            letter-spacing: 0.5px !important; 
        }
        
        #indexHero .hero-origin-title { font-size: 1.1rem !important; font-weight: 500 !important; color: #b3b3b3 !important; margin: 0 0 15px 0 !important; text-shadow: 1px 1px 2px rgba(0,0,0,0.8) !important;}

        #indexHero .hero-tags, #indexHero .hero-genres { display: flex !important; gap: 8px !important; margin-bottom: 13px !important; flex-wrap: wrap !important; align-items: center !important; }
        #indexHero .hero-tag { border: 1px solid rgba(255, 255, 255, 0.3) !important; padding: 3px 10px !important; border-radius: 4px !important; font-size: 0.85rem !important; font-weight: 600 !important; color: #fff !important; background: rgba(0,0,0,0.5) !important; backdrop-filter: blur(2px) !important;}
        #indexHero .hero-tag.imdb { color: #fff !important; border-color: #e50914 !important; background: #e50914 !important; font-weight: bold !important; } 
        #indexHero .hero-genre { background: transparent !important; border-right: 1px solid #555 !important; padding-right: 10px !important; margin-right: 2px !important; font-size: 0.95rem !important; color: #e0e0e0 !important; font-weight: 500 !important;}
        #indexHero .hero-genre:last-child { border-right: none !important; margin-right: 0 !important; padding-right: 0 !important;}

        #indexHero .hero-desc { font-size: 1.05rem !important; color: #e5e5e5 !important; line-height: 1.6 !important; margin-bottom: 30px !important; margin-top: 10px !important; display: -webkit-box !important; -webkit-line-clamp: 3 !important; -webkit-box-orient: vertical !important; overflow: hidden !important; text-shadow: 1px 1px 4px rgba(0,0,0,0.9) !important;}

        #indexHero .hero-actions { display: flex !important; gap: 15px !important; align-items: center !important; }
        
        #indexHero .hero-play-btn { 
            display: flex !important; justify-content: center !important; align-items: center !important; gap: 10px !important;
            background: #e50914 !important; color: #fff !important; 
            padding: 12px 32px !important; border-radius: 6px !important; 
            font-size: 1.2rem !important; font-weight: bold !important; border: none !important; cursor: pointer !important; transition: 0.2s !important;
            box-shadow: 0 4px 15px rgba(229, 9, 20, 0.4) !important; text-decoration: none !important;
        }
        #indexHero .hero-play-btn:hover { background: #f40612 !important; transform: scale(1.05) !important; box-shadow: 0 6px 20px rgba(229, 9, 20, 0.6) !important;}
        #indexHero .hero-play-btn svg { width: 26px !important; height: 26px !important; fill: #fff !important; }
        
        #indexHero .hero-icon-btn { 
            display: flex !important; justify-content: center !important; align-items: center !important;
            width: 50px !important; height: 50px !important; border-radius: 50% !important;
            background: rgba(30,30,30,0.6) !important; border: 2px solid rgba(255,255,255,0.3) !important; color: #fff !important; cursor: pointer !important; transition: 0.2s !important; backdrop-filter: blur(4px) !important;
        }
        #indexHero .hero-icon-btn:hover { background: rgba(255,255,255,0.2) !important; border-color: #fff !important; transform: scale(1.1) !important; }
        #indexHero .hero-icon-btn svg { width: 22px !important; height: 22px !important; }

        
        @media (max-width: 768px) {
            #indexHero.index-hero {
                width: 100vw !important; 
                max-width: 100vw !important;
                margin-left: calc(-50vw + 50%) !important; 
                margin-right: calc(-50vw + 50%) !important; 
                margin-top: 60px !important; 
                margin-bottom: 25px !important;
                border-radius: 0 !important; 
                height: 65vh !important; 
                min-height: 450px !important;
                align-items: flex-end !important; 
                padding-bottom: 30px !important;
            }
            
            #indexHero .hero-overlay {
                border-radius: 0 !important;
                
                background: linear-gradient(to top, rgba(0,0,0,1) 0%, rgba(0,0,0,0.6) 60%, rgba(0,0,0,0.1) 100%) !important;
            }
            
            #indexHero .hero-content { 
                padding: 0 20px !important; 
                display: flex !important;
                flex-direction: column !important;
                align-items: center !important; 
                text-align: center !important;
            }
            
            #indexHero .hero-title { 
                font-size: 1.8rem !important; 
                line-height: 1.2 !important; 
                margin-bottom: 8px !important;
            }
            
            #indexHero .hero-origin-title { font-size: 0.95rem !important; }
            #indexHero .hero-tags, #indexHero .hero-genres { justify-content: center !important; }
            #indexHero .hero-desc { font-size: 0.95rem !important; -webkit-line-clamp: 4 !important; margin-bottom: 20px !important; color: #ccc !important;}
            
            #indexHero .hero-actions { width: 100% !important; justify-content: center !important; }
            #indexHero .hero-play-btn { width: 100% !important; max-width: 280px !important; padding: 12px 0 !important; font-size: 1.1rem !important;}
            #indexHero .hero-icon-btn { width: 45px !important; height: 45px !important; }
        }


        @media (max-width: 768px) {
            
            html, body { overflow-x: hidden !important; width: 100vw !important; margin: 0; padding: 0; }
            
            
            .container { padding-left: 12px !important; padding-right: 12px !important; width: 100% !important; max-width: 100% !important; box-sizing: border-box !important; }
            
            
            
            h1 { font-size: 22px !important; margin-left: 0 !important; }

            
            .movie-grid {
                display: grid !important;
                grid-template-columns: repeat(2, 1fr) !important;
                gap: 12px !important;
                width: 100% !important;
            }
            .movie-card { width: 100% !important; margin: 0 !important; }
            
            
            .movie-info { padding: 8px 4px 0 4px !important; }
            .movie-info h3 { font-size: 13px !important; white-space: normal !important; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; text-overflow: clip !important; line-height: 1.3; }
            .movie-info p { font-size: 11px !important; }
            .badge { padding: 3px 6px !important; font-size: 10px !important; top: 6px !important; left: 6px !important; }

            
            .header-bottom-row { padding: 15px 15px !important; }
            .nav-links-wrapper { gap: 8px !important; }
            .menu-title, .nav-home-btn { padding: 10px !important; font-size: 14px !important; }
            
            
            
            
            .genre-dropdown[style*="grid"], .country-dropdown[style*="grid"], .list-dropdown[style*="grid"] {
                grid-template-columns: repeat(2, 1fr) !important; gap: 6px !important; padding: 8px !important;
                max-height: 250px !important; overflow-y: auto !important;
            }
            
            
            .year-dropdown[style*="grid"] {
                grid-template-columns: repeat(4, 1fr) !important; gap: 6px !important; padding: 8px !important;
                max-height: 200px !important; overflow-y: auto !important;
            }
            
            
            .genre-dropdown::-webkit-scrollbar, .country-dropdown::-webkit-scrollbar, .year-dropdown::-webkit-scrollbar, .list-dropdown::-webkit-scrollbar { width: 4px; }
            .genre-dropdown::-webkit-scrollbar-thumb, .country-dropdown::-webkit-scrollbar-thumb, .year-dropdown::-webkit-scrollbar-thumb, .list-dropdown::-webkit-scrollbar-thumb { background: #e50914; border-radius: 4px; }
            .search-box input { padding: 10px 15px !important; font-size: 14px !important; }
            .search-box button { padding: 10px !important; font-size: 14px !important; }
            
            
            #resultTitle { font-size: 18px !important; }
            #filterToggleBtn { padding: 6px 12px !important; font-size: 13px !important; }
        }