:root {
    /**
        COLORS
    */
    --background: linear-gradient(90deg, hsla(220, 17%, 7%, 1) 20%, hsla(250, 13%, 11%, 1));
    --banner-background: hsla(250, 6%, 20%, 1);
    --white-alpha-20: hsla(0, 0%, 100%, 0.2);
    --on-background: hsla(220, 100%, 95%, 1);
    --on-surface: hsla(250, 100%, 95%, 1);
    --on-surface-variant: hsla(250, 1%, 44%, 1);
    --primary: hsla(349, 100%, 43%, 1);
    --primary-variant: hsla(349, 69%, 51%, 1);
    --rating-color: hsla(44, 100%, 49%, 1);
    --background-base: hsla(220, 17%, 7%, 1);

    --text-color: hsla(250, 2%, 59%, 1);
    --white: hsla(0, 0%, 100%, 1);

    /**
        GRADIENT COLOR
    */
    --banner-overlay: 90deg, hsla(220, 17%, 7%, 1) 7%, hsla(250, 13%, 11%, 0);
    --bottom-overlay: 180deg, hsla(250, 13%, 11%, 0) 90%, hsla(250, 13%, 11%, 1);
    --top-overlay: 0deg, hsla(250, 13%, 11%, 0) 95%, hsla(250, 13%, 11%, 1);

    /**
        TYPOGRAPHY
    */
    --ff-dm-sans: 'DM Sans', sans-serif;

    /* font size */
    --fs-heading: 4rem;
    --fs-title-lg: 2.6rem;
    --fs-title: 2rem;
    --fs-body: 1.8rem;
    --fs-button: 1.5rem;
    --fs-label: 1.4rem;

    /* font height */
    --weight-bold: 700;

    /**
        Shadows
    */
    --shadow-1: 0 1px 4px hsla(0, 0%, 0%, 0.75);
    --shadow-2: 0 4px 12px rgba(0, 0, 0, 0.4);

    /**
        Border radius
    */
    --radius-4: 4px;
    --radius-8: 8px;
    --radius-16: 16px;
    --radius-24: 24px;
    --radius-36: 36px;

    /**
        Transition
    */
    --transition-short: 250ms ease;
    --transition-long: 500ms ease;
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

li {
    list-style: none;
}

a, img, span, iframe, button {
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    height: auto;
}

input, button {
    background-color: none;
    border: none;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

input {
    width: 100%;
}

html {
    font-family: var(--ff-dm-sans);
    font-size: 10px;
    scroll-behavior: smooth;
}

body {
    background: var(--background);
    color: var(--on-background);
    font-size: var(--fs-body);
    line-height: 1.5;
    overflow: hidden;
}

iframe {
    width: 100%;
    height: 100%;
}

.background {
    background-color: var(--background);
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-thumb {
    background-color: var(--banner-background);
    border-radius: var(--radius-8);
}

header {
    height: 90px;
}

.logo {
    margin-top: 0px;
    margin-left: 8px;
}

/* ==========================================================================
   HEADER & SEARCH BAR
   ========================================================================== */

.search-box {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 5;
}

@media (min-width: 769px) {
    .search-box {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        width: min(540px, 46%);
    }
}

.search-wrapper {
    position: relative;
    flex-grow: 1;
}

.search-wrapper::before {
    position: absolute;
    top: 14px;
    right: 12px;
}

.search-wrapper .leading-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 12px;
    opacity: 0.5;
    transition: var(--transition-short);
}

.search-wrapper:focus-within .leading-icon {
    opacity: 0;
}

.search-field {
    width: 100%;
    height: 48px;
    line-height: 48px;
    padding-inline: 44px 16px;
    outline: none;
    border-radius: var(--radius-8);
    transition: var(--transition-short);
    background-color: #1b1b23;
    color: white;
}

.search-field::placeholder {
    color: var(--on-surface-variant);
}

.search-field:hover {
    box-shadow: 0 0 0 2px var(--on-surface-variant);
    cursor: text;
}

.search-field:focus {
    box-shadow: 0 0 0 2px var(--on-surface);
    padding-inline-start: 16px;
}

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

.header {
    position: relative;
    padding-inline: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.header .logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-inline-end: auto;
    text-decoration: none;
    color: var(--white);
    user-select: none;
}

.logo-icon {
    color: var(--primary);
    flex-shrink: 0;
    transition: transform var(--transition-short), color var(--transition-short), filter var(--transition-short);
}

.header .logo:hover .logo-icon {
    transform: rotate(-8deg) scale(1.08);
    color: var(--primary-variant);
    filter: drop-shadow(0 0 8px rgba(220, 14, 53, 0.6));
}

.logo-text {
    font-size: var(--fs-title);
    font-weight: var(--weight-bold);
    color: var(--white);
    letter-spacing: 0.5px;
    font-family: var(--ff-dm-sans);
    transition: color var(--transition-short);
}

.header .logo:hover .logo-text {
    color: var(--white);
}

.footer-logo .logo-icon {
    color: var(--primary);
}

.search-btn {
    background-color: var(--banner-background);
    border-radius: var(--radius-8);
    opacity: 0.5;
    transition: var(--transition-short);
    top: 50px;
    padding: 14px;
}

.search-btn:hover {
    opacity: 1;
}

/* ==========================================================================
   SIDEBAR
   ========================================================================== */

nav.side-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 77px;
    height: fit-content;
    align-self: flex-start;
    display: flex;
    flex-direction: column;
    padding: 25px 0px 10px 10px;
    text-align: center;
    z-index: 10;
}

.menu-item .icon {
    font-size: 25px;
}

.menu-item .txt-link {
    font-size: 11px;
    display: none;
}

.menu-item {
    height: 65px;
    transition: var(--transition-short);
    border-radius: var(--radius-8);
    align-items: center;
    margin-bottom: 10px;
}

.menu-item a {
    padding-top: 4px;
}

.menu-item:hover {
    background-color: var(--banner-background);
}

.menu-item:hover .txt-link {
    display: block;
}

li {
    list-style-type: none;
}

.base-list {
    display: block;
}

/* ==========================================================================
   REUSABLE PRIMITIVES & TYPOGRAPHY
   ========================================================================== */

.img-cover, .heading, .title-large {
    font-weight: var(--weight-bold);
    letter-spacing: 0.5px;
}

.img-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    margin-right: 0;
}

