:root {
    --primary: #e50914;
    --bg-dark: #080808;
    --card-bg: #121212;
    --text-main: #ffffff;
    --text-dim: #a0a0a0;
    --glass: rgba(20, 20, 20, 0.8);
    --header-height: 70px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

/* --- Header & Navigation --- */
.header {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    background: var(--glass);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 15px 0;
    height: var(--header-height);
    display: flex;
    align-items: center;
}

.nav-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
    text-decoration: none;
    letter-spacing: -1px;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.desktop-search {
    flex: 1;
    max-width: 400px;
    margin: 0 20px;
}

.search-bar {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid transparent;
    padding: 8px 15px;
    border-radius: 20px;
    color: white;
    transition: 0.3s;
    outline: none;
}

.search-bar:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.15);
}

.nav-links {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-links a {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: var(--primary);
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
}

.mobile-search {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    display: none;
    width: 100%;
    padding: 15px 20px;
    background: rgba(20, 20, 20, 0.98);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 999;
}

.mobile-search.active {
    display: block;
}

.mobile-search input {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 15px;
    border-radius: 20px;
    color: white;
    outline: none;
    font-size: 16px;
}

.mobile-search input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.15);
}

/* --- Hero Section --- */
.hero {
    height: 60vh;
    min-height: 400px;
    background: linear-gradient(to bottom, rgba(8,8,8,0.3) 0%, rgba(8,8,8,1) 100%), 
                url('https://images.unsplash.com/photo-1626814026160-2237a95fc5a0?auto=format&fit=crop&q=80&w=2070') center/cover;
    display: flex;
    align-items: flex-end;
    padding: 40px;
    margin-top: var(--header-height);
}

.hero-content {
    max-width: 100%;
}

.hero-title {
    font-size: clamp(32px, 5vw, 64px);
    font-weight: 800;
    margin-bottom: 10px;
    line-height: 1.1;
}

.hero-description {
    color: var(--text-dim);
    max-width: 600px;
    margin-bottom: 20px;
    font-size: 16px;
}

/* --- Content Type Toggle --- */
.content-type-toggle {
    display: flex;
    gap: 10px;
    background: #1a1a1a;
    padding: 4px;
    border-radius: 25px;
    border: 1px solid #333;
}

.toggle-btn {
    padding: 8px 20px;
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

.toggle-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 15px rgba(229, 9, 20, 0.4);
}

.toggle-btn:hover:not(.active) {
    background: #2a2a2a;
    color: white;
}

/* --- Main Content --- */
.container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 40px;
}

.container.search-results {
    margin-top: 100px;
}

.container.with-hero {
    margin-top: 40px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.section-title {
    font-size: 32px;
    font-weight: 700;
}

/* --- Genre Filter Chips --- */
.filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.genre-chip {
    background: #1a1a1a;
    border: 1px solid #333;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s;
    white-space: nowrap;
}

.genre-chip:hover {
    background: #2a2a2a;
    border-color: var(--primary);
}

.genre-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(229, 9, 20, 0.4);
}

.genre-dropdown {
    position: relative;
    display: inline-block;
}

.genre-dropdown-btn {
    background: #1a1a1a;
    border: 1px solid #333;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.genre-dropdown-btn:hover {
    background: #2a2a2a;
}

.genre-dropdown-content {
    display: none;
    position: absolute;
    background: #1a1a1a;
    min-width: 200px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 8px 16px rgba(0,0,0,0.6);
    z-index: 100;
    border-radius: 8px;
    border: 1px solid #333;
    margin-top: 5px;
}

.genre-dropdown-content.show {
    display: block;
}

.genre-dropdown-content a {
    color: white;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    transition: 0.2s;
}

.genre-dropdown-content a:hover {
    background: #2a2a2a;
}

.genre-dropdown-content a.active {
    background: var(--primary);
}

/* Sort Dropdown */
.sort-dropdown {
    background: #1a1a1a;
    border: 1px solid #333;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
}

.sort-dropdown:hover {
    background: #2a2a2a;
}

/* --- Enhanced Movie/Series Cards --- */
.movie-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 25px;
}

.movie-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255,255,255,0.03);
    width: 100%;
    display: flex;
    flex-direction: column;
}

.movie-card:hover {
    transform: scale(1.05);
    z-index: 2;
    box-shadow: 0 20px 40px rgba(0,0,0,0.6);
    border-color: rgba(229, 9, 20, 0.5);
}

.movie-poster-container {
    position: relative;
    overflow: hidden;
    width: 100%;
}

.movie-card img {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    display: block;
    height: auto;
}

.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 10%, transparent 60%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 15px;
    opacity: 0.9;
}

.overlay-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* Content Type Badge */
.content-type-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(155, 89, 182, 0.9);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.content-type-badge.movie {
    background: rgba(52, 152, 219, 0.9);
}

.content-type-badge.series {
    background: rgba(155, 89, 182, 0.9);
}

.movie-info {
    padding: 12px;
}

.movie-title {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.3;
    min-height: 42px;
}

.movie-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.rating-badge {
    background: rgba(229, 9, 20, 0.9);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.genre-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    color: var(--text-dim);
}

.season-badge {
    display: inline-block;
    background: rgba(155, 89, 182, 0.2);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    color: #9b59b6;
    border: 1px solid rgba(155, 89, 182, 0.3);
}

