/* ==========================================================================
   EXPLORE / MOVIE LIST STYLES (movie-list.css)
   Genre sidebar, dynamic filters, responsive catalog grid adjustments
   ========================================================================== */

/* --------------------------------------------------------------------------
   GENRE SIDEBAR & BUTTONS
   -------------------------------------------------------------------------- */
/* Hide main side-bar on desktop (explore page uses genre-sidebar) */
@media (min-width: 769px) {
    nav.side-bar {
        display: none !important;
    }
}

.genre-bt {
    background-color: var(--background);
    color: var(--on-surface-variant);
}

.genre-bt:hover {
    color: var(--on-surface);
    transition: var(--transition-short);
}

.genre-bt-active {
    background-color: var(--background);
    color: var(--on-surface);
}

.genre-sidebar {
    width: 200px;
    min-width: 200px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 15px 0px 10px 35px;
    gap: 15px;
    height: 90vh;
    overflow-y: overlay;
    overflow-x: hidden;
    white-space: nowrap;
    opacity: 1;
    transform: translateX(0);
    transition: width 400ms cubic-bezier(0.4, 0, 0.2, 1),
                min-width 400ms cubic-bezier(0.4, 0, 0.2, 1),
                padding 400ms cubic-bezier(0.4, 0, 0.2, 1),
                opacity 300ms ease,
                transform 400ms cubic-bezier(0.4, 0, 0.2, 1),
                visibility 400ms;
}

.genre-sidebar.collapsed {
    width: 0;
    min-width: 0;
    padding-left: 0;
    padding-right: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-100%);
    visibility: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.close-genre-btn {
    display: none;
}

.genre-overlay {
    display: none;
}

.genre-toggle-btn {
    display: none;
}

/* --------------------------------------------------------------------------
   EXTRA COLLAPSIBLE FILTERS (Anime, Checkbox)
   -------------------------------------------------------------------------- */
.filter-extra {
    display: flex;
    align-items: center;
    overflow: hidden;
    opacity: 1;
    transform: translateX(0);
    transition: opacity 300ms ease,
                transform 300ms cubic-bezier(0.4, 0, 0.2, 1),
                visibility 300ms;
}

.filter-extra.collapsed {
    display: none;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-20px);
    visibility: hidden;
}

/* --------------------------------------------------------------------------
   LIST BOX CONTAINER
   -------------------------------------------------------------------------- */