.title {
    font-size: var(--fs-title);
    letter-spacing: 0.5px;
}

.heading {
    color: var(--white);
    font-size: var(--fs-heading);
}

.title-large {
    font-size: var(--fs-title-lg);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-badge {
    background-color: var(--banner-background);
    color: var(--white);
    font-size: var(--fs-label);
    font-weight: var(--weight-bold);
    padding-inline: 6px;
    border-radius: var(--radius-4);
}

.btn {
    color: var(--white);
    font-size: var(--fs-button);
    font-weight: var(--weight-bold);
    max-width: max-content;
    display: flex;
    align-items: center;
    gap: 12px;
    padding-block: 12px;
    padding-inline: 20px 24px;
    border-radius: var(--radius-8);
    transition: var(--transition-short);
}

.container {
    flex: 1;
    background: var(--background);
    color: var(--on-surface);
    height: calc(100vh - 90px);
    overflow-y: overlay;
    z-index: 5;
    padding: 0 5px;
}

.list-box {
    width: 100%;
    height: calc(100vh - 90px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Espaçamento para o conteúdo nas páginas com side-bar */
.cont:not(:has(.genre-sidebar)):has(nav.side-bar) .container,
.cont:not(:has(.genre-sidebar)) nav.side-bar ~ .container,
.cont:not(:has(.genre-sidebar)) nav.side-bar ~ .list-box .container {
    padding-left: 87px;
}

.container::after {
    content: "";
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 150px;
    z-index: 1;
    pointer-events: none;
}

.poster-box {
    aspect-ratio: 2 / 3;
    background-repeat: no-repeat;
    background-size: 50px;
    background-position: center;
    background-color: var(--banner-background);
    border-radius: var(--radius-16);
    overflow: hidden;
}

.cont {
    display: flex;
    position: relative;
    gap: 20px;
}

.list {
    padding-block-start: 32px;
    padding-bottom: 45px;
}

.title-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-block-end: 24px;
    padding-right: 24px;
}

@media (max-width: 575px) {
    .title-wrapper {
        padding-right: 16px;
    }
}

.meta-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 12px;
    align-items: center;
}

/* ==========================================================================
   FORM CONTROLS & DROPDOWNS
   ========================================================================== */

.select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: var(--background-base);
    border-radius: var(--radius-8);
    width: fit-content;
    padding: 0 25px;
    height: 40px;
    font-family: var(--ff-dm-sans);
    margin-bottom: 20px;
    transition: var(--transition-short);
    color: var(--on-surface);
    background-image: url("data:image/svg+xml;utf8,<svg fill='white' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");
    background-repeat: no-repeat;
    background-position-x: 100%;
    background-position-y: 5px;
    padding-left: 10px;
    font-size: large;
    margin: 10px 20px 20px 1px;
}

