* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: #000; color: #fff; font-family: 'Segoe UI', sans-serif; overflow: hidden; user-select: none; }

.player-wrapper { position: relative; width: 100vw; height: 100vh; background: #000; }

/* টপ হেডার (ডিপার্টমেন্টাল ডেস্কটপে হাইড) */
.mobile-top-header {
    display: none;
}

.brand-white { color: #ffffff; }
.brand-accent { color: #0099ff; }

/* ভিডিও কন্টেইনার (স্ট্যাকিং কনটেক্সট ফিক্স করা হয়েছে) */
.video-container {
    width: 100%;
    height: 100%;
    position: relative;
    background: #000;
    z-index: 1; /* এর ভেতরের উপাদান বাইরে প্রভাব ফেলবে না */
}

video { 
    width: 100%; 
    height: 100%; 
    object-fit: contain; 
    background: #000; 
} 

/* মোবাইল ফুলস্ক্রিন বাটন */
.mobile-fs-btn {
    display: none;
    transition: opacity 0.4s, visibility 0.4s;
}

/* ফুলস্ক্রিন চলাকালীন শুধুমাত্র টপ হেডার ও ফুলস্ক্রিন বাটন হাইড থাকবে */
#playerWrapper:fullscreen .mobile-top-header,
#playerWrapper:-webkit-full-screen .mobile-top-header {
    display: none !important;
}
#playerWrapper:fullscreen .mobile-fs-btn,
#playerWrapper:-webkit-full-screen .mobile-fs-btn {
    display: none !important;
}

/* সাধারণ সাইডবার স্টাইল (ডেস্কটপ, টিভি এবং ল্যান্ডস্কেপ মোড) */
.sidebar { 
    position: absolute; 
    left: 20px; 
    top: 50%; 
    transform: translateY(-50%);
    width: 260px; 
    height: 80vh; 
    background: #0099ff1f;
    backdrop-filter: blur(25px); 
    border-radius: 14px; 
    border: 1.5px solid #0099ff59; 
    padding: 15px; 
    z-index: 10; /* ভিডিও কন্টেইনার ও এরর ওভারলের উপরে থাকবে */
    display: flex; 
    flex-direction: column; 
    transition: opacity 0.4s, visibility 0.4s;
}

.sidebar-title {
    font-size: 18px; 
    font-weight: 800; 
    color: #fff; 
    text-align: left;
    margin-bottom: 15px; 
    border-bottom: 1px solid rgba(255,255,255,0.1); 
    padding-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.sidebar-title i { color: #0099ff; }

.channel-container { overflow-y: auto; flex-grow: 1; padding-right: 5px; }
.channel-container::-webkit-scrollbar { width: 4px; }
.channel-container::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.05); }
.channel-container::-webkit-scrollbar-thumb { background: #0099ff; border-radius: 10px; }

.channel-item { 
    position: relative;
    display: flex; 
    align-items: center; 
    padding: 10px 12px; 
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px; 
    cursor: pointer; 
    transition: all 0.25s ease;
}

/* সিলেক্ট করা চ্যানেলের উপরে ছোট্ট LIVE ব্যাজ */
.live-badge {
    display: none;
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ff0033;
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.5px;
    padding: 2px 6px;
    border-radius: 6px;
    box-shadow: 0 0 8px rgba(255, 0, 51, 0.8);
    z-index: 2;
    pointer-events: none;
}
.channel-item.active .live-badge {
    display: inline-block;
}
.channel-item:hover { 
    background: rgba(255, 255, 255, 0.08); 
    border-color: rgba(255, 255, 255, 0.25);
}
.channel-item.active { 
    background: #09f; 
    border-color: #0099ff; 
    box-shadow: 0 0 10px #09f; 
}
.channel-item img {
    width: 42px;
    height: 28px;
    object-fit: contain;
    margin-right: 12px;
    border-radius: 6px;
    background: #ffffff;
    padding: 4px;
    box-shadow: 0 0 6px rgba(0, 153, 255, 0.35);
}
.channel-item .channel-name { font-size: 15px; font-weight: 600; color: #fff; }

.bottom-right-controls {
    position: absolute; bottom: 30px; right: 30px;
    display: flex; align-items: center; gap: 15px; z-index: 10; /* ভিডিও কন্টেইনারের উপরে থাকবে */
    background: rgba(0,0,0,0.8); padding: 12px 22px; border-radius: 30px;
    backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,0.1);
    transition: opacity 0.4s, visibility 0.4s;
}

.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
input[type=range] { accent-color: #0099ff; cursor: pointer; }
.icon-btn { color: white; cursor: pointer; font-size: 22px; background: none; border: none; }

/* লোডারটি শুধুমাত্র ভিডিও কন্টেইনারের ওপরে থাকবে */
.loader-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6); display: none; align-items: center;
    justify-content: center; z-index: 5; pointer-events: none;
}
.heart-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.heart-loader span {
    font-size: 34px;
    line-height: 1;
    color: #ffffff;
    display: inline-block;
    animation: heartBounce 0.9s ease-in-out infinite;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.6);
}
.heart-loader span:nth-child(1) { animation-delay: 0s; }
.heart-loader span:nth-child(2) { animation-delay: 0.15s; }
.heart-loader span:nth-child(3) { animation-delay: 0.3s; }
@keyframes heartBounce {
    0%, 60%, 100% { transform: translateY(0) scale(1); }
    30% { transform: translateY(-18px) scale(1.1); }
}

