/*
Theme Name: Netflix Clone
Author: Vathana
Description: A dark-mode, streaming-focused custom theme with app-style layout.
Version: 2.3
*/

/* ==========================================
   BASE STYLES
========================================== */
body {
    background-color: #0b0b0c;
    color: #e5e5e5;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    overflow: hidden; 
}

/* ==========================================
   APP LAYOUT (Sidebar + Main)
========================================== */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

.app-sidebar {
    width: 250px;
    background-color: #050505;
    border-right: 1px solid #1c1c1f;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.brand-logo-container {
    padding: 22px 25px;
    height: 70px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
}

.brand-logo {
    color: #e50914; 
    font-size: 22px;
    font-weight: bold;
    text-decoration: none;
    letter-spacing: 1px;
}

.sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 10px 15px 30px 15px;
}

.sidebar-scroll::-webkit-scrollbar,
.page-content::-webkit-scrollbar {
    width: 6px;
}
.sidebar-scroll::-webkit-scrollbar-thumb,
.page-content::-webkit-scrollbar-thumb {
    background-color: #333;
    border-radius: 10px;
}
.sidebar-scroll::-webkit-scrollbar-track,
.page-content::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-section {
    margin-bottom: 30px;
}

.section-title {
    font-size: 0.75rem;
    color: #555;
    letter-spacing: 1.5px;
    margin-bottom: 15px;
    padding-left: 10px;
    text-transform: uppercase;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    color: #a3a3a3;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 8px;
    margin-bottom: 4px;
    transition: all 0.2s ease;
}

.sidebar-link:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.05);
}

.sidebar-link .icon {
    margin-right: 12px;
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
    display: inline-block;
}

.sidebar-link.active {
    background: linear-gradient(90deg, #fd516e 0%, #ff5d66 100%);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(253, 81, 110, 0.2);
}

/* ==========================================
   MAIN TOPBAR (Search & Filters)
========================================== */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Hidden by default on desktop */
.mobile-header {
    display: none; 
}

.app-topbar {
    height: 70px;
    display: flex;
    align-items: center;
    padding: 0 40px;
    background-color: #0b0b0c;
    border-bottom: 1px solid #1c1c1f;
    box-sizing: border-box;
    flex-shrink: 0; /* Added to desktop for structural safety */
}

.search-container {
    display: flex;
    align-items: center;
    background-color: #121214;
    border: 1px solid #222;
    border-radius: 8px;
    padding: 0 15px;
    height: 42px;
    width: 320px;
    transition: border 0.3s ease;
}

.search-container:focus-within {
    border-color: #444;
}

.search-icon {
    font-size: 0.9rem;
    opacity: 0.7;
}

.search-input {
    background: transparent;
    border: none;
    color: #fff;
    width: 100%;
    margin-left: 10px;
    outline: none;
    font-size: 0.9rem;
}

.filter-container {
    display: flex;
    gap: 15px;
    margin-left: auto;
}

.filter-dropdown {
    background-color: #121214;
    border: 1px solid #222;
    color: #e5e5e5;
    padding: 0 35px 0 15px;
    height: 42px;
    border-radius: 8px;
    outline: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
}

.filter-dropdown:hover {
    border-color: #444;
}

.filter-dropdown option {
    background-color: #121214;
    color: #e5e5e5;
}

/* ==========================================
   PAGE CONTENT & MOVIE GRID
========================================== */
.page-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px 40px;
}

.catalog-header {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
}

.catalog-title {
    font-size: 1.5rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
}

.catalog-count {
    background-color: #1a1a1c;
    color: #888;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-left: 15px;
    border: 1px solid #2a2a2c;
    font-family: monospace;
}

.movie-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.movie-card-link {
    text-decoration: none;
    color: inherit;
}

.movie-grid-card {
    background-color: #151517;
    border-radius: 8px;
    position: relative;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    border: 2px solid transparent;
    height: 100%;
}

.movie-grid-card:hover {
    border-color: #ff5d66; 
}

.card-badges {
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    display: flex;
    justify-content: space-between;
    z-index: 2;
}

.badge-year {
    background-color: #ff5d66;
    color: #fff;
    font-size: 0.75rem;
    padding: 3px 6px;
    border-radius: 4px;
    font-weight: 700;
}