select option,
.select option {
    background-color: var(--background-base);
    color: var(--white);
}

select option:disabled,
.select option:disabled {
    color: var(--on-surface-variant);
    opacity: 0.45;
}

.filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
    position: relative;
    height: fit-content;
}

/* ==========================================================================
   CARDS & SLIDERS
   ========================================================================== */

.grid-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    column-gap: 15px;
    row-gap: 20px;
}

.grid-list .movie-card {
    min-width: 0;
    width: 100%;
}

.slider-list {
    position: relative;
}

.slider-list i {
    font-size: 65px;
    position: absolute;
    cursor: pointer;
    z-index: 3;
}

.slider-list .left {
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: none;
}

.slider-list .right {
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: none;
}

.slider-list:hover i {
    display: block;
}

.slider-list i:hover {
    font-size: 75px;
    transition: var(--transition-short);
}

.slider-list .slider-inner {
    position: relative;
    overflow-x: hidden;
    margin-bottom: 65px;
    scroll-behavior: smooth;
    display: flex;
    gap: 20px;
}

.movie-card {
    min-width: 200px;
    width: 200px;
    display: flex;
    align-items: center;
}

.movie-card .card-banner {
    width: 100%;
}

.movie-card .card-banner:hover {
    border: 2px solid white;
    transition: 50ms;
}

.card-wrapper {
    display: flex;
    text-align: center;
    flex-direction: column;
    align-items: center;
}

.card-wrapper :is(.title) {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-wrapper .title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    padding-top: 10px;
    font-size: 15px;
    line-height: 20px;
    display: -webkit-box;
    width: 96%;
    -webkit-line-clamp: 1;
}

/* ==========================================================================
   USER AUTH BUTTON & POPUP
   ========================================================================== */

.user-btn {
    background: none;
    border: none;
    cursor: pointer;
    margin-left: 0;
    padding: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: opacity var(--transition-short), transform var(--transition-short);
}

.user-btn:hover {
    opacity: 0.85;
    transform: scale(1.05);
}

.user-btn .icon {
    width: 42px;
    height: 42px;
    color: white;
}

#account-popup {
    position: absolute;
    top: 60px;
    right: 10px;
    color: white;
    background: var(--background-base);
    padding: 12px 14px;
    border-radius: var(--radius-8);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--white-alpha-10, rgba(255, 255, 255, 0.1));
    z-index: 999;
    min-width: 160px;
}

#account-popup p {
    font-size: 1.3rem;
    margin-bottom: 8px;
    text-align: center;
    color: var(--white);
    font-family: var(--ff-dm-sans);
    word-break: break-all;
}