/* --- Modern Pagination --- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 60px;
    flex-wrap: wrap;
}

.pagination a, .pagination span {
    padding: 12px 20px;
    background: #1a1a1a;
    border-radius: 8px;
    text-decoration: none;
    color: white;
    transition: 0.3s;
    min-width: 40px;
    text-align: center;
}

.pagination a:hover {
    background: #2a2a2a;
}

.pagination .active {
    background: var(--primary);
    box-shadow: 0 0 15px rgba(229, 9, 20, 0.4);
}

/* --- Footer --- */
.footer {
    background: #050505;
    padding: 80px 40px 40px;
    border-top: 1px solid #1a1a1a;
    margin-top: 60px;
}

.footer-content {
    max-width: 1440px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.footer-links {
    margin-top: 30px;
    display: flex;
    gap: 30px;
    color: var(--text-dim);
    flex-wrap: wrap;
}

.footer-links a {
    color: inherit;
    text-decoration: none;
}

/* No Results Message */
.no-results {
    text-align: center;
    padding: 100px 20px;
    color: var(--text-dim);
}

.no-results h3 {
    font-size: 24px;
    margin-bottom: 10px;
    color: var(--text-main);
}

/* Tablet Adjustments (768px - 1024px) */
@media (max-width: 1024px) {
    .nav-container {
        padding: 0 30px;
    }

    .container {
        padding: 30px;
    }

    .movie-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 20px;
    }

    .section-title {
        font-size: 28px;
    }
}

/* Mobile Adjustments (max-width: 768px) */
@media (max-width: 768px) {
    :root {
        --header-height: 60px;
    }

    .nav-container { 
        padding: 0 15px;
    }

    .logo {
        font-size: 18px;
    }

    .logo span:last-child {
        display: none;
    }
    
    .desktop-search,
    .nav-links a {
        display: none;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .hero { 
        height: 45vh;
        min-height: 280px;
        margin-top: var(--header-height);
        padding: 20px 15px;
    }
    
    .hero-title {
        font-size: 28px !important;
    }

    .hero-description {
        font-size: 14px;
        margin-bottom: 10px;
    }

    .container {
        padding: 20px 15px;
    }

    .container.search-results {
        margin-top: calc(var(--header-height) + 20px);
    }

    .container.with-hero {
        margin-top: 20px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .section-title {
        font-size: 22px;
        width: 100%;
    }
    
    .filters {
        width: 100%;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 5px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

            .filters::-webkit-scrollbar {
                display: none;
            }
            
            .genre-chip,
            .genre-dropdown,
            .sort-dropdown,
            .content-type-toggle {
                flex-shrink: 0;
            }

            .content-type-toggle {
                width: 100%;
            }

            .toggle-btn {
                flex: 1;
            }

            .genre-dropdown-btn,
            .sort-dropdown {
                padding: 6px 12px;
                font-size: 13px;
            }

            .genre-dropdown-content {
                position: fixed;
                left: 10px;
                right: 10px;
                width: auto;
                min-width: auto;
                max-width: calc(100vw - 20px);
            }
            
            .movie-grid { 
                display: grid;
                grid-template-columns: repeat(2, 1fr); 
                gap: 15px;
                width: 100%;
            }

            .movie-card {
                border-radius: 8px;
                width: 100%;
                min-width: 0;
                display: flex;
                flex-direction: column;
                height: 100%;
            }

            .movie-poster-container {
                width: 100%;
                flex-shrink: 0;
                position: relative;
            }

            .movie-card img {
                width: 100%;
                aspect-ratio: 2/3;
                object-fit: cover;
                height: auto;
                display: block;
            }

            .card-overlay {
                padding: 8px;
            }

            .overlay-content {
                display: flex;
                justify-content: space-between;
                align-items: center;
                width: 100%;
            }

            .rating-badge {
                font-size: 10px;
                padding: 3px 6px;
            }

            .content-type-badge {
                top: 8px;
                left: 8px;
                font-size: 9px;
                padding: 3px 8px;
            }

            .movie-info {
                padding: 8px;
                flex-grow: 0;
                display: flex;
                flex-direction: column;
                gap: 5px;
            }

            .movie-title {
                font-size: 13px;
                line-height: 1.2;
                margin-bottom: 0;
                overflow: hidden;
                text-overflow: ellipsis;
                display: -webkit-box;
                -webkit-line-clamp: 2;
                -webkit-box-orient: vertical;
                min-height: 32px;
            }

            .movie-meta {
                font-size: 11px !important;
            }

            .genre-badge,
            .season-badge {
                font-size: 9px;
                padding: 2px 5px;
            }
            
            .pagination {
                gap: 5px;
                margin-top: 40px;
            }
            
            .pagination a, .pagination span {
                padding: 8px 12px;
                font-size: 13px;
                min-width: 35px;
            }

            .footer {
                padding: 40px 20px 30px;
            }

            .footer-links {
                gap: 15px;
                font-size: 14px;
                justify-content: center;
            }
        }

        /* Small Mobile Adjustments (max-width: 480px) */
        @media (max-width: 480px) {
            .movie-grid {
                grid-template-columns: repeat(2, 1fr);
                gap: 12px;
            }

            .movie-card img {
                aspect-ratio: 2/3;
            }

            .movie-title {
                font-size: 13px;
            }

            .movie-info {
                padding: 8px;
            }

            .section-title {
                font-size: 20px;
            }
        }

        /* Scrollbar Styling */
        ::-webkit-scrollbar {
            width: 8px;
            height: 6px;
        }

        ::-webkit-scrollbar-track {
            background: #1a1a1a;
        }

        ::-webkit-scrollbar-thumb {
            background: #333;
            border-radius: 4px;
        }

        ::-webkit-scrollbar-thumb:hover {
            background: var(--primary);
        }