.list-box {
    width: 100%;
    padding-left: 5px;
    padding-right: 20px;
    height: calc(100vh - 90px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@media (min-width: 769px) {
    .list-box.expanded {
        padding-left: 35px;
    }
}

.list-cont {
    height: 100vh;
    overflow-y: overlay;
}

/* Reset sidebar spacing on movie-list container so grid is never displaced */
.list-box .container,
.cont:has(nav.side-bar) .list-box .container,
nav.side-bar ~ .list-box .container {
    padding-left: 5px;
}

/* --------------------------------------------------------------------------
   CUSTOM CHECKBOX (Exclude animations)
   -------------------------------------------------------------------------- */
.checkAnimation input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkAnimation {
    display: flex;
    align-items: center;
}

.checkAnimation label {
    position: relative;
    padding-left: 30px;
    cursor: pointer;
    user-select: none;
}

.checkAnimation label::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: 2px solid #333;
    border-radius: 3px;
    background-color: var(--background);
    box-sizing: border-box;
}

.checkAnimation input[type="checkbox"]:checked + label::before {
    content: "\2714";
    font-size: 16px;
    color: #ffffff;
    text-align: center;
    line-height: 20px;
}

.genre-list .title-wrapper {
    margin-block-end: 56px;
}

.genre-list :is(.movie-card, .card-banner) {
    width: 100%;
}

/* ==========================================================================
   MOBILE & TABLET RESPONSIVE STYLES
   ========================================================================== */

/* Tablet & Mobile (< 768px) */
@media (max-width: 768px) {
    /* Off-canvas Genre Drawer */
    .genre-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        max-width: 82vw;
        height: 100vh;
        height: 100dvh;
        background-color: var(--background-base);
        z-index: 1001;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.8);
        border-right: 1px solid var(--white-alpha-20);
        padding: 24px 20px;
        transform: translateX(-100%);
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
        transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1),
                    opacity 250ms ease,
                    visibility 300ms;
    }

    .genre-sidebar.open {
        transform: translateX(0);
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
    }

    .genre-sidebar .sidebar-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 20px;
        padding-bottom: 12px;
        border-bottom: 1px solid var(--white-alpha-20);
    }

    .genre-sidebar .sidebar-header .title {
        font-size: 2rem;
        font-weight: var(--weight-bold);
        color: var(--white);
        margin: 0;
    }

    .close-genre-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        color: var(--text-color);
        font-size: 2.2rem;
        cursor: pointer;
        padding: 4px;
        border-radius: var(--radius-4);
        transition: color var(--transition-short);
    }

    .close-genre-btn:hover {
        color: var(--white);
    }

    /* Overlay */
    .genre-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.65);
        backdrop-filter: blur(2px);
        z-index: 1000;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 250ms ease, visibility 250ms;
    }

    .genre-overlay.visible {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    /* Genre Toggle Button in Filters */
    .genre-toggle-btn {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        background-color: var(--background-base);
        color: var(--white);
        border: 1px solid var(--white-alpha-20);
        border-radius: var(--radius-8);
        height: 40px;
        padding: 0 14px;
        font-family: var(--ff-dm-sans);
        font-size: 1.3rem;
        font-weight: var(--weight-bold);
        cursor: pointer;
        transition: var(--transition-short);
        white-space: nowrap;
        flex-shrink: 0;
    }

    .genre-toggle-btn:hover {
        border-color: var(--primary);
        color: var(--primary);
    }

    .genre-toggle-btn i {
        font-size: 1.4rem;
        color: var(--primary);
    }

    .genre-count-badge {
        background-color: var(--primary);
        color: var(--white);
        font-size: 1.1rem;
        font-weight: var(--weight-bold);
        min-width: 18px;
        height: 18px;
        border-radius: 9px;
        padding: 0 5px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
    }

    .genre-count-badge.hidden {
        display: none;
    }

    /* List Box & Filters on Mobile */
    .list-box,
    .list-box.expanded {
        padding-left: 16px;
        padding-right: 16px;
        height: calc(100vh - 128px);
        height: calc(100dvh - 128px);
    }

    .filter-extra.collapsed {
        display: none !important;
    }

    .container {
        height: calc(100vh - 128px);
        height: calc(100dvh - 128px);
        -webkit-overflow-scrolling: touch;
        padding-left: 0;
        padding-right: 0;
    }

    .filters {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        padding-top: 10px;
        padding-bottom: 12px;
        width: 100%;
    }

    .filters.trending,
    .filters:has(#sort option[value="trending"]:checked) {
        height: auto;
    }

    .filter-extra {
        display: contents;
    }

    .filter-extra.collapsed {
        display: none !important;
    }

    .filters select#type {
        order: 1;
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
    }

    .filters select#provider {
        order: 2;
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
    }

    .filters .genre-toggle-btn {
        order: 3;
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
        height: 38px;
        justify-content: center;
    }

    .filters select#sort {
        order: 4;
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
    }

    .filters .checkAnimation {
        order: 5;
        width: 100%;
        flex: 1 1 100%;
        padding: 4px 2px;
        font-size: 1.25rem;
    }

    .filters .select {
        margin: 0;
        height: 38px;
        font-size: 1.3rem;
        padding: 0 24px 0 10px;
        background-position-x: calc(100% - 6px);
        background-position-y: center;
    }

    .grid-list {
        grid-template-columns: repeat(3, 1fr);
        column-gap: 12px;
        row-gap: 18px;
        padding-bottom: 40px;
    }
}

/* Mobile Devices (< 575px) */
@media (max-width: 575px) {
    .list-box,
    .list-box.expanded {
        padding-left: 12px;
        padding-right: 12px;
    }

    .filters {
        padding-top: 8px;
        padding-bottom: 10px;
    }

    .filters .select {
        font-size: 1.2rem;
        padding: 0 22px 0 8px;
    }

    /* 2 columns layout on smartphones */
    .grid-list {
        grid-template-columns: repeat(2, 1fr);
        column-gap: 10px;
        row-gap: 16px;
        padding-bottom: 40px;
    }

    .card-wrapper .title {
        font-size: 1.3rem;
        line-height: 1.4;
        padding-top: 6px;
    }

    .card-badge {
        font-size: 1.1rem;
        padding-inline: 4px;
    }

    .meta-item .span {
        font-size: 1.2rem;
    }

    .meta-item img {
        width: 14px;
        height: 14px;
    }
}