.hidden {
    display: none;
}

#account-popup a {
    display: block;
    margin: 6px 0;
    border-radius: var(--radius-8);
    padding: 8px 12px;
    text-align: center;
    color: white;
    background-color: var(--primary);
    text-decoration: none;
    font-weight: var(--weight-bold);
    font-size: 1.3rem;
    transition: var(--transition-short), transform 0.2s ease, box-shadow 0.2s ease;
}

#account-popup a:hover {
    background-color: var(--primary-variant);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transform: translateY(-1px);
}

#account-popup a:active {
    background-color: var(--primary);
    transform: translateY(0);
}

/* ==========================================================================
   COMMON ACTIONS & PLAYLIST MODALS
   ========================================================================== */

.addBtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: var(--primary);
    color: var(--white);
    font-family: var(--ff-dm-sans);
    font-size: 1.4rem;
    font-weight: var(--weight-bold);
    letter-spacing: 0.3px;
    height: 42px;
    padding: 0 20px;
    border-radius: var(--radius-8);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    transition: var(--transition-short), transform 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
    margin: 10px 0 20px 0;
}

.addBtn:hover {
    background-color: var(--primary-variant);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}

.addBtn:active {
    background-color: var(--primary);
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.addBtn i {
    font-size: 1.6rem;
    line-height: 1;
}

.createLibrary,
.createPlaylist,
.auth-prompt-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.96);
    background: var(--background-base);
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    border-radius: 10px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 220ms ease, transform 220ms ease, visibility 220ms;
}

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 900;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 220ms ease;
}

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

.createLibrary.open,
.createPlaylist.open,
.auth-prompt-modal.open {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}

.modal-add-playlist {
    width: 380px;
    max-width: 90vw;
    padding: 24px;
    border-radius: var(--radius-16);
    background: var(--background-base);
    border: 1px solid var(--white-alpha-20);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

.modal-add-playlist .modal-title {
    font-size: 1.8rem;
    font-weight: var(--weight-bold);
    color: var(--white);
    letter-spacing: 0.5px;
}

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

.modal-add-playlist .close-modal-btn:hover {
    color: var(--white);
}

.modal-add-playlist form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

.modal-add-playlist .modal-label {
    font-size: 1.3rem;
    color: var(--text-color);
    display: block;
    margin-bottom: 6px;
}

.modal-add-playlist .select,
.modal-add-playlist input.search-field {
    width: 100%;
    height: 48px;
    margin-bottom: 0;
    padding: 0 16px;
    border: 1px solid var(--white-alpha-20);
    border-radius: var(--radius-8);
    color: var(--white);
    background-color: var(--background-base);
    line-height: 48px;
    font-size: 1.4rem;
}

.modal-add-playlist .select {
    background-position: right 14px center;
    cursor: pointer;
}

.modal-add-playlist .select option {
    background-color: var(--background-base);
    color: var(--white);
    padding: 10px 16px;
}

.modal-add-playlist input.search-field:focus,
.modal-add-playlist .select:focus {
    box-shadow: 0 0 0 2px var(--on-surface);
}

.modal-add-playlist form .search-btn {
    width: 100%;
    height: 48px;
    top: auto;
    background-color: var(--banner-background);
    border-radius: var(--radius-8);
    opacity: 0.6;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-short);
    padding: 0;
    border: none;
}

.modal-add-playlist form .search-btn:hover {
    opacity: 1;
}

.modal-add-playlist form .search-btn i {
    font-size: 22px;
    color: var(--white);
    line-height: 1;
    margin: 0;
    padding: 0;
}

/* ==========================================================================
   FOOTER (Copyright, Navigation & TMDB Legal Attribution)
   ========================================================================== */

.footer {
    position: relative;
    z-index: 2;
    width: 100%;
    margin-top: auto;
    padding: 40px 24px 50px;
    border-top: 1px solid var(--white-alpha-20);
    background: transparent;
    color: var(--text-color);
    font-size: var(--fs-label);
    flex-shrink: 0;
}

