* { 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;
}

/* ভিডিও কন্টেইনার */
.video-container {
    width: 100%;
    height: 100%;
    position: relative;
    background: #000;
}

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: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(25px); 
    border-radius: 14px; 
    border: 1.5px solid #ff0000; 
    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: #ff0000; }

.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: #ff0000; border-radius: 10px; }

.channel-item { 
    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;
}
.channel-item:hover { 
    background: rgba(255, 255, 255, 0.08); 
    border-color: rgba(255, 255, 255, 0.25);
}
.channel-item.active { 
    background: rgba(255, 0, 0, 0.15); 
    border-color: #ff0000; 
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.4); 
}
.channel-item img { width: 42px; height: 28px; object-fit: contain; margin-right: 12px; border-radius: 3px; background: rgba(255,255,255,0.05); }
.channel-item span { 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: #ff0000; 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;
}
.spinner {
    width: 60px; height: 60px; border: 5px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%; border-top-color: #ff0000;
    animation: spin 1s ease-in-out infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.9); display: none; align-items: center;
    justify-content: center; z-index: 15; text-align: center; padding: 20px;
}
.error-card {
    position: relative;
    background: #111; border: 2px solid #ff0000; border-radius: 20px;
    padding: 40px 30px 30px 30px; max-width: 450px; box-shadow: 0 0 30px rgba(255, 0, 0, 0.3);
}
.error-card i { font-size: 50px; color: #ff0000; margin-bottom: 15px; }
.error-card h3 { font-size: 22px; margin-bottom: 10px; }
.error-card p { font-size: 15px; color: #ccc; margin-bottom: 20px; line-height: 1.5; }

.close-error-btn {
    position: absolute; top: 10px; right: 15px; background: none;
    border: none; color: #ff0000; font-size: 32px; font-weight: bold;
    cursor: pointer; transition: color 0.2s ease, transform 0.2s ease;
}
.close-error-btn:hover { color: #fff; transform: scale(1.1); }

.wa-btn {
    display: inline-flex; align-items: center; gap: 10px; background: #25d366;
    color: white; text-decoration: none; padding: 12px 25px; font-weight: bold;
    border-radius: 30px; 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 span { 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 #ff0000; 
        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 #ff0000;
        position: relative;
    }

    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: rgba(255, 0, 0, 0.8);
    }

    /* পোর্ট্রেট মোডে সাইডবার স্টাইল */
    .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;
    }

    .sidebar-title {
        background: #000;
        border-top: 2px solid #ff0000;
        border-bottom: 2px solid #ff0000;
        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 #ff0000;
        border-radius: 12px;
        padding: 6px;
        margin-right: 0;
        margin-bottom: 6px;
        box-shadow: 0 0 8px rgba(255, 0, 0, 0.4);
        transition: transform 0.2s ease-in-out;
        box-sizing: border-box;
    }

    .channel-item.active img {
        border-color: #ff0000;
        box-shadow: 0 0 15px rgba(255, 0, 0, 0.8);
        transform: scale(1.05);
    }

    .channel-item span {
        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: 220px;
        left: 15px;
        padding: 10px;
    }
    .sidebar-title {
        font-size: 14px;
        margin-bottom: 10px;
        padding-bottom: 5px;
    }
    .channel-item {
        padding: 6px 10px;
        margin-bottom: 5px;
    }
    .channel-item img {
        width: 35px;
        height: 22px;
        margin-right: 8px;
    }
    .channel-item span {
        font-size: 13px;
    }
    .bottom-right-controls {
        bottom: 15px;
        right: 15px;
        padding: 8px 16px;
        gap: 10px;
    }
    .bottom-right-controls input[type=range] {
        width: 60px;
    }
}
/* NexoraTV refinements */
:root { --accent: #7c3aed; --accent2: #06b6d4; }
body { background: radial-gradient(circle at 70% 20%, #10162a 0, #03050a 48%, #000 100%); }
.sidebar { border-color: rgba(124,58,237,.9); box-shadow: 0 18px 55px rgba(0,0,0,.45); }
.channel-container::-webkit-scrollbar-thumb, input[type=range] { accent-color: var(--accent); }
.channel-container::-webkit-scrollbar-thumb { background: linear-gradient(var(--accent),var(--accent2)); }
.channel-item.active { background: rgba(124,58,237,.2); border-color: var(--accent); box-shadow: 0 0 18px rgba(124,58,237,.28); }
.spinner { border-top-color: var(--accent2); }
.sidebar-title { justify-content: space-between; }
.sidebar-title span { display:flex; align-items:center; gap:8px; }
.sidebar-title i { color: var(--accent2); }
.sidebar-title small { color:#93a4bd; font-size:11px; font-weight:600; }
.brand-mark { width:28px; height:28px; display:inline-flex; align-items:center; justify-content:center; border-radius:9px; background:linear-gradient(135deg,var(--accent),var(--accent2)); }
.video-badge { position:absolute; top:22px; right:24px; z-index:4; display:flex; align-items:center; gap:8px; max-width:55vw; padding:8px 12px; border-radius:999px; background:rgba(2,6,12,.7); border:1px solid rgba(255,255,255,.14); backdrop-filter:blur(12px); font-size:13px; font-weight:700; }
.live-dot { width:8px; height:8px; border-radius:50%; background:#22c55e; box-shadow:0 0 10px #22c55e; flex:none; }
.loader-overlay { flex-direction:column; gap:14px; }
.loading-text { color:#dbe7f5; font-size:14px; font-weight:650; }
.retry-btn { border:0; border-radius:999px; padding:12px 20px; cursor:pointer; color:#fff; font-weight:800; background:linear-gradient(135deg,var(--accent),var(--accent2)); }
.error-card { border-color:var(--accent); }
.error-card > i, .close-error-btn { color:var(--accent2); }
@media (max-width:768px) and (orientation:portrait) {
  .mobile-top-header { border-bottom-color:var(--accent); }
  .video-container { border-bottom-color:var(--accent); }
  .video-badge { top:10px; right:10px; max-width:70vw; font-size:11px; padding:6px 9px; }
}
