/* ========================================================
   SHARED CUSTOM STYLESHEET (NORMAL COMPACT DESIGN)
   ======================================================== */
:root {
    --body-bg: #0b0c0f;
    --main-bg: #111217;
    --nav-bg: #08090c;
    --primary-red: #ff1e27;
    --text-color: #ffffff;
    --text-muted: #7d8492;
    --btn-req: #ff6542;
    --btn-tele: #0088cc;
    --btn-live-bg: #161822;
    --border-color: #1e212b;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    text-decoration: none;
    list-style: none;
}

body {
    background-color: var(--body-bg);
    color: var(--text-color);
    padding-bottom: 30px;
    overflow-x: hidden;
    user-select: none;
}

.container {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 14px;
}

/* HEADER STYLE */
header {
    background-color: var(--main-bg);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 9999;
}

.header-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 56px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary-red);
    display: flex;
    align-items: center;
    cursor: pointer;
    letter-spacing: -0.5px;
}

.logo span { position: relative; }
.logo span::after {
    content: '★';
    position: absolute;
    top: -6px;
    right: -8px;
    font-size: 8px;
    color: var(--primary-red);
}

.search-trigger-btn {
    font-size: 20px;
    color: #fff;
    cursor: pointer;
    transition: 0.3s;
    padding: 10px;
}
.search-trigger-btn:hover {
    color: var(--primary-red);
}

/* ALPHABETICAL NAV BAR */
.alphabet-bar {
    background-color: var(--nav-bg);
    border-bottom: 1px solid var(--border-color);
}

.alphabet-nav {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
}
.alphabet-nav::-webkit-scrollbar { display: none; }
.alphabet-nav a {
    color: #495057;
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.alphabet-nav a.active {
    color: var(--text-color);
    border-bottom: 2px solid #555d70;
}

/* SWIPER SLIDER SYSTEM */
.mainHeroSwiper {
    width: 100%;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.hero-container {
    margin-top: 14px;
    margin-bottom: 20px !important; /* স্লাইডারের নিচে সুন্দর স্পেসিং */
    position: relative;
}

.swiper-slide-hero {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background-size: cover;
    background-position: center;
}

.swiper-slide-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(11, 12, 15, 1) 0%, transparent 70%);
}

.hero-details {
    position: absolute;
    bottom: 15px;
    left: 15px;
    z-index: 2;
    max-width: 80%;
}

/* স্লাইডারের ফন্ট সাইজ স্বাভাবিক করা হয়েছে */
.hero-details h1 {
    font-size: 16px !important; /* মোবাইলে টাইটেল সাইজ স্বাভাবিক দেখাবে */
    font-weight: 700;
    color: #fff;
    text-shadow: 1px 1px 4px rgba(0,0,0,0.9);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (min-width: 768px) {
    .hero-details h1 {
        font-size: 24px !important; /* ডেস্কটপে টাইটেল সাইজ */
    }
}

.hero-details p {
    font-size: 11px !important;
    color: var(--text-muted);
    margin-top: 2px;
}

.swiper-pagination {
    bottom: 4px !important; /* ডটস কন্টেইনার স্লাইডারের ভেতরে লক থাকবে */
}

.swiper-pagination-bullet {
    background: #232530 !important;
    opacity: 1 !important;
    width: 7px;
    height: 7px;
    transition: 0.3s;
}

.swiper-pagination-bullet-active {
    background: #ffffff !important;
    width: 26px !important;
    border-radius: 10px !important;
}

/* ACTION ROW */
.action-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 24px;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    gap: 6px;
}
.btn-request { background-color: var(--btn-req); }
.btn-telegram { background-color: var(--btn-tele); }
.btn-live { background-color: var(--btn-live-bg); border: 1px solid var(--border-color); flex-direction: column; }

.live-dot-container {
    display: flex;
    align-items: center;
    gap: 4px;
}