.cont:not(:has(.genre-sidebar)):has(nav.side-bar) .footer,
.cont:not(:has(.genre-sidebar)) nav.side-bar ~ .container .footer,
.cont:not(:has(.genre-sidebar)) nav.side-bar ~ .list-box .footer {
    margin-left: -87px;
    width: calc(100% + 87px);
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 32px;
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 220px;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.footer-title {
    font-size: var(--fs-title);
    font-weight: var(--weight-bold);
    color: var(--white);
    letter-spacing: 0.5px;
}

.copyright-text {
    font-size: 1.25rem;
    line-height: 1.6;
    color: var(--text-color);
}

.author-name {
    color: var(--white);
    font-weight: var(--weight-bold);
}

.footer-nav {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.footer-heading {
    font-size: 1.4rem;
    font-weight: var(--weight-bold);
    color: var(--on-surface);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-links a {
    color: var(--text-color);
    font-size: 1.35rem;
    transition: var(--transition-short);
}

.footer-links a:hover {
    color: var(--primary-variant);
    transform: translateX(4px);
}

.footer-tmdb {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 320px;
}

.tmdb-logo {
    width: 110px;
    height: auto;
    display: block;
}

.tmdb-disclaimer {
    font-size: 1.2rem;
    line-height: 1.5;
    color: var(--text-color);
}

@media (max-width: 768px) {
    .footer {
        padding: 32px 16px 110px;
    }

    /* --------------------------------------------------------------------------
       BOTTOM NAVIGATION BAR (< 768px)
       -------------------------------------------------------------------------- */
    nav.side-bar {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 60px;
        padding: 0;
        background: var(--background-base);
        z-index: 999;
        border-top: 1px solid var(--white-alpha-20);
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-around;
    }

    nav.side-bar ul {
        display: flex;
        flex-direction: row;
        width: 100%;
        justify-content: space-around;
        align-items: center;
        padding: 0;
        margin: 0;
    }

    nav.side-bar .menu-item {
        height: auto;
        margin-bottom: 0;
        padding: 6px 16px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    nav.side-bar .menu-item a {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        padding-top: 0;
    }

    nav.side-bar .menu-item .txt-link {
        display: block !important;
        font-size: 1.1rem;
    }

    nav.side-bar .menu-item .icon {
        font-size: 20px;
        line-height: 1;
    }

    .cont:not(:has(.genre-sidebar)):has(nav.side-bar) .container,
    .cont:not(:has(.genre-sidebar)) nav.side-bar ~ .container,
    .cont:not(:has(.genre-sidebar)) nav.side-bar ~ .list-box .container {
        padding-left: 0;
        padding-bottom: 75px;
    }

    .cont:not(:has(.genre-sidebar)):has(nav.side-bar) .footer,
    .cont:not(:has(.genre-sidebar)) nav.side-bar ~ .container .footer,
    .cont:not(:has(.genre-sidebar)) nav.side-bar ~ .list-box .footer {
        margin-left: 0;
        width: 100%;
        padding-bottom: 85px;
    }

    .slider-list .slider-inner {
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
        -webkit-overflow-scrolling: touch;
    }

    .slider-list .slider-inner::-webkit-scrollbar {
        display: none;
    }

    .footer-container {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 28px;
    }

    .footer-logo {
        justify-content: center;
    }

    .footer-links {
        flex-direction: row;
        justify-content: center;
        gap: 20px;
    }

    .footer-links a:hover {
        transform: none;
    }

    .footer-tmdb {
        align-items: center;
    }

    /* --------------------------------------------------------------------------
       MOBILE HEADER & EXPANDABLE SEARCH (< 768px)
       -------------------------------------------------------------------------- */
    header {
        height: 68px;
    }

    .header {
        padding-inline: 16px;
        height: 68px;
        gap: 10px;
    }

    .header .logo {
        margin-inline-end: auto;
    }

    .header .logo-text {
        font-size: 1.8rem;
    }

    .search-box {
        position: static;
        left: auto;
        top: auto;
        transform: none;
        width: auto;
        height: auto;
        margin-left: 0;
        margin-right: 0;
    }

    .search-box .search-wrapper {
        display: none;
    }

    .search-box .search-btn {
        background-color: transparent;
        opacity: 0.85;
        padding: 6px;
        display: flex;
        align-items: center;
        justify-content: center;
        border: none;
        cursor: pointer;
    }

    .search-box .search-btn:hover {
        opacity: 1;
    }

    .user-btn {
        margin-left: 0;
        padding: 6px;
    }

    .search-box.active {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        transform: none;
        z-index: 100;
        background-color: var(--background-base);
        padding-inline: 16px;
        display: flex;
        align-items: center;
        gap: 10px;
        margin: 0;
    }

    .search-box.active .search-wrapper {
        display: flex;
        flex-grow: 1;
        position: relative;
    }

    .search-box.active .search-field {
        width: 100%;
        height: 42px;
        line-height: 42px;
        font-size: 1.4rem;
        padding-inline: 40px 14px;
    }

    .search-box.active .search-btn {
        background-color: var(--banner-background);
        padding: 9px 10px;
        border-radius: var(--radius-8);
        border: none;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .search-box.active .search-close-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        color: var(--white);
        font-size: 2.2rem;
        padding: 6px;
        cursor: pointer;
        flex-shrink: 0;
    }

    #account-popup {
        top: 60px;
        right: 12px;
    }
}

@media (max-width: 575px) {
    .header {
        padding-inline: 12px;
        gap: 10px;
    }

    .header .logo-text {
        font-size: 1.6rem;
    }

    .header .logo-icon {
        width: 26px;
        height: 26px;
    }

    .search-box {
        position: static;
        left: auto;
        transform: none;
        width: auto;
        height: auto;
        margin-left: 0;
        margin-right: 0;
    }

    .search-box.active {
        padding-inline: 12px;
        transform: none;
    }

    .search-box .search-btn {
        padding: 4px;
    }

    .user-btn {
        margin-left: 0;
        padding: 4px;
    }

    .user-btn .icon {
        width: 34px;
        height: 34px;
    }

    .slider-list .slider-inner {
        gap: 12px;
        margin-bottom: 36px;
    }

    .slider-inner .movie-card {
        min-width: 140px;
        width: 140px;
    }

    .slider-inner .movie-card .title {
        font-size: 1.3rem;
        line-height: 1.3;
    }

    .slider-list i {
        display: none !important;
    }
}

/* ==========================================================================
   LANGUAGE SWITCHER (i18n)
   ========================================================================== */
.lang-switcher {
    position: relative;
    display: inline-flex;
    align-items: center;
    z-index: 20;
}

.header .lang-switcher {
    margin-left: 0;
}

.movie-detail .lang-switcher {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 100;
}

.lang-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(27, 27, 35, 0.85);
    border: 1px solid var(--white-alpha-20);
    padding: 7px 12px;
    border-radius: var(--radius-8);
    color: var(--on-surface);
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background var(--transition-short), border-color var(--transition-short), transform var(--transition-short);
    user-select: none;
}

.lang-btn:hover,
.lang-btn:focus-visible {
    background: rgba(40, 40, 50, 0.95);
    border-color: var(--primary);
    color: var(--white);
    outline: none;
}

.lang-btn .bi-globe {
    font-size: 1.4rem;
    color: var(--primary);
}

.lang-arrow {
    font-size: 1.0rem;
    color: var(--text-color);
    transition: transform var(--transition-short);
}

.lang-btn[aria-expanded="true"] .lang-arrow {
    transform: rotate(180deg);
}

.lang-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #18171f;
    border: 1px solid var(--white-alpha-20);
    border-radius: var(--radius-8);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    min-width: 145px;
    padding: 6px;
    display: none;
    flex-direction: column;
    gap: 4px;
    z-index: 1000;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.lang-dropdown.show {
    display: flex;
    animation: fadeIn 0.15s ease forwards;
}

.lang-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-4);
    background: transparent;
    border: none;
    color: var(--on-surface);
    font-size: 1.3rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: background var(--transition-short), color var(--transition-short);
}

.lang-item:hover,
.lang-item:focus-visible {
    background: rgba(220, 14, 53, 0.15);
    color: var(--white);
    outline: none;
}

.lang-item.active {
    background: rgba(220, 14, 53, 0.25);
    color: var(--primary-variant);
    font-weight: 700;
}

.lang-flag {
    font-size: 1.5rem;
    line-height: 1;
}

@media (max-width: 575px) {
    .lang-btn {
        padding: 5px 8px;
        font-size: 1.2rem;
        gap: 4px;
    }
    .lang-btn .bi-globe {
        font-size: 1.2rem;
    }
}

/* ==========================================================================
   LOADING & SKELETON SCREENS (Best Practices)
   ========================================================================== */

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.04) 25%,
        rgba(255, 255, 255, 0.12) 50%,
        rgba(255, 255, 255, 0.04) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.8s infinite ease-in-out;
    border-radius: var(--radius-4);
    pointer-events: none;
    user-select: none;
}

@media (prefers-reduced-motion: reduce) {
    .skeleton {
        animation: skeleton-pulse 2s infinite ease-in-out;
        background: rgba(255, 255, 255, 0.06);
    }
    @keyframes skeleton-pulse {
        0%, 100% { opacity: 0.5; }
        50% { opacity: 0.9; }
    }
}

/* Movie Card Skeleton */
.movie-card.skeleton-card {
    pointer-events: none;
    user-select: none;
}

.skeleton-card .skeleton-poster {
    width: 100%;
    aspect-ratio: 2 / 3;
    border-radius: var(--radius-16);
    background-color: var(--banner-background);
}

.poster-box.skeleton,
.movie-poster.skeleton {
    border-radius: var(--radius-16) !important;
    overflow: hidden;
}

.skeleton-card .skeleton-title {
    height: 16px;
    width: 80%;
    margin-top: 10px;
    margin-bottom: 8px;
    border-radius: var(--radius-4);
}

.skeleton-card .skeleton-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.skeleton-card .skeleton-badge {
    height: 18px;
    width: 36px;
    border-radius: var(--radius-4);
}

.skeleton-card .skeleton-year {
    height: 14px;
    width: 42px;
    border-radius: var(--radius-4);
}

/* Hero Banner Skeleton */
.skeleton-banner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--banner-background);
    border-radius: var(--radius-24);
}

.skeleton-banner-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: var(--radius-24) !important;
}

.skeleton-banner .banner-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 580px;
    width: 100%;
    pointer-events: none;
}

.skeleton-banner-title {
    height: 40px;
    width: 75%;
    border-radius: var(--radius-8);
}

.skeleton-banner-meta {
    display: flex;
    gap: 12px;
}

.skeleton-banner-desc {
    height: 16px;
    width: 100%;
    border-radius: var(--radius-4);
}

.skeleton-banner-desc.short {
    width: 60%;
}

.skeleton-banner-btn {
    height: 44px;
    width: 150px;
    border-radius: var(--radius-8);
    margin-top: 8px;
}

@media (max-width: 768px) {
    .skeleton-banner,
    .skeleton-banner-backdrop {
        border-radius: var(--radius-16) !important;
    }
    .skeleton-banner-title {
        height: 30px;
        width: 85%;
    }
}

/* Infinite Scroll Loader at bottom of grids */
.grid-pagination-loader {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 32px 16px;
    color: var(--on-surface-variant);
    font-size: 1.4rem;
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.12);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .loading-spinner {
        animation-duration: 2s;
    }
}