/* ভিডিও প্লেয়ারের ভেতর সীমাবদ্ধ এরর ওভারলে */
.error-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85); display: none; align-items: center;
    justify-content: center; z-index: 2; text-align: center; padding: 10px;
}
.error-card {
    position: relative;
    background: #111; border: 2px solid #0099ff; border-radius: 12px;
    padding: 15px 20px; width: 90%; max-width: 380px; box-shadow: 0 0 20px rgba(0, 153, 255, 0.4);
    display: flex; flex-direction: column; align-items: center;
    max-height: 95%; overflow-y: auto;
}
.error-card i { font-size: 32px; color: #0099ff; margin-bottom: 8px; }
.error-card h3 { font-size: 16px; margin-bottom: 6px; font-weight: bold; color: #fff; }
.error-card p { font-size: 12px; color: #ccc; margin-bottom: 12px; line-height: 1.4; }

.close-error-btn {
    position: absolute; top: 5px; right: 12px; background: none;
    border: none; color: #0099ff; font-size: 24px; font-weight: bold;
    cursor: pointer; transition: color 0.2s, transform 0.2s;
}
.close-error-btn:hover { color: #fff; transform: scale(1.1); }

.wa-btn {
    display: inline-flex; align-items: center; gap: 8px; background: #25d366;
    color: white; text-decoration: none; padding: 8px 16px; font-weight: bold;
    border-radius: 20px; font-size: 12px; transition: transform 0.2s;
}
.wa-btn:hover { transform: scale(1.05); }

@media (min-width: 992px) {
    .sidebar { width: 310px; left: 40px; }
    .channel-item img { width: 50px; height: 32px; }
    .channel-item .channel-name { font-size: 16px; }
}

/* =======================================================
   মোবাইল পোর্ট্রেট (লম্বালম্বি) মোডের জন্য সংশোধিত সিএসএস
   ======================================================= */
@media (max-width: 768px) and (orientation: portrait) {
    html, body {
        height: 100%;
        overflow: hidden; 
        position: fixed;
        width: 100%;
    }
    
    .mobile-top-header {
        display: flex;
        align-items: center;
        background: #000;
        color: #fff;
        font-family: 'Segoe UI', sans-serif;
        font-weight: 700;
        font-size: 20px;
        padding: 10px 15px;
        border-bottom: 3.5px solid #0099ff; 
        gap: 10px;
        height: 50px;
        flex-shrink: 0;
    }

    .player-wrapper {
        display: flex;
        flex-direction: column;
        height: calc(100vh - 50px); 
        overflow: hidden;
    }

    .video-container {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
        flex-shrink: 0;
        border-bottom: 3px solid #0099ff;
        position: relative;
        z-index: 1;
    }

    video {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

    .mobile-fs-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        bottom: 12px;
        right: 12px;
        width: 38px;
        height: 38px;
        background: rgba(0, 0, 0, 0.65);
        border: 1px solid rgba(255, 255, 255, 0.4);
        border-radius: 50%;
        color: #fff;
        font-size: 14px;
        cursor: pointer;
        z-index: 10;
    }
    .mobile-fs-btn:active {
        background: #0099ffcc;
    }

    /* পোর্ট্রেট মোডে সাইডবার স্টাইল */
    .sidebar {
        position: relative;
        left: 0;
        top: 0;
        transform: none;
        width: 100%;
        height: auto;
        flex-grow: 1;
        background: #000;
        border: none;
        border-radius: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        z-index: 10;
    }

    .sidebar-title {
        background: #000;
        border-top: 2px solid #0099ff;
        border-bottom: 2px solid #0099ff;
        font-size: 18px;
        padding: 8px 15px;
        margin-bottom: 0;
        text-transform: none;
        font-weight: bold;
        color: #fff;
    }
    .sidebar-title i {
        display: none;
    }

    .channel-container {
        display: grid;
        grid-template-columns: repeat(3, 1fr); 
        grid-auto-rows: max-content; 
        align-content: start; 
        gap: 12px;
        padding: 12px;
        overflow-y: auto;
        overflow-x: hidden;
        flex-grow: 1;
        box-sizing: border-box;
    }

    .channel-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        background: none !important;
        border: none !important;
        padding: 0;
        margin-bottom: 10px;
        text-align: center;
        box-shadow: none !important;
        width: 100%;
        box-sizing: border-box;
    }

    .channel-item img {
        width: 100%;
        max-width: 80px; 
        aspect-ratio: 16 / 9; 
        height: auto;
        object-fit: contain;
        background: #fff;
        border: 2px solid #0099ff;
        border-radius: 12px;
        padding: 6px;
        margin-right: 0;
        margin-bottom: 6px;
        box-shadow: 0 0 8px #09f;
        transition: transform 0.2s ease-in-out;
        box-sizing: border-box;
    }

    .channel-item.active img {
        border-color: #09f;
        box-shadow: 0 0 15px #0099ffcc;
        transform: scale(1.05);
    }

    .channel-item .channel-name {
        font-size: 12px;
        color: #fff;
        font-weight: 500;
        display: block;
        width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .bottom-right-controls {
        display: none !important;
    }
}

/* মোবাইল ল্যান্ডস্কেপ (স্ক্রিন ঘোরানো) মোড */
@media (max-height: 500px) and (orientation: landscape) {
    .sidebar {
        height: 85vh;
        width: 240px;
        left: 15px;
        padding: 10px;
        z-index: 10;
    }
    .sidebar-title {
        font-size: 14px;
        margin-bottom: 10px;
        padding-bottom: 5px;
    }
    .channel-item {
        padding: 7px 10px;
        margin-bottom: 6px;
    }
    .channel-item img {
        width: 42px;
        height: 27px;
        margin-right: 8px;
    }
    .channel-item .channel-name {
        font-size: 14px;
    }
    .live-badge {
        font-size: 8px;
        padding: 1px 5px;
        top: -5px;
        right: -5px;
    }
    .bottom-right-controls {
        bottom: 15px;
        right: 15px;
        padding: 8px 16px;
        gap: 10px;
        z-index: 10;
    }
    .bottom-right-controls input[type=range] {
        width: 60px;
    }
}