.live-blink-dot {
    width: 6px;
    height: 6px;
    background-color: #ff2d55;
    border-radius: 50%;
    display: inline-block;
    animation: blink 1s infinite;
}

@keyframes blink {
    0% { opacity: 0.3; }
    50% { opacity: 1; }
    100% { opacity: 0.3; }
}

/* SECTION HEADER WITH LEFT RED BAR */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0 14px 0;
}

/* হেডিং ফন্ট সাইজ স্বাভাবিক করা হয়েছে */
.section-title-wrap h2 {
    font-size: 16px !important; /* মোবাইলের জন্য স্বাভাবিক সাইজ */
    font-weight: 700;
    color: #ffffff;
    padding-left: 10px;
    border-left: 4px solid var(--primary-red);
    line-height: 1;
}

@media (min-width: 768px) {
    .section-title-wrap h2 {
        font-size: 20px !important; /* ডেস্কটপের জন্য */
    }
}

.slider-arrows {
    display: flex;
    gap: 6px;
}

.arrow-btn {
    background-color: #16171a;
    border: 1px solid #23252a;
    color: #fff;
    width: 34px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
}

.see-all-btn {
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
}

.see-all-btn.red-btn {
    background-color: var(--primary-red);
    color: #fff;
    padding: 5px 12px;
    border-radius: 3px;
    font-size: 10px;
    letter-spacing: 0.5px;
}

/* SCROLL LIST LAYOUT (HORIZONTALLY INDEXED) */
.scroll-wrapper {
    display: flex;
    overflow-x: auto;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 5px;
    scroll-behavior: smooth;
}
.scroll-wrapper::-webkit-scrollbar { display: none; }

.scroll-wrapper .movie-card {
    flex: 0 0 calc(33.33% - 8px);
    min-width: 105px;
    max-width: 120px;
}

/* MOVIE GRID SYSTEM */
.movie-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

/* INDIVIDUAL MOVIE CARD */
.movie-card {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    width: 100%;
}

/* PADDING-BOTTOM TRICK: LOCKED 2:3 RATIO */
.poster-area {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 150%;
    background-color: #171821;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 6px;
    border: 1px solid var(--border-color);
}

.poster-area img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* RIBBON MATCHING SCREENSHOT */
.quality-ribbon {
    position: absolute;
    top: 6px;
    left: 6px;
    background-color: var(--primary-red);
    font-size: 8px;
    font-weight: 700;
    padding: 3px 6px;
    border-radius: 3px;
    z-index: 2;
    color: #fff;
    text-transform: uppercase;
}

.live-badge { background-color: #ff2d55 !important; }

.live-blink-circle {
    width: 6px;
    height: 6px;
    background-color: #fff;
    border-radius: 50%;
    display: inline-block;
    animation: blink-dot 1s infinite;
}

@keyframes blink-dot {
    0% { opacity: 0.3; }
    50% { opacity: 1; }
    100% { opacity: 0.3; }
}

.movie-name {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-color);
    margin-top: 4px;
}

.movie-meta {
    font-size: 10px;
    color: var(--text-muted);
}

.loading-text {
    font-size: 11px;
    color: var(--text-muted);
    padding: 10px 5px;
}

/* ========================================================
   MODERN DEDICATED SEARCH PAGE OVERLAY & LIST
======================================================== */
#searchPage {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #0b0c0f;
    z-index: 10005;
    overflow-y: auto;
    padding-bottom: 50px;
}

