/* Mengatur ikon mana yang tampil berdasarkan tema */
[data-bs-theme="light"] .theme-icon-dark {
    display: none;
}

[data-bs-theme="light"] .theme-icon-light {
    display: inline-block;
}

[data-bs-theme="dark"] .theme-icon-light {
    display: none;
}

[data-bs-theme="dark"] .theme-icon-dark {
    display: inline-block;
}

/* =================================
   STYLING SLIDER SINEMATIK
   ================================= */

#heroCarousel {
    border-radius: 0.75rem;
    overflow: hidden;
    position: relative;
}

#heroCarousel .carousel-inner {
    border-radius: 0.75rem;
}

#heroCarousel .carousel-item {
    height: 450px;
    /* Atur tinggi slider */
    background-size: cover;
    background-position: center;
}

/* Indikator (titik-titik) di kanan atas */
#heroCarousel .carousel-indicators {
    top: 20px;
    right: 20px;
    left: auto;
    margin-left: 0;
    margin-right: 0;
    justify-content: flex-end;
}

#heroCarousel .carousel-indicators [data-bs-target] {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
}

#heroCarousel .carousel-indicators .active {
    background-color: #fff;
}

/* Overlay Konten di bagian bawah */
#heroCarousel .carousel-caption {
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2;
    padding: 1.5rem 2rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 100%);
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#heroCarousel .caption-content {
    max-width: 70%;
}

#heroCarousel .slider-title-v2 {
    font-weight: 700;
    font-size: 1.8rem;
    margin: 0;
    color: var(--bs-text-primary);
}

#heroCarousel .slider-synopsis-v2 {
    margin: 0.5rem 0 0 0;
    color: rgba(255, 255, 255, 0.8);
}

/* Tombol "Watch Now" */
.btn-watch-now {
    background-color: var(--bs-app-primary);
    color: var(--bs-text-primary);
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    /* Membuat tombol round */
    padding: 0.5rem 1.5rem;
    transition: background-color 0.3s ease;
}

.btn-watch-now:hover {
    background-color: var(--bs-app-secondary);
    color: var(--bs-text-secondary);
}

/* Badge VIP */
.vip-badge {
    position: absolute;
    top: 20px;
    left: 20px;
    background-color: #f0c14c;
    color: #111;
    padding: 5px 10px;
    font-weight: bold;
    font-size: 0.9em;
    border-radius: 4px;
}

/* Styling untuk garis pemisah di bawah judul slider */
.title-divider {
    height: 3px;
    /* Ketebalan garis */
    width: 80px;
    /* Lebar garis */
    background-color: var(--bs-primary);
    /* Menggunakan warna primer dari tema */
    margin-top: 1rem;
    margin-bottom: 1rem;
    border-radius: 2px;
}

/* BARU: Aturan untuk backdrop yang di-blur */
.carousel-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;

    /* PENTING: Efek blur dan gelap diterapkan di sini */
    filter: blur(10px) brightness(50%);

    /* Trik agar blur di tepi tidak terlihat aneh */
    transform: scale(1.2);
}

/* end of slider styles */

/* Style untuk setiap item di grid */
.product-item-image img {
    width: 100%;
    aspect-ratio: 2 / 3; /* Memaksa rasio aspek (lebar 2, tinggi 3) */
    object-fit: cover;   /* Memastikan gambar mengisi area tanpa gepeng */
    border-radius: 8px;
}

.product-grid-item {
    display: block;
    /* Agar seluruh area item bisa diklik */
    text-decoration: none;
    color: inherit;
    /* Mewarisi warna teks dari parent (theme-aware) */
    height: 100%;
    /* Penting untuk sejajar */
    transition: transform 0.2s ease-in-out;
    /* Efek hover halus */
    position: relative;
    /* Untuk penempatan badge */
}

.product-grid-item:hover {
    transform: translateY(-5px);
    /* Mengangkat sedikit saat di-hover */
    color: inherit;
    /* Pastikan warna tidak berubah saat hover */
}

/* Style untuk area gambar */
.product-grid-image {
    position: relative;
    margin-bottom: 0.75rem;
    /* Jarak antara gambar dan teks */
}

.product-grid-image img {
    width: 100%;
    aspect-ratio: 2 / 3;
    /* Ini KUNCI utama: menjaga rasio gambar tetap sama */
    object-fit: cover;
    /* Memastikan gambar mengisi area tanpa terdistorsi */
    border-radius: 8px;
    /* Sudut melengkung pada gambar */
}

/* Badge episode */
.episode-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: var(--bs-primary);
    /* Warna merah dari Bootstrap Primary */
    color: var(--bs-text-primary);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: bold;
    z-index: 10;
}

/* Style untuk area teks */
.product-grid-body {
    padding: 0 0.25rem;
    /* Sedikit padding horizontal jika perlu */
}

.product-grid-title,
.product-grid-subtitle {
    margin-bottom: 0;
    /* Ini adalah KUNCI kedua: membuat teks rapi dalam satu baris */
    white-space: nowrap;
    /* Mencegah teks turun baris */
    overflow: hidden;
    /* Menyembunyikan teks yang berlebih */
    text-overflow: ellipsis;
    /* Menambahkan "..." jika teks terpotong */
}

.product-grid-title {
    font-size: 1rem;
    /* Ukuran font judul */
    font-weight: 600;
    line-height: 1.3;
    /* Jarak antar baris jika ada dua baris judul */
    color: var(--bs-body-color);
    /* Warna teks utama, otomatis tema */
}

.product-grid-subtitle {
    font-size: 0.85rem;
    /* Ukuran font sub judul */
    color: var(--bs-secondary-color);
    /* Warna teks sekunder, otomatis tema */
    line-height: 1.3;
}

/* Wadah utama paginasi */
.pagination {
    --bs-pagination-focus-box-shadow: none;
    /* Hilangkan glow biru saat diklik */
    --bs-pagination-border-radius: 0.5rem;
    /* Atur lengkungan sudut */
    gap: 0.5rem;
    /* Jarak modern antar tombol */
}

/* Tombol halaman default (angka, prev/next) */
.pagination .page-link {
    border: none;
    /* Hilangkan border */
    background-color: var(--bs-tertiary-bg);
    /* Warna latar yang theme-aware */
    color: var(--bs-secondary-color);
    /* Warna teks yang theme-aware */
    font-weight: 600;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* Tombol saat di-hover atau fokus */
.pagination .page-link:hover,
.pagination .page-link:focus {
    background-color: var(--bs-secondary-bg);
    color: var(--bs-body-color);
}

/* Tombol halaman yang sedang aktif */
.pagination .page-item.active .page-link {
    background-color: var(--bs-primary);
    /* Gunakan warna primary dari tema */
    color: #fff;
    /* Teks putih */
}

/* Tombol yang dinonaktifkan */
.pagination .page-item.disabled .page-link {
    background-color: var(--bs-tertiary-bg);
    opacity: 0.6;
}

.breadcrumb-custom {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    /* Mencegah turun baris di mobile */
    overflow: hidden;
    /* Sembunyikan jika terlalu panjang */
    padding: 0;
    margin: 0;
    background-color: transparent;
    font-size: 0.9em;
}

/* Link yang bisa diklik */
.breadcrumb-custom a {
    text-decoration: none;
    font-weight: 500;
    color: var(--bs-secondary-color);
    white-space: nowrap;
    /* Mencegah teks link turun baris */
}

.breadcrumb-custom a:hover {
    color: var(--bs-primary);
}

/* Teks untuk halaman aktif */
.breadcrumb-custom .breadcrumb-active {
    color: var(--bs-body-color);
    font-weight: 600;
    /* Truncation untuk teks panjang di mobile */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Separator ">" */
.breadcrumb-custom .breadcrumb-separator {
    color: var(--bs-secondary-color);
    padding: 0 0.5rem;
}

.btn-theme-secondary {
    /* Menggunakan variabel warna Bootstrap */
    background-color: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
    border-color: var(--bs-border-color-translucent);
    font-weight: 500;
}

.btn-theme-secondary:hover {
    background-color: var(--bs-secondary-bg);
    border-color: var(--bs-border-color);
    color: var(--bs-body-color);
}

.btn-theme-secondary.disabled,
.btn-theme-secondary:disabled {
    background-color: var(--bs-tertiary-bg);
    border-color: var(--bs-border-color-translucent);
    opacity: 0.65;
}

/* =================================
   Styling untuk Fitur Turn Off Light
   ================================= */

#light-overlay {
    display: none;
    /* Sembunyi secara default */
    position: fixed;
    /* Tetap di posisi saat scroll */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    /* Warna hitam semi-transparan */
    z-index: 1040;
    /* Harus di bawah video tapi di atas konten lain */
}

/* Kelas ini akan ditambahkan ke <body> dengan JavaScript */
body.lights-off {
    /* Mencegah body bisa di-scroll saat lampu mati */
    overflow: hidden;
}

/* Saat lampu mati, naikkan posisi video player di atas overlay */
body.lights-off #video-player-container {
    position: relative;
    /* Diperlukan agar z-index berfungsi */
    z-index: 1041;
    /* Angka lebih tinggi dari z-index overlay */
    background: #000;
    /* Beri latar hitam solid di belakang video */
}

/* Saat lampu mati, naikkan juga posisi baris kontrol */
body.lights-off #turn-off-light-btn {
    position: relative;
    /* Diperlukan agar z-index berfungsi */
    z-index: 1041;
    /* Samakan dengan z-index video-container */
}


/* ===================================================
   Styling Sidebar Episode (Perbaikan Total)
   =================================================== */

/* Info Series di bagian atas sidebar (tetap sama) */
.series-info-header .series-thumb-circle {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 50%;
}

.series-info-header .series-title {
    font-size: 1rem;
    font-weight: 600;
}

/* Daftar Episode */
.episode-list {
    max-height: 500px;
    overflow-y: auto;
    margin-right: -1.25rem;
    padding-right: 1rem;
}

/* Setiap item di daftar episode (tag <a>) */
.episode-list .list-group-item {
    background-color: transparent;
    border-color: var(--bs-border-color-translucent) !important;
    min-height: 86px;
    /* KUNCI 1: Beri tinggi minimum (70px gambar + 16px padding) */
    padding-top: 8px !important;
    padding-bottom: 8px !important;
}

/* Thumbnail Episode */
.episode-item-thumb {
    position: relative;
    flex-shrink: 0;
    width: 120px;
    height: 70px;
    border-radius: 0.375rem;
    overflow: hidden;
}

.episode-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Ikon Play di atas thumbnail (tetap sama) */
.play-icon-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    border-radius: 0.375rem;
}

/* Info teks di samping thumbnail */
.episode-item-info {
    flex-grow: 1;
    min-width: 0;
    /* KUNCI 2: Izinkan elemen untuk menyusut */
}

.episode-item-info .episode-title,
.episode-item-info .episode-meta {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.episode-item-info .episode-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--bs-body-color);
    margin-bottom: 0;
}

.episode-item-info .episode-meta {
    font-size: 0.8rem;
    color: var(--bs-secondary-color);
}

/* Warna item yang aktif (tetap sama) */
.episode-list .list-group-item.active {
    background-color: var(--bs-secondary-bg);
}

.episode-list .list-group-item.active .episode-title {
    color: var(--bs-primary);
}

/* Kustomisasi Tampilan Accordion Download */
.accordion-button {
    background-color: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
    font-weight: 600;
}

.accordion-button:not(.collapsed) {
    background-color: var(--bs-primary);
    color: #fff;
}

/* Menghilangkan shadow biru saat tombol diklik */
.accordion-button:focus {
    box-shadow: none;
    border-color: var(--bs-border-color);
}

/* Mengganti warna ikon panah di dark mode */
[data-bs-theme="dark"] .accordion-button:not(.collapsed)::after {
    background-image: var(--bs-accordion-btn-active-icon);
}

/* ===================================================
   Styling Halaman Detail Series (Perbaikan Final)
   =================================================== */

/* Wadah baru untuk backdrop dan tombol play */
.backdrop-container {
    position: relative;
    /* Diperlukan agar tombol play bisa diposisikan */
    display: flex;
    justify-content: center;
    align-items: center;
}

.series-backdrop {
    height: 400px;
    width: 100%;
    background-size: cover;
    background-position: center;
    filter: blur(5px);
    transform: scale(1.05);
    overflow: hidden;
}

.backdrop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, var(--bs-body-bg) 10%, rgba(0, 0, 0, 0.5) 50%);
    z-index: 1;
}

/* Tombol play sekarang diposisikan secara absolut di tengah container */
.play-button-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background-color: rgba(33, 37, 41, 0.6);
    /* Latar gelap semi-transparan */
    border: 2px solid #fff;
    /* Border putih solid cocok di kedua tema */
    border-radius: 50%;
    color: #fff;
    /* Ikon putih solid cocok di kedua tema */
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    text-decoration: none;
    z-index: 2;
    /* Pastikan di atas overlay */
    transition: background-color 0.3s ease;
}

.play-button-overlay:hover {
    background-color: rgba(33, 37, 41, 0.8);
    color: #fff;
}

/* Wrapper untuk poster dan rating */
.series-poster-rating-wrapper {
    position: relative;
    z-index: 10;
    background-color: var(--bs-tertiary-bg);
    border-radius: var(--bs-border-radius);
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.series-poster-img {
    width: 100%;
    height: auto;
    display: block;
    /* PENTING: Border sekarang menggunakan warna latar body agar theme-aware */
    border: 4px solid var(--bs-body-bg);
    box-sizing: border-box;
}

.rating-box {
    font-weight: bold;
    border-radius: 0;
    border-top: 1px solid rgba(var(--bs-emphasis-color-rgb), .1);
}

/* Style dasar untuk wrapper konten, berlaku di semua ukuran layar */
.series-content-wrapper-outer {
    position: relative;
    z-index: 2;
}

/* Terapkan style tambahan HANYA untuk layar besar (lg) dan di atasnya */
@media (min-width: 992px) {
    .series-content-wrapper-outer {
        margin-top: -125px;
    }
}

.series-content-wrapper-inner {
    position: relative;
    z-index: 2;
}

@media (min-width: 992px) {
    .series-content-wrapper-inner {
        margin-top: -125px;
    }
}

@media (max-width: 991.98px) {
    .series-content-wrapper-inner {
        margin-top: 0px;
    }
}

/* end of styling for series detail page */

/* =================================
   Styling Daftar Episode (Tampilan Tabel)
   ================================= */

/* Kotak Episode Awal & Baru */
.episode-range-box {
    display: block;
    padding: 0.75rem;
    background-color: var(--bs-app-primary);
    color: var(--bs-text-primary);
    border-radius: var(--bs-border-radius);
    text-decoration: none;
    text-align: center;
}

.episode-range-box:hover {
    background-color: var(--bs-app-secondary);
    color: var(--bs-text-secondary);
    text-decoration: none;
}

.episode-range-box small {
    display: block;
    opacity: 0.8;
    font-size: 0.8em;
}

.episode-range-box span {
    font-weight: 700;
    font-size: 1.2em;
}

/* Daftar Episode seperti Tabel */
.episode-table-list {
    /* Bisa ditambahkan max-height dan overflow-y di sini jika perlu */
    border: 0px;
}

.episode-table-header,
.episode-table-row {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid var(--bs-border-color-translucent);
}

.episode-table-header {
    font-weight: 600;
    color: var(--bs-secondary-color);
    font-size: 0.9em;
}

.episode-table-row {
    text-decoration: none;
    color: var(--bs-body-color);
    transition: background-color 0.2s ease;
    position: relative;
}

.episode-table-row:hover {
    background-color: var(--bs-secondary-bg);
}

/* Indikator baris aktif */
.episode-table-row.active {
    background-color: var(--bs-secondary-bg);
    font-weight: 600;
}

.episode-table-row.active::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background-color: var(--bs-danger);
}

/* Kolom-kolom di dalam baris */
.ep-col {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ep-number {
    flex: 0 0 40px;
}

/* Lebar tetap 40px */
.ep-title {
    flex-grow: 1;
    padding: 0 1rem;
}

/* Mengisi sisa ruang */
.ep-sub {
    flex: 0 0 50px;
    text-align: center;
}

/* Lebar tetap 50px */
.ep-date {
    flex: 0 0 150px;
    text-align: right;
    color: var(--bs-secondary-color);
    font-size: 0.9em;
}

/* Lebar tetap 150px */

/* Badge "Sub" */
.sub-badge {
    background-color: var(--bs-app-secondary);
    color: var(--bs-text-secondary);
    font-size: 0.7em;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
}

/* Ganti/tambahkan aturan CSS untuk .episode-list-body */

.episode-list-body {
    max-height: 500px;
    /* Atur batas tinggi maksimum sesuai keinginan Anda */
    overflow-y: auto;
    /* Tampilkan scrollbar vertikal jika konten melebihi max-height */
}

/* button custom */
.btn-custom-primary {
    /* Menggunakan variabel yang kita buat dari .env */
    background-color: var(--bs-app-primary);
    border-color: var(--bs-app-primary);

    /* Styling dasar agar terlihat seperti tombol Bootstrap */
    color: var(--bs-text-primary);
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
    border-radius: 0.375rem;
    transition: all 0.2s ease-in-out;
}

.btn-custom-primary:hover {
    background-color: var(--bs-app-secondary);
    color: var(--bs-text-secondary);
    /* Membuat warna latar sedikit lebih gelap saat di-hover */
    filter: brightness(90%);
}

/* Styling untuk Widget Populer di Sidebar */
.sidebar-wrapper .list-group-item {
    border-color: var(--bs-border-color-translucent) !important;
}

/* Kode baru yang mengizinkan teks turun (wrap) */
.sidebar-wrapper .widget-item-title {
    font-weight: 500;
    color: var(--bs-body-color);
    white-space: normal;
    /* Mengizinkan teks untuk turun baris (wrap) */
    word-break: break-word;
    /* Memecah kata yang sangat panjang jika perlu */
}

.sidebar-wrapper .list-group-item-action:hover .widget-item-title {
    color: var(--bs-primary);
}


/* =================================
   Styling untuk Live Search
   ================================= */
#search-overlay {
    display: none;
    /* Sembunyi secara default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1050;
    /* Di atas navbar */
}

.search-container {
    position: absolute;
    top: 15%;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 600px;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

#search-input {
    width: 100%;
    padding: 1rem 3rem;
    font-size: 1.2rem;
    border: 1px solid var(--bs-border-color);
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    border-radius: var(--bs-border-radius-lg);
}

#search-input:focus {
    outline: none;
    box-shadow: 0 0 0 .25rem rgba(var(--bs-primary-rgb), .25);
}

.search-input-wrapper .search-icon {
    position: absolute;
    left: 1rem;
    font-size: 1.2rem;
    color: var(--bs-secondary-color);
}

#search-close-btn {
    position: absolute;
    right: 1rem;
}

#search-results {
    background-color: var(--bs-body-bg);
    border-radius: var(--bs-border-radius-lg);
    margin-top: 0.5rem;
    max-height: 400px;
    overflow-y: auto;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--bs-body-color);
    border-bottom: 1px solid var(--bs-border-color-translucent);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background-color: var(--bs-tertiary-bg);
}

.search-result-item img {
    width: 40px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    margin-right: 1rem;
}

.search-result-item .title {
    font-weight: 500;
}

/* end Styling untuk Live Search  */

/* floating ads center */

#floatcenter {
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, .6);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
}

#floatcenter .ctrx {
    width: 100%;
    max-width: 500px;
    margin: auto;
    padding-top: 20vh;
}

/* end floating ads center */