/* ============================================================
 * Cinematimes — features mới (sprint 2026-05-18):
 *   - Watchlist phim button
 *   - Filter page polish
 *   - Mobile bottom nav (PWA-style) + sheet + search overlay
 *
 * Static file, load qua <link> chuẩn trong _head.blade.php.
 * KHÔNG đụng vào main.min.css legacy.
 * ============================================================ */


/* ---------- Watchlist button (overlay trên card phim) ---------- */
.btn-watchlist {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    color: #4e5d78;
    border-radius: 50%;
    cursor: pointer;
    transition: transform .15s ease, color .15s ease, background-color .15s ease;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
}
.btn-watchlist:hover {
    transform: scale(1.1);
    color: #ed1c24;
}
.btn-watchlist.is-active {
    color: #ed1c24;
}
.btn-watchlist.is-active svg {
    fill: #ed1c24;
}
.btn-watchlist[disabled] {
    opacity: .6;
    cursor: wait;
}
.btn-watchlist--lg {
    width: 40px;
    height: 40px;
}


/* ---------- Filter page (/loc-phim) ---------- */
.filter-page {
    margin-top: 20px;
    margin-bottom: 40px;
}
.filter-page__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}
.filter-page__title {
    font-size: 22px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}
.filter-page__sort {
    display: flex;
    align-items: center;
    gap: 8px;
}
.filter-page__sort label {
    font-size: 13px;
    color: #6b7280;
    margin: 0;
}
.filter-page__sort select {
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    background: #fff;
}

.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 20px;
}
.filter-pills__label {
    font-size: 13px;
    color: #6b7280;
}
.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #1e57ff;
    color: #fff;
    font-size: 12px;
    text-decoration: none;
    transition: background-color .15s ease;
}
.filter-pill:hover {
    background: #0f3fc9;
    color: #fff;
}
.filter-pill--clear {
    background: #6b7280;
}
.filter-pill--clear:hover {
    background: #4b5563;
}

.filter-sidebar {
    background: #fff;
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .04);
    position: sticky;
    top: 86px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}
.filter-sidebar__title {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 14px;
    color: #1f2937;
}
.filter-sidebar__group {
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid #e5e7eb;
}
.filter-sidebar__group:last-of-type {
    border-bottom: none;
}
.filter-sidebar__group-label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    display: block;
}
.filter-sidebar__options {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
}
.filter-sidebar__option {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    padding: 4px 0;
    margin: 0;
}
.filter-sidebar__option input {
    margin: 0;
    cursor: pointer;
    accent-color: #1e57ff;
}
.filter-sidebar__select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    background: #fff;
    color: #374151;
}
.filter-sidebar__actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}
.filter-sidebar__btn {
    flex: 1;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    text-align: center;
    text-decoration: none;
    transition: background-color .15s ease, border-color .15s ease;
}
.filter-sidebar__btn--primary {
    background: #1e57ff;
    color: #fff;
}
.filter-sidebar__btn--primary:hover {
    background: #0f3fc9;
    color: #fff;
}
.filter-sidebar__btn--ghost {
    background: #fff;
    color: #4e5d78;
    border-color: #d1d5db;
}
.filter-sidebar__btn--ghost:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.filter-results-empty {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
    background: #fff;
    border-radius: 12px;
}
.filter-results-empty p {
    margin-bottom: 16px;
}


/* ---------- Pagination (custom, native href) ---------- */
.paginations-simple {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    align-items: center;
}
.paginations-simple__item > a,
.paginations-simple__item > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.paginations-simple__item > a:hover {
    background: #f1f6fd;
    border-color: #1e57ff;
    color: #1e57ff;
}
.paginations-simple__item--active > span {
    background: #1e57ff;
    border-color: #1e57ff;
    color: #fff;
}
.paginations-simple__item--disabled > span {
    background: #f9fafb;
    color: #9ca3af;
    cursor: not-allowed;
}

@media (max-width: 991.98px) {
    .filter-sidebar {
        position: static;
        max-height: none;
        margin-bottom: 16px;
    }
}


/* ---------- Watchlist page (/watchlist) ---------- */
.watchlist-page {
    margin-top: 20px;
    margin-bottom: 40px;
}
.watchlist-page__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.watchlist-empty {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}
.watchlist-empty p {
    margin-bottom: 16px;
}


/* ============================================================
   Sticky footer (mọi page) — fix footer bị hở khi content ngắn
   ============================================================ */
html, body {
    height: auto;
    min-height: 100vh;
}
body {
    display: flex;
    flex-direction: column;
}
body > .main {
    flex: 1 0 auto;
}
body > .footer {
    flex-shrink: 0;
}


/* ============================================================
   Mobile bottom navigation (PWA-style)
   Hiển thị < 1200px (cùng breakpoint với menu cũ).
   ============================================================ */
.bottom-nav,
.sheet,
.sheet-backdrop,
.mobile-search-overlay,
.header__mobile-search {
    display: none;
}

@media (max-width: 1199.98px) {
    /* Đẩy footer lên khỏi bottom nav (60px + safe-area + chút padding visible) */
    .footer {
        padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px) + 16px) !important;
    }

    /* --- Header mobile search icon --- */
    .header__mobile-search {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        margin-left: 8px;
        background: transparent;
        border: none;
        color: #4e5d78;
        cursor: pointer;
        padding: 0;
    }
    .header__mobile-search:hover {
        color: #1e57ff;
    }
    /* Ẩn form search desktop ở mobile */
    .header__actions .header__search,
    .header__actions #main-search-wrap {
        display: none !important;
    }

    /* --- Bottom nav bar --- */
    .bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 100;
        display: flex;
        align-items: stretch;
        justify-content: space-around;
        height: 60px;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background: #ffffff;
        border-top: 1px solid #e5e7eb;
        box-shadow: 0 -2px 12px rgba(0, 0, 0, .06);
    }
    .bottom-nav__item {
        flex: 1 1 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 6px 2px;
        background: transparent;
        border: none;
        color: #6b7280;
        font-size: 11px;
        text-decoration: none;
        cursor: pointer;
        transition: color .15s ease;
        position: relative;
    }
    .bottom-nav__item:hover,
    .bottom-nav__item:focus-visible {
        color: #1e57ff;
        outline: none;
    }
    .bottom-nav__item.is-active,
    .bottom-nav__item.is-active .bottom-nav__label {
        color: #1e57ff;
    }
    .bottom-nav__item.is-active::before {
        content: '';
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 28px;
        height: 3px;
        background: #1e57ff;
        border-radius: 0 0 3px 3px;
    }
    .bottom-nav__icon {
        width: 22px;
        height: 22px;
        display: block;
    }
    .bottom-nav__icon-wrap {
        position: relative;
        display: inline-flex;
    }
    .bottom-nav__badge {
        position: absolute;
        top: -4px;
        right: -8px;
        min-width: 16px;
        height: 16px;
        padding: 0 4px;
        background: #ef4444;
        color: #fff;
        border-radius: 999px;
        font-size: 10px;
        font-weight: 600;
        line-height: 16px;
        text-align: center;
    }
    .bottom-nav__label {
        font-size: 11px;
        line-height: 1.2;
        white-space: nowrap;
    }
    .bottom-nav__label.is-active-text {
        color: #1e57ff;
        font-weight: 600;
    }

    /* --- Sheet (bottom sheet trượt lên) --- */
    .sheet-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, .45);
        z-index: 110;
        opacity: 0;
        pointer-events: none;
        transition: opacity .25s ease;
    }
    .sheet-backdrop.is-active {
        opacity: 1;
        pointer-events: auto;
    }
    .sheet {
        display: block;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 120;
        background: #ffffff;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -8px 24px rgba(0, 0, 0, .15);
        transform: translateY(100%);
        transition: transform .3s cubic-bezier(.32, .72, 0, 1);
        max-height: 80vh;
        overflow-y: auto;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    .sheet.is-active {
        transform: translateY(0);
    }
    .sheet__handle {
        width: 40px;
        height: 4px;
        background: #d1d5db;
        border-radius: 999px;
        margin: 10px auto 4px;
    }
    .sheet__header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 20px;
        border-bottom: 1px solid #f3f4f6;
    }
    .sheet__title {
        margin: 0;
        font-size: 16px;
        font-weight: 600;
        color: #1f2937;
    }
    .sheet__close {
        background: transparent;
        border: none;
        font-size: 28px;
        line-height: 1;
        color: #6b7280;
        cursor: pointer;
        padding: 0 4px;
    }
    .sheet__close:hover {
        color: #1f2937;
    }
    .sheet__list {
        list-style: none;
        margin: 0;
        padding: 8px 0;
    }
    .sheet__list li {
        margin: 0;
    }
    .sheet__link {
        display: flex;
        align-items: center;
        gap: 14px;
        width: 100%;
        padding: 14px 20px;
        background: transparent;
        border: none;
        color: #1f2937;
        font-size: 15px;
        text-align: left;
        text-decoration: none;
        cursor: pointer;
        transition: background-color .15s ease;
    }
    .sheet__link:hover,
    .sheet__link:focus-visible {
        background: #f3f4f6;
        color: #1e57ff;
        outline: none;
    }
    .sheet__link-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 28px;
        font-size: 18px;
    }

    /* --- Mobile search overlay full-screen --- */
    .mobile-search-overlay {
        display: flex;
        position: fixed;
        inset: 0;
        z-index: 130;
        background: #ffffff;
        flex-direction: column;
        transform: translateY(-100%);
        transition: transform .25s ease;
    }
    .mobile-search-overlay.is-active {
        transform: translateY(0);
    }
    .mobile-search-overlay__form {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 14px;
        background: #f1f6fd;
        border-bottom: 1px solid #d6dee9;
    }
    .mobile-search-overlay__close {
        flex: 0 0 auto;
        width: 40px;
        height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: none;
        background: transparent;
        color: #4e5d78;
        cursor: pointer;
        border-radius: 999px;
    }
    .mobile-search-overlay__close:hover {
        background: rgba(0, 0, 0, .06);
        color: #1e57ff;
    }
    /* Input pill rounded full (giống phong cách header desktop .header__search input) */
    .mobile-search-overlay__input {
        flex: 1 1 auto;
        height: 44px;
        padding: 0 46px 0 20px;
        font-size: 15px;
        border: 1px solid #d6dee9;
        outline: none;
        background: #ffffff;
        color: #1f2937;
        border-radius: 999px;
        box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
    }
    .mobile-search-overlay__input:focus {
        border-color: #1e57ff;
        box-shadow: 0 0 0 3px rgba(30, 87, 255, .15);
    }
    .mobile-search-overlay__input::placeholder {
        color: #9ca3af;
    }
    /* Submit icon nằm overlay bên trong input pill */
    .mobile-search-overlay__input-wrap {
        position: relative;
        flex: 1 1 auto;
        display: flex;
        align-items: center;
    }
    .mobile-search-overlay__submit {
        position: absolute;
        right: 4px;
        top: 50%;
        transform: translateY(-50%);
        width: 36px;
        height: 36px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: none;
        background: transparent;
        color: #4e5d78;
        cursor: pointer;
        border-radius: 999px;
    }
    .mobile-search-overlay__submit:hover {
        background: #1e57ff;
        color: #ffffff;
    }

    /* Khoá scroll body khi sheet/overlay đang mở */
    body.is-sheet-open,
    body.is-search-open {
        overflow: hidden;
    }
}