.badge-rating {
    background-color: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 0.75rem;
    padding: 3px 6px;
    border-radius: 4px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 3px;
}

.star-icon {
    color: #f5c518;
    font-size: 0.85rem;
}

.card-image-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 150%;
    overflow: hidden;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
}

.card-image-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.movie-grid-card:hover .card-overlay {
    opacity: 1;
}

.play-button {
    background-color: #ff5d66;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    padding-left: 4px;
    box-shadow: 0 4px 15px rgba(255, 93, 102, 0.5);
    transform: scale(0.8);
    transition: transform 0.2s ease;
}

.movie-grid-card:hover .play-button {
    transform: scale(1);
}

.card-info {
    padding: 12px;
    flex-grow: 1;
    display: flex;
    align-items: center;
    background-color: #151517;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
}

.card-title {
    font-size: 0.9rem;
    margin: 0;
    font-weight: 600;
    color: #eee;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.pagination .page-numbers {
    background: #1a1a1c;
    color: #888;
    padding: 6px 12px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: 0.2s;
}

.pagination .page-numbers:hover,
.pagination .page-numbers.current {
    background: #ff5d66;
    color: #fff;
}

/* ==========================================
   SINGLE MOVIE PAGE
========================================== */
.single-movie-container {
    max-width: 1200px;
    margin: 0 auto;
    color: #fff;
    padding-bottom: 50px;
}

.movie-player-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    background: #000;
    margin-bottom: 30px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.movie-player-wrapper iframe,
.movie-player-wrapper .embedpress-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    border: none;
}

.movie-title {
    font-size: 2.5rem;
    margin-bottom: 15px;
    font-weight: 700;
}

.movie-meta {
    display: flex;
    gap: 15px;
    align-items: center;
    font-size: 1.1rem;
    color: #a3a3a3;
    margin-bottom: 15px;
}

.movie-meta .match-score {
    color: #46d369;
    font-weight: bold;
}

.movie-meta .age-rating {
    border: 1px solid #a3a3a3;
    padding: 2px 5px;
    font-size: 0.9rem;
    border-radius: 3px;
}

/* ==========================================
   MOBILE & TABLET RESPONSIVENESS
========================================== */
@media screen and (max-width: 768px) {
    
    .app-sidebar {
        display: none; 
    }

    .mobile-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 15px;
        background-color: #0b0b0c;
        border-bottom: 1px solid #1c1c1f;
    }
    
    .mobile-logo {
        color: #e50914;
        font-size: 20px;
        font-weight: bold;
        text-decoration: none;
        letter-spacing: 1px;
    }
    
    .mobile-filter-btn {
        background: #1a1a1c;
        color: #e5e5e5;
        border: 1px solid #2a2a2c;
        padding: 8px 14px;
        border-radius: 6px;
        font-size: 0.85rem;
        font-weight: bold;
        cursor: pointer;
        display: flex;
        align-items: center;
    }

    /* THE FIX: flex-shrink: 0 guarantees the container doesn't get crushed by Flexbox */
    .app-topbar {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
        background-color: #050505; 
        flex-shrink: 0; 
        
        /* Slide Animation Setup */
        max-height: 0;
        overflow: hidden;
        padding-top: 0;
        padding-bottom: 0;
        border-bottom: none;
        opacity: 0;
        transition: all 0.3s ease-in-out;
    }

    .app-topbar.is-expanded {
        max-height: 500px;
        padding: 15px;
        opacity: 1;
        border-bottom: 1px solid #1c1c1f;
    }

    .search-container {
        width: 100%;
        max-width: none;
        box-sizing: border-box;
    }

    .filter-container {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }

    .filter-dropdown {
        width: 100%;
        box-sizing: border-box;
    }

    .page-content {
        padding: 15px;
    }

    .movie-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 12px;
    }

    .catalog-title {
        font-size: 1.25rem;
    }

    .catalog-count {
        font-size: 0.7rem;
        padding: 3px 8px;
    }

    .movie-title {
        font-size: 1.5rem;
    }

    .movie-meta {
        flex-wrap: wrap;
        font-size: 0.95rem;
    }
}