.search-page-header {
    height: 60px;
    background-color: var(--main-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 2;
}

.search-page-title {
    font-size: 18px;
    font-weight: 700;
    margin-left: 16px;
}

.search-bar-center-box {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 600px;
    margin: 24px auto;
    background-color: #111217;
    border: 1px solid #1e212b;
    border-radius: 8px;
    padding: 0 16px;
    height: 48px;
    transition: border-color 0.3s ease;
}

.search-bar-center-box:focus-within {
    border-color: var(--primary-red);
}

.search-bar-center-box input {
    flex: 1;
    height: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: 15px;
    padding-right: 12px;
}

.search-bar-icon {
    color: var(--text-muted);
    font-size: 18px;
    flex-shrink: 0;
}

/* LIST CONTAINER */
.search-results-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

/* RESULT CARD */
.search-result-item {
    display: flex;
    gap: 14px;
    background-color: #111217;
    border-radius: 8px;
    padding: 10px;
    border: 1px solid #1e212b;
    cursor: pointer;
    transition: 0.2s ease;
}

.search-result-item:hover {
    border-color: #ff1e27;
}

.search-result-poster {
    position: relative;
    width: 80px;
    height: 110px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

.search-result-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-result-poster .quality-ribbon {
    top: 4px;
    left: 4px;
    padding: 2px 4px;
    font-size: 7px;
}

.search-result-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.search-result-title {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}

.search-result-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.imdb-rating {
    background-color: #f5c518;
    color: #000;
    font-weight: 800;
    font-size: 9px;
    padding: 1px 4px;
    border-radius: 2px;
}

.search-result-desc {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ========================================================
   PREMIUM POST DETAIL VIEW (SCREENSHOT 1 & 2 COPIED)
======================================================== */
#singlePlayerPage {
    display: none;
    background-color: #000000;
    min-height: 100vh;
    padding-bottom: 50px;
    position: relative;
}

.details-hero-backdrop {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.backdrop-gradient-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, #000000 0%, transparent 100%),
                linear-gradient(to right, rgba(0,0,0,0.4) 0%, transparent 100%);
    z-index: 2;
}

.uhd-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: rgba(21, 22, 28, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffab40;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    z-index: 3;
}

/* BACKDROP METADATA OVERLAY (Screenshot 1) */
.backdrop-meta-row {
    position: absolute;
    bottom: 50px; /* Aligned beautifully above buttons */
    left: 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: #cbd5e1;
    z-index: 3;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.9);
}

.backdrop-meta-row span {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* IMDb logo badge on backdrop */
.imdb-badge-backdrop {
    background: #3c3d52;
    border-radius: 4px;
    padding: 2px 6px;
    color: #f5c518; /* yellow imdb accent */
    font-weight: 800;
    font-size: 11px;
}

/* Backdrop Green and Blue Action Buttons */
.backdrop-buttons-row {
    position: absolute;
    bottom: 12px;
    left: 16px;
    display: flex;
    gap: 8px;
    z-index: 3;
}

.action-btn-small {
    border: none;
    border-radius: 4px;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 6px 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: 0.2s;
}

.action-btn-small.btn-green { background-color: #00c853; }
.action-btn-small.btn-green:hover { background-color: #00a844; }
.action-btn-small.btn-blue { background-color: #00b0ff; }
.action-btn-small.btn-blue:hover { background-color: #0099ff; }

/* Translucent Play circular overlay button (Screenshot 1) */
.backdrop-play-btn {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    transition: 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.backdrop-play-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

.backdrop-play-btn i {
    color: var(--primary-red);
    font-size: 24px;
    margin-left: 4px; /* offset play icon slightly */
}

/* CONTENT STYLING BELOW PLAYER */
.details-content-container {
    padding: 0 16px;
    margin-top: 0px !important; /* [FIXED] Pushed down to prevent clipping letters */
    position: relative;
    z-index: 3;
}

.details-title {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    margin: 16px 0 6px 0;
    line-height: 1.2;
}

.details-genres-row {
    display: flex;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 14px;
}

/* Orange WATCH TRAILER Button (Screenshot 1 & 3) */
.watch-trailer-btn {
    background-color: #ff9100;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    transition: 0.3s;
}

.watch-trailer-btn:hover {
    background-color: #e68200;
}

/* Bold Metadata layouts (Screenshot 1 & 3) */
.metadata-fields-box {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.meta-field-row {
    font-size: 13px;
    color: #fff;
    line-height: 1.5;
}

.meta-field-row strong {
    color: var(--text-muted);
    font-weight: 700;
    margin-right: 6px;
}

.details-description {
    font-size: 13px;
    color: #cbd5e1;
    line-height: 1.6;
    margin-top: 6px;
}

/* Full Width Download trigger button */
.download-trigger-btn {
    width: 100%;
    height: 48px;
    background-color: var(--primary-red);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 24px 0;
    transition: 0.2s;
}

.download-trigger-btn:hover {
    background-color: #cc121a;
}

/* Dynamic Download Popup overlay */
.details-download-dropdown-box {
    background-color: #111217;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Cast & Crew Section */
.cast-scroll-row {
    display: flex;
    overflow-x: auto;
    gap: 16px;
    padding: 10px 0;
}
.cast-scroll-row::-webkit-scrollbar { display: none; }

.cast-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    width: 70px;
}

.cast-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

.cast-item span {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

/* Details Subtitles titles */
.details-subtitle {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    margin: 24px 0 10px 0;
    padding-left: 8px;
    border-left: 3px solid var(--primary-red);
}

/* ========================================================
   [FIX] INLINE PLAYER BLOCK SIZING & OVERLAYS
======================================================== */
#inlinePlayerContainer {
    display: none;
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
    z-index: 4;
    background-color: #000000;
}

#inlinePlayerContainer .fluid_video_wrapper,
#inlinePlayerContainer video,
#inlinePlayerContainer iframe {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
}

/* [FIXED] SOLID BLACK HEADER BAR WITH BORDER */
.player-nav-header {
    position: relative !important; /* absolute পজিশন পরিবর্তন করে রিলেティブ করা হয়েছে */
    width: 100%;
    height: 52px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    background-color: #000000 !important; /* Solid Black bar matches Screenshot 2 */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10002; /* Floating over the player container safely */
}

.nav-header-title {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    margin-left: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.back-btn {
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    backdrop-filter: blur(5px);
}

/* ========================================================
   [NEW] DYNAMIC MULTIPLE DOWNLOAD MODAL OVERLAY
======================================================== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    z-index: 100010;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-card {
    background-color: #15161c;
    border: 1px solid #1e212b;
    border-radius: 10px;
    width: 100%;
    max-width: 440px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #1e212b;
    padding-bottom: 12px;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}

.close-modal-btn {
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-body-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 240px;
    overflow-y: auto;
}

.download-link-row-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #111217;
    border: 1px solid #1e212b;
    padding: 12px 16px;
    border-radius: 6px;
    color: #fff;
    font-size: 12px;
    transition: 0.2s;
}

.download-link-row-item:hover {
    border-color: var(--primary-red);
}

.dl-badge {
    background-color: #00c853;
    color: #000;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
}

/* ========================================================
   [NEW - DooPlay style] DYNAMIC TABS (ডেসক্রিপশন,্যাক্টর ও ডিরেক্টর উইজেট)
======================================================== */
.ott-details-tabs-container {
    margin-top: 24px;
    width: 100%;
}

.tabs-header-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.tab-btn {
    background-color: #1c1d24;
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 700;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.tab-btn:hover {
    border-color: var(--primary-red);
}

.tab-btn.active {
    background-color: var(--primary-red) !important;
    border-color: var(--primary-red) !important;
    color: #fff !important;
}

.tab-content-panel {
    font-size: 13px;
    line-height: 1.6;
    color: #cbd5e1;
    min-height: 80px;
}

/* [NEW/FIXED] PLYR CUSTOM LAYOUT STYLING (ইউটিউব এর মতো প্লেয়ার) [1] */
video-player, video-minimal-skin {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
}

video-player video {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    background-color: #000000 !important;
}

/* [NEW FIXED] SEARCH SUGGESTION BOX (Did you mean?) */
.search-suggestion-box {
    background-color: #1c1d24;
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--text-muted);
}

.suggested-title {
    color: var(--primary-red);
    cursor: pointer;
    font-weight: 700;
    text-decoration: underline;
}

/* DESKTOP RESPONSIVE LAYOUT */
@media (min-width: 768px) {
    .movie-grid { 
        grid-template-columns: repeat(6, 1fr) !important; 
        gap: 16px !important; 
    }
    .scroll-wrapper .movie-card { 
        flex: 0 0 calc(16.66% - 14px); 
        max-width: 180px;
    }
    .hero-section { 
        aspect-ratio: 24 / 9; 
        max-height: 380px; 
    }
}
</style>

    <!-- [MUST BE KEPT HERE] Firebase Compat SDKs -->
    <script src="https://www.gstatic.com/firebasejs/10.8.0/firebase-app-compat.js"></script>
    <script src="https://www.gstatic.com/firebasejs/10.8.0/firebase-firestore-compat.js"></script>
    
    <!-- Swiper Touch Slider CSS -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css"/>
    
    <!-- Swiper Touch Slider Library -->
    <script src="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js"></script>
</head>
<body>

    <!-- Home Page Layout -->
    <div id="homePageLayout">
        <header>
            <div class="container header-wrap">
                <div class="header-left">
                    <i class="fa-solid fa-bars" style="font-size: 20px;"></i>
                    <div class="logo" onclick="navigateTo('/')">Targ<span>o</span>nFlix</div>
                </div>
                <!-- Modern Search Button Icon -->
                <div class="header-right">
                    <i class="fa-solid fa-magnifying-glass search-trigger-btn" onclick="openSearchPage()"></i>
                </div>
            </div>
        </header>

        <div class="alphabet-bar">
            <div class="container">
                <nav class="alphabet-nav" id="alphabetNav"></nav>
            </div>
        </div>

        <div class="container">
            <!-- Swiper Touch Slider Area (হাত দিয়ে স্লাইড করা যাবে) -->
            <div class="hero-container" id="mainHeroArea">
                <div class="swiper mainHeroSwiper">
                    <div class="swiper-wrapper" id="heroSliderWrapper">
                        <!-- Dynamic slides will be injected here safely -->
                    </div>
                    <div class="swiper-pagination"></div>
                </div>
            </div>

            <!-- Action Buttons -->
            <div class="action-row">
                <div class="btn btn-request"><i class="fa-solid fa-clapperboard"></i> REQUEST</div>
                <div class="btn btn-telegram"><i class="fa-brands fa-telegram"></i> TELEGRAM</div>
                <div class="btn btn-live">
                    <div class="live-dot-container">
                        <span class="live-blink-dot"></span>
                        <span style="font-size:9px; color:var(--text-muted); font-weight: 700;">LIVE</span>
                    </div>
                    <div id="liveViewerCount" style="font-size:13px; font-weight:700; margin-top: 2px;">14,213</div>
                </div>
            </div>

            <!-- Live TV Channels -->
            <div class="section-header">
                <div class="section-title-wrap">
                    <h2>Live TV Channels</h2>
                </div>
                <!-- Navigates to domain/livetv -->
                <span class="see-all-btn red-btn" onclick="navigateTo('/livetv')">SEE ALL</span>
            </div>
            <div class="scroll-wrapper" id="tvChannelsGrid">
                <div class="loading-text">Loading Live Channels...</div>
            </div>

            <!-- Featured Section -->
            <div class="section-header">
                <div class="section-title-wrap">
                    <h2>Featured</h2>
                </div>
                <div class="slider-arrows">
                    <button class="arrow-btn" onclick="scrollGrid('featuredGrid', -200)"><i class="fa-solid fa-caret-left"></i></button>
                    <button class="arrow-btn" onclick="scrollGrid('featuredGrid', 200)"><i class="fa-solid fa-caret-right"></i></button>
                </div>
            </div>
            <div class="scroll-wrapper" id="featuredGrid">
                <div class="loading-text">Loading Featured...</div>
            </div>

            <!-- Movies Section -->
            <div class="section-header">
                <div class="section-title-wrap">
                    <h2>Movies</h2>
                </div>
                <!-- Navigates to domain/movies -->
                <span class="see-all-btn red-btn" onclick="navigateTo('/movies')">SEE ALL</span>
            </div>
            <div class="movie-grid" id="moviesGrid">
                <div class="loading-text">Loading Movies...</div>
            </div>
        </div>
    </div>


    <!-- DEDICATED SEARCH PAGE OVERLAY -->
    <div id="searchPage">
        <div class="search-page-header">
            <div class="back-btn" onclick="closeSearchPage()">
                <i class="fa-solid fa-arrow-left"></i>
            </div>
            <div class="search-page-title">Search</div>
        </div>

        <div class="container">
            <!-- Unified Search Bar (Flexbox layout) -->
            <div class="search-bar-center-box">
                <input type="text" id="mainSearchInput" placeholder="Search by movie, channel or actor...">
                <i class="fa-solid fa-magnifying-glass search-bar-icon"></i>
            </div>

            <!-- Dynamic Heading -->
            <div class="section-header" id="searchResultsHeader" style="display: none;">
                <div class="section-title-wrap">
                    <h2 id="searchResultsTitle">Results found</h2>
                </div>
            </div>

            <!-- Dynamic Search Results List -->
            <div class="search-results-list" id="searchResultsList"></div>

            <!-- Static "People Search For" section -->
            <div id="trendingSearchSection">
                <div class="section-header">
                    <div class="section-title-wrap">
                        <h2>People Search For</h2>
                    </div>
                </div>
                <div class="movie-grid" id="trendingSearchGrid"></div>
            </div>
        </div>
    </div>


    <!-- ========================================================
       PREMIUM DETAIL VIEW (SCREENSHOT 2 & 3 OVERHAULED)
       ======================================================== -->
    <div id="singlePlayerPage">
        <!-- Solid Black Header Bar (কালো লাইনের সমাধান) -->
        <div class="player-nav-header">
            <div class="back-btn" onclick="goBackFromPlayer()">
                <i class="fa-solid fa-arrow-left"></i>
            </div>
            <span class="nav-header-title" id="navHeaderTitle">TargonFlix</span>
        </div>

        <!-- Hero Poster backdrop (ক্লিক করলে এইখানেই Video.js প্লেয়ার লোড হবে) -->
        <div class="details-hero-backdrop" id="detailsBackdrop">
            <div class="backdrop-gradient-overlay" id="backdropOverlay"></div>
            
            <!-- Backdrop Metadata Overlay -->
            <div class="backdrop-meta-row" id="backdropMetaOverlay">
                <span><i class="fa-regular fa-eye"></i> <span id="detailViewsCount">10K</span> Views</span>
                <span><i class="fa-regular fa-calendar-days"></i> <span id="detailsMetaDate">Dec 21 2023</span></span>
                <span><i class="fa-regular fa-clock"></i> <span id="detailsMetaDuration">2h 54m</span></span>
                <span class="imdb-badge-backdrop" id="detailsIMDbBadge">IMDb 6.6</span>
            </div>

            <!-- Backdrop Actions Row -->
            <div class="backdrop-buttons-row" id="backdropButtonsOverlay">
                <button class="action-btn-small btn-green" onclick="toggleWatchlist()">
                    <span id="watchlistIcon"><i class="fa-solid fa-plus"></i></span> Add to Watchlist
                </button>
                <button class="action-btn-small btn-blue">
                    <i class="fa-solid fa-share-nodes"></i> Share
                </button>
            </div>

            <!-- OTT Circular Translucent Play button -->
            <div class="backdrop-play-btn" id="backdropPlayBtn" onclick="launchVideoPlayer()">
                <i class="fa-solid fa-play"></i>
            </div>

            <span class="uhd-badge" id="uhdBadge"><i class="fa-solid fa-bolt"></i> Ultra HD 4K</span>
            
            <!-- Inbuilt Inline Player Container -->
            <div id="inlinePlayerContainer"></div>
        </div>

        <div class="details-content-container">
            <!-- Title -->
            <h1 id="detailsTitle" class="details-title">Kahani</h1>
            
            <!-- Genre Badges pills -->
            <div class="details-genres-row" id="detailsGenres">
                <span class="genre-pill">Thriller</span>
                <span class="genre-pill">Hindi</span>
            </div>

            <!-- Orange WATCH TRAILER Button -->
            <button class="watch-trailer-btn" id="btnTrailer" onclick="playTrailerOnly()">
                <i class="fa-solid fa-circle-play"></i> WATCH TRAILER
            </button>

            <!-- Metadata info boxes -->
            <div class="metadata-fields-box">
                <p class="meta-field-row" id="fieldActors"><strong>Actors:</strong> <span id="detailsActorsText">Prabhas</span></p>
                <p class="meta-field-row" id="fieldDirectors"><strong>Directors:</strong> <span id="detailsDirectorsText">Prashanth Neel</span></p>
                <p class="details-description" id="detailsDescription">Loading overview...</p>
            </div>

            <!-- Big Download Button -->
            <button class="download-trigger-btn" id="detailsDownloadBtn" onclick="openDownloadModal()">
                <i class="fa-solid fa-cloud-arrow-down"></i> Download Movie
            </button>

            <!-- [NEW - DooPlay style] DYNAMIC TABS INTEGRATION (ডেসক্রিপশন, অ্যাক্টর ও ডিরেক্টর উইজেট) -->
            <div class="ott-details-tabs-container" id="detailsTabsSection">
                <div class="tabs-header-row">
                    <button class="tab-btn active" id="tabBtnDesc" onclick="switchDetailTab('desc')">Description</button>
                    <button class="tab-btn" id="tabBtnActors" onclick="switchDetailTab('actors')">Actors</button>
                    <button class="tab-btn" id="tabBtnDirectors" onclick="switchDetailTab('directors')">Directors</button>
                </div>
                <!-- Content panels -->
                <div class="tab-content-panel active" id="tabContentDesc">
                    <p class="details-description" id="detailsDescriptionTab"></p>
                </div>
                <div class="tab-content-panel" id="tabContentActors" style="display:none;">
                    <p class="meta-field-row"><strong>Actors:</strong> <span id="detailsActorsTextTab"></span></p>
                </div>
                <div class="tab-content-panel" id="tabContentDirectors" style="display:none;">
                    <p class="meta-field-row"><strong>Directors:</strong> <span id="detailsDirectorsTextTab"></span></p>
                </div>
            </div>

            <!-- Cast & Crew Row with Avatar pics -->
            <div class="cast-crew-section" id="castCrewSection">
                <h3 class="details-subtitle">Cast & Crew</h3>
                <div class="cast-scroll-row" id="detailsCastRow"></div>
            </div>

            <!-- Related lists "More like this" -->
            <div class="related-section">
                <h3 class="details-subtitle">More Like This</h3>
                <div class="movie-grid" id="playerPageRelatedGrid" style="margin-top:12px;"></div>
            </div>
        </div>
    </div>


    <!-- CENTERED DOWNLOAD OPTIONS MODAL OVERLAY -->
    <div id="downloadModal" class="modal-overlay" onclick="closeDownloadModal()">
        <div class="modal-card" onclick="event.stopPropagation()">
            <div class="modal-header">
                <h3>Download Options</h3>
                <span class="close-modal-btn" onclick="closeDownloadModal()">&times;</span>
            </div>
            <div class="modal-body-list" id="modalDownloadLinksList">
                <!-- Links list populated dynamically by app.js -->
            </div>
        </div>
    </div>


    <!-- Main Logic Script with Cache Buster Link -->
    <script src="/app.js?v=3.1"></script>
</body>
</html>