:root {
    /* Premium Modern Color Palette */
    --primary: #6366f1;      /* Deep Indigo */
    --secondary: #8b5cf6;    /* Violet */
    --accent: #0ea5e9;       /* Cyan/Light Blue for focus */
    --bg-dark: #0b1121;      /* Midnight Blue */
    --card-bg: rgba(30, 41, 59, 0.6);      /* Glassy Slate */
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    /* Structure */
    --radius-main: 24px;
    --radius-btn: 14px;
    --soft-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --glow-shadow: 0 10px 40px -10px rgba(99, 102, 241, 0.3);
}

*, *::before, *::after { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    font-family: 'Poppins', 'Hind Siliguri', sans-serif;
}

body {
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    padding: clamp(10px, 3vw, 20px);
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.12) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(14, 165, 233, 0.1) 0%, transparent 50%);
    background-attachment: fixed;
    line-height: 1.6;
}

.container, .shared-style-box { 
    max-width: 1050px; 
    margin: 0 auto; 
    position: relative; 
    z-index: 1; 
    width: 100%;
}

/* Navigation */
nav {
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    padding: clamp(15px, 3vw, 20px) clamp(20px, 4vw, 35px); 
    background: var(--card-bg); 
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--radius-main);
    border: 1px solid var(--glass-border); 
    margin-bottom: clamp(25px, 5vw, 40px); 
    box-shadow: var(--soft-shadow);
    flex-wrap: wrap;
    gap: 10px;
}
.logo { 
    font-size: clamp(1.4rem, 4vw, 2rem); 
    font-weight: 800; 
    color: #fff; 
    letter-spacing: 1.5px; 
    text-transform: uppercase; 
}
.logo span { 
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.nav-subtitle { 
    font-size: clamp(0.75rem, 2vw, 0.9rem); 
    color: var(--text-muted); 
    font-weight: 500; 
    letter-spacing: 2px; 
    text-transform: uppercase; 
}

.hidden { display: none !important; }

/* Headings */
h2 { 
    font-weight: 800; 
    color: #fff; 
    text-align: center; 
    font-size: clamp(1.4rem, 5vw, 2.2rem); 
    margin-bottom: clamp(20px, 4vw, 35px);
    text-shadow: 0 4px 20px rgba(0,0,0,0.3);
    line-height: 1.3;
}

/* Back Button */
.btn-back {
    background: rgba(255, 255, 255, 0.05); 
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    color: var(--text-muted); 
    padding: clamp(8px, 2vw, 12px) clamp(16px, 3vw, 24px); 
    border-radius: 30px;
    cursor: pointer; 
    margin-bottom: clamp(20px, 3vw, 30px); 
    transition: all 0.3s ease; 
    font-size: clamp(0.85rem, 2vw, 0.95rem);
    font-weight: 600;
    display: inline-flex; 
    align-items: center; 
    justify-content: center;
    gap: 8px;
}
.btn-back:hover { 
    background: var(--primary); 
    color: #fff; 
    border-color: var(--primary);
    transform: translateX(-5px);
    box-shadow: var(--glow-shadow);
}

/* Search Box Area */
.search-wrapper {
    display: flex; 
    justify-content: center; 
    gap: 12px; 
    margin-bottom: clamp(30px, 5vw, 40px); 
    flex-wrap: wrap; 
    width: 100%;
}
input[type="text"] {
    width: 100%;
    max-width: 500px; 
    padding: clamp(12px, 2.5vw, 16px) clamp(16px, 3vw, 24px); 
    border-radius: 30px !important;
    border: 1px solid var(--glass-border) !important;
    background: rgba(15, 23, 42, 0.6) !important;
    color: #fff !important; 
    font-size: clamp(0.9rem, 2vw, 1rem);
    backdrop-filter: blur(10px); 
    transition: 0.3s;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}
input[type="text"]:focus {
    outline: none; 
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2) !important;
}
input[type="text"]::placeholder { color: var(--text-muted) !important; }
.search-btn {
    padding: clamp(12px, 2.5vw, 16px) clamp(20px, 4vw, 32px); 
    border-radius: 30px; 
    background: linear-gradient(135deg, var(--primary), var(--secondary)); 
    color: white; 
    border: none; 
    cursor: pointer; 
    font-weight: 600; 
    font-size: clamp(0.9rem, 2vw, 1rem);
    transition: all 0.3s ease; 
    box-shadow: var(--glow-shadow);
    white-space: nowrap;
    flex: 1 1 auto;
    max-width: 200px;
}
.search-btn:hover { transform: translateY(-2px); filter: brightness(1.1); }

/* Grids & Cards */
.grid-layout {
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: clamp(15px, 3vw, 25px); 
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.card {
    background: var(--card-bg); 
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    padding: clamp(25px, 4vw, 40px) clamp(15px, 3vw, 25px); 
    border-radius: var(--radius-main); 
    text-align: center;
    cursor: pointer; 
    transition: all 0.4s ease;
    box-shadow: var(--soft-shadow);
    position: relative; 
    overflow: hidden;
    display: flex; 
    align-items: center; 
    justify-content: center;
    min-height: 120px;
}
.card::before {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
    opacity: 0; transition: opacity 0.4s ease; pointer-events: none;
}
.card:hover { 
    transform: translateY(-5px); 
    border-color: rgba(99, 102, 241, 0.5); 
    box-shadow: var(--glow-shadow);
}
.card:hover::before { opacity: 1; }
.card h3 { 
    font-size: clamp(1.1rem, 2.5vw, 1.3rem); 
    letter-spacing: 0.5px; 
    font-weight: 700; 
    color: #fff; 
    margin: 0; 
    line-height: 1.4;
}

/* List Items (Chapters/Videos) */
.list-item {
    background: var(--card-bg); 
    padding: clamp(15px, 3vw, 20px) clamp(15px, 3vw, 25px); 
    border-radius: var(--radius-btn);
    margin-bottom: 16px; 
    display: flex; 
    justify-content: space-between;
    align-items: center; 
    cursor: pointer; 
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease; 
    backdrop-filter: blur(12px);
    font-size: clamp(0.95rem, 2.5vw, 1.05rem); 
    font-weight: 500; 
    gap: 15px;
    flex-wrap: wrap; 
}
.list-item:hover { 
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px -5px rgba(14, 165, 233, 0.25);
    background: rgba(30, 41, 59, 0.9);
    color: white;
}
.list-item span:first-child { 
    flex: 1 1 50%; 
    line-height: 1.4; 
    word-break: break-word;
}

/* শুধুমাত্র ভিডিও লিস্টের টাইটেলের জন্য font-weight: 300 */
#video-list-container .list-item span:first-child {
    font-weight: 300 !important;
}
.play-icon { 
    color: #fff; 
    font-weight: 600; 
    font-size: clamp(0.75rem, 2vw, 0.85rem); 
    background: linear-gradient(135deg, var(--primary), var(--secondary)); 
    padding: 8px 16px; 
    border-radius: 20px; 
    box-shadow: 0 4px 15px rgba(99,102,241,0.3);
    white-space: nowrap; 
    text-align: center;
}

/* Custom Video Player */
.custom-video-container {
    position: relative; 
    background: #000; 
    border-radius: var(--radius-main);
    overflow: hidden; 
    aspect-ratio: 16/9; 
    margin: 0 auto clamp(20px, 4vw, 30px) auto;
    box-shadow: 0 20px 50px -10px rgba(0,0,0,0.7);
    border: 1px solid rgba(255,255,255,0.1);
    display: flex; 
    flex-direction: column; 
    width: 100%;
}
.resize-handle {
    position: absolute; bottom: 0; right: 0; width: 20px; height: 20px;
    background: rgba(255,255,255,0.1); cursor: nwse-resize; z-index: 999;
    border-top-left-radius: 12px; backdrop-filter: blur(4px);
}
@media (min-width: 1025px) { 
    .custom-video-container { 
        resize: horizontal; 
        height: auto; 
    } 
}
@media (max-width: 1024px) {
    .custom-video-container { resize: none !important; }
    .resize-handle { display: none !important; pointer-events: none !important; }
}
        
#yt-player { width: 100%; height: 100%; pointer-events: none; }
.video-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 70px; z-index: 10; cursor: pointer; }

/* Controls - YouTube Like Layout */
.custom-controls {
    position: absolute; 
    bottom: 0; left: 0; right: 0;
    /* ইউটিউবের মতো স্মুথ শ্যাডো গ্র্যাডিয়েন্ট */
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.4) 60%, transparent 100%);
    padding: 0 15px 10px 15px; 
    display: flex; 
    flex-direction: column; 
    z-index: 20; 
    /* এনিমেশনের মূল কোড এখানে */
    opacity: 0; 
    transform: translateY(100%); /* ডিফল্টভাবে ১০০% নিচে থাকবে (লুকানো) */
    transition: opacity 0.4s ease, transform 0.4s ease; /* ০.৪ সেকেন্ডে স্মুথলি মুভ করবে */
}
.custom-video-container .custom-controls { opacity: 0; }
.custom-video-container.show-controls .custom-controls { opacity: 1; transform: translateY(0); }
.custom-video-container.hide-cursor, .custom-video-container.hide-cursor .video-overlay { cursor: none; }

/* Progress Bar Container */
.progress-wrapper {
    width: 100%;
    height: 15px; /* ক্লিক করার জন্য বড় জায়গা */
    display: flex;
    align-items: center;
    cursor: pointer;
    margin-bottom: 5px;
}
.progress-container {
    width: 100%; height: 4px; /* ইউটিউবের মতো চিকন */
    background: rgba(255,255,255,0.2);
    position: relative; transition: height 0.1s ease;
}
.progress-wrapper:hover .progress-container { height: 6px; /* হোভার করলে মোটা হবে */ }

.progress-bar {
    height: 100%; background: var(--accent); width: 0%; position: relative;
}
.progress-bar::after {
    content: ''; position: absolute; right: -6px; top: 50%; transform: translateY(-50%) scale(0); 
    width: 13px; height: 13px; background: var(--accent); border-radius: 50%; 
    transition: transform 0.1s ease;
}
.progress-wrapper:hover .progress-bar::after { transform: translateY(-50%) scale(1); } /* হোভার করলে গোল বাটন আসবে */

/* Main Buttons Layout */
.controls-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
.controls-left, .controls-right {
    display: flex;
    align-items: center;
    gap: 15px; /* বাটনগুলোর মাঝের গ্যাপ */
}

/* Control Buttons - No background circle, just the icon like YT */
.control-btn {
    background: transparent; border: none; color: #fff; 
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: 0.2s; padding: 5px; 
}
.control-btn:hover { color: var(--accent); transform: scale(1.1); }
.control-btn svg { width: clamp(22px, 3vw, 26px); height: clamp(22px, 3vw, 26px); fill: currentColor; }

/* Time Display */
.time-display { 
    font-size: clamp(0.75rem, 2vw, 0.85rem); 
    font-weight: 500; color: #e2e8f0; 
    margin-left: 5px; font-variant-numeric: tabular-nums; white-space: nowrap; 
}

/* Volume Layout */
.volume-container { display: flex; align-items: center; gap: 5px; }
.volume-slider {
    width: 0; opacity: 0; height: 4px; -webkit-appearance: none; background: rgba(255,255,255,0.3);
    cursor: pointer; transition: width 0.3s, opacity 0.3s; transform-origin: left;
}
/* ইউটিউবের মতো ভলিউম বাটনে হোভার করলে স্লাইডার বের হবে */
.volume-container:hover .volume-slider { width: 70px; opacity: 1; margin-left: 5px; }

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none; width: 12px; height: 12px; background: #fff; border-radius: 50%;
}

/* Speed Dropdown */
.speed-wrapper { position: relative; display: inline-flex; align-items: center; }
.speed-select {
    background: transparent; border: none; color: #fff; cursor: pointer;
    font-size: clamp(0.85rem, 2vw, 0.95rem); font-weight: 600; outline: none;
}
.speed-select option { background: var(--bg-dark); color: #fff; }
body.light-mode .speed-select option { background: #ffffff !important; color: #0f172a !important; }
/* Meta Boxes & Buttons */
.video-meta {
    background: var(--card-bg); padding: clamp(20px, 4vw, 30px); border-radius: var(--radius-main);
    border: 1px solid var(--glass-border); box-shadow: var(--soft-shadow);
    backdrop-filter: blur(16px); margin-top: 20px;
}
#vid-title { font-weight: 300 !important; font-size: clamp(1.2rem, 4vw, 1.6rem); line-height: 1.4; }
.mat-box { display: flex; gap: clamp(10px, 2vw, 15px); margin-top: clamp(15px, 3vw, 20px); flex-wrap: wrap; }

.action-btn {
    padding: clamp(10px, 2vw, 14px) clamp(20px, 4vw, 28px); 
    border-radius: 30px; text-decoration: none;
    font-weight: 600; font-size: clamp(0.85rem, 2vw, 0.95rem); 
    transition: all 0.3s ease; 
    display: inline-flex; align-items: center; gap: 8px;
    border: none; text-transform: uppercase; letter-spacing: 1px; color: white;
    text-align: center; justify-content: center;
    flex: 1 1 calc(50% - 15px);
    min-width: 150px;
}
.btn-slide { background: linear-gradient(135deg, #f59e0b, #d97706); box-shadow: 0 4px 15px rgba(245,158,11,0.3); }
.btn-sheet { background: linear-gradient(135deg, var(--primary), var(--secondary)); box-shadow: var(--glow-shadow); }
.action-btn:hover { transform: translateY(-3px); filter: brightness(1.1); }

/* Alerts / External Link boxes */
.alert-box {
    text-align: center; padding: clamp(20px, 5vw, 40px) clamp(15px, 3vw, 20px); 
    margin-bottom: 30px; 
    border-radius: var(--radius-main); backdrop-filter: blur(10px);
    background: rgba(15, 23, 42, 0.5);
}
.alert-dashed-primary { border: 2px dashed var(--primary); }
.alert-dashed-danger { border: 2px dashed #f87171; }

@keyframes slideUp { 
    from { opacity: 0; transform: translateY(30px); } 
    to { opacity: 1; transform: translateY(0); } 
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

#time-preview {
    position: absolute; bottom: 25px; background: #fff; color: #0f172a;
    padding: 4px 8px; border-radius: 6px; font-weight: bold; font-size: 12px;
    display: none; pointer-events: none; transform: translateX(-50%);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

/* Theme Toggle Button */
.theme-btn {
    position: absolute; top: clamp(15px, 3vw, 20px); right: clamp(15px, 3vw, 20px); z-index: 9999;
    width: clamp(40px, 8vw, 50px); height: clamp(40px, 8vw, 50px); border-radius: 50%;
    background: rgba(255,255,255,0.1); border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px); cursor: pointer; display: flex; align-items: center; 
    justify-content: center; font-size: clamp(1.2rem, 3vw, 1.5rem); transition: all 0.3s ease;
    box-shadow: var(--soft-shadow);
}
.theme-btn:hover {
    transform: rotate(15deg) scale(1.1);
    background: var(--primary); border-color: var(--primary);
}
.sun-moon-container { transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1); }

/* =========================================
   LIGHT MODE REVAMP
   ========================================= */
body.light-mode {
    --bg-dark: #f0f4f8;
    --card-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(0, 0, 0, 0.05);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --soft-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.08);
    --glow-shadow: 0 10px 30px -10px rgba(99, 102, 241, 0.2);
    
    background-image: 
        radial-gradient(circle at 0% 0%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(14, 165, 233, 0.08) 0%, transparent 50%);
}
body.light-mode .card:hover, body.light-mode .list-item:hover {
    border-color: rgba(99, 102, 241, 0.3);
}
body.light-mode .btn-back { background: rgba(255,255,255,0.9); color: var(--text-main); }
body.light-mode input[type="text"] { background: rgba(255, 255, 255, 0.8) !important; color: #1e293b !important; }
body.light-mode h1, body.light-mode h2, body.light-mode h3 { color: #0f172a !important; }
body.light-mode .custom-controls span, body.light-mode .custom-controls div,
body.light-mode .time-display, body.light-mode #volume-display,
body.light-mode #current-time, body.light-mode #duration { color: #ffffff !important; }
body.light-mode .sun-moon-container { transform: rotate(360deg); }
body.light-mode .play-icon { color: #fff; }
body.light-mode .alert-box { background: rgba(255,255,255,0.8); }
body.light-mode .logo { color: #0f172a; }

/* =========================================
   MOBILE RESPONSIVENESS (Media Queries)
   ========================================= */

@media (max-width: 1024px) {
    .container { width: 100%; }
}

@media (max-width: 768px) {
    nav { 
        flex-direction: column; 
        gap: 10px; 
        align-items: flex-start;
    }
    .theme-btn {
        top: 20px !important; 
        right: 20px !important;
    }
    .grid-layout { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
    .action-btn { flex: 1 1 100%; }
    
    /* মোবাইলের জন্য ভলিউম কন্ট্রোল হাইড করা হলো */
    .volume-container { display: none !important; }
}

@media (max-width: 480px) {
    .grid-layout { grid-template-columns: 1fr; } 
    input[type="text"], .search-btn { max-width: 100%; }
    
    .list-item { flex-direction: column; align-items: stretch; gap: 12px; }
    .list-item span:first-child { text-align: center; }
    .play-icon { width: 100%; justify-content: center; }
    
    /* Video Player Mobile Focus - YT Like */
    .custom-controls { padding: 0 10px 10px 10px; }
    .controls-left { gap: 10px; }
    .controls-right { gap: 10px; }
    .volume-container { display: none; } /* মোবাইলে ভলিউম বাটন দরকার নেই */
    .speed-wrapper { display: none; } /* জায়গা বাঁচাতে স্পিড বাটন হাইড করা হলো */
    .time-display { font-size: 0.7rem; }
    .btn-back { width: 100%; }
}

/* Video specific fixes */
/* .custom-video-container iframe {
    filter: brightness(1.04) contrast(1.10) !important;
    -webkit-filter: brightness(1.04) contrast(1.10) !important;
    image-rendering: crisp-edges !important;               
    transform: translateZ(0) !important; 
    -webkit-transform: translateZ(0) !important; 
} */
 /* Video specific fixes - Enhanced Mode */
.custom-video-container iframe {
    /* Edge-like Color Pop & Clarity */
    filter: saturate(1.15) contrast(1.12) brightness(1.03) !important;
    -webkit-filter: saturate(1.15) contrast(1.12) brightness(1.03) !important;
    
    /* Advanced Image Rendering for Sharpness */
    image-rendering: -webkit-optimize-contrast !important; /* Safari/Webkit sharpening */
    image-rendering: crisp-edges !important;               
    
    /* Force GPU Acceleration for smooth playback */
    transform: translateZ(0) !important; 
    -webkit-transform: translateZ(0) !important;
    backface-visibility: hidden !important;
    
    /* Hint to browser for optimization */
    will-change: transform, filter !important;
    
    width: 100%;
    height: 100%;
    pointer-events: none; /* Already in your JS, keeping fallback here */
}
.volume-status-overlay {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: rgba(15, 23, 42, 0.8); border: 1px solid var(--glass-border); color: white;
    backdrop-filter: blur(8px); padding: clamp(15px, 4vw, 20px) clamp(20px, 5vw, 30px); border-radius: 20px; display: flex; flex-direction: column;
    align-items: center; gap: 10px; z-index: 100; pointer-events: none; transition: opacity 0.3s ease;
}
.volume-status-overlay svg { width: clamp(30px, 8vw, 40px); height: clamp(30px, 8vw, 40px); fill: var(--accent); }
.volume-status-overlay span { font-size: clamp(1rem, 3vw, 1.2rem); font-weight: bold; }

#video-container:fullscreen { resize: none !important; border-radius: 0 !important; }
#video-container:fullscreen .resize-handle { display: none !important; }

body.normal-yt-mode .custom-controls,
body.normal-yt-mode .video-overlay,
body.normal-yt-mode .resize-handle { display: none !important; }
body.normal-yt-mode #yt-player { pointer-events: auto !important; }

#site-loader-container { position: fixed; top: 0; left: 0; width: 100%; height: 0; background: transparent; z-index: 99999; display: none; overflow: visible; }
#site-loader-container.active-lock { height: 100vh !important; pointer-events: all !important; }
#site-loader-bar { position: absolute; top: 0; left: 0; width: 0%; height: 4px; background: var(--accent); box-shadow: 0 0 15px var(--accent); transition: width 0.3s ease-in-out; }
.fade-out { opacity: 0; transition: opacity 0.5s ease; }
/* Live Video Progress Badge */
.live-progress-badge {
    position: absolute;
    /* top: 15px;
    right: 15px; */
    top: 0;
    right: 0;
    background: rgb(0, 0, 0); 
    color: rgba(255, 255, 255, 0.7); 
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px; 
    font-weight: 500;
    letter-spacing: 0.5px;
    pointer-events: none; 
    z-index: 2147483647; /* <-- এই লাইনটি পরিবর্তন করা হয়েছে */
    backdrop-filter: blur(2px); 
    user-select: none;
    text-transform: uppercase;
}
/* Inline Materials Design */
.inline-materials {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 5px;
    
}
.inline-mat-btn {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 300;
    text-decoration: none;
    border: 1px solid rgba(99, 102, 241, 0.3);
    transition: all 0.3s ease;
    white-space: nowrap;
}
.inline-mat-btn:hover {
    background: rgba(99, 102, 241, 0.4);
    color: #fff;
    transform: translateY(-2px);
}
body.light-mode .inline-mat-btn {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    border-color: rgba(99, 102, 241, 0.3);
}
body.light-mode .inline-mat-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    color: white;
}
/* Active Panel Styles */
#active-panel-container {
    position: fixed;
    bottom: 75px; /* নতুন বাটনের ঠিক উপরে দেখানোর জন্য */
    right: 20px;
    width: 300px;
    background: var(--bg-dark);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-main);
    padding: 15px;
    z-index: 1000;
    box-shadow: var(--soft-shadow);
    max-height: 350px;
    display: flex;
    flex-direction: column;
}
.active-users-btn {
    position: fixed; 
    bottom: 20px; 
    right: 20px; 
    z-index: 999;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white; 
    border: none; 
    border-radius: 30px;
    padding: 10px 18px; 
    font-size: 1rem; 
    cursor: pointer;
    box-shadow: var(--soft-shadow); 
    transition: all 0.3s ease;
    display: flex; 
    align-items: center; 
    gap: 8px; 
    font-weight: 600;
}
.active-users-btn:hover { 
    transform: translateY(-3px); 
    box-shadow: var(--glow-shadow); 
}
.active-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 10px;
    margin-bottom: 10px;
}
.active-panel-header h3 {
    font-size: 1rem;
    color: #10b981;
    margin: 0;
}
.notify-controls button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    opacity: 0.7;
    transition: 0.3s;
}
.notify-controls button:hover { opacity: 1; }
#active-users-list {
    overflow-y: auto;
    flex-grow: 1;
}
.active-user-item {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.active-user-item .user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
}
.active-user-item .user-activity {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 3px;
    line-height: 1.2;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 20px;          /* স্ক্রিনের উপর থেকে ২০ পিক্সেল নিচে থাকবে */
    left: 50%;          /* স্ক্রিনের আড়াআড়িভাবে মাঝখানে নেওয়ার জন্য */
    transform: translateX(-50%); /* নিখুঁতভাবে সেন্টারে বসানোর জন্য */
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    width: auto;        /* কন্টেন্ট অনুযায়ী চওড়া হবে */
    max-width: 90%;     /* মোবাইলে যাতে স্ক্রিনের বাইরে না যায় */
}

.toast-notification {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 12px 25px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
    text-align: center;
    white-space: nowrap; /* লেখা যেন এক লাইনে থাকে */
    animation: toastSlideDown 0.4s ease forwards;
}

@keyframes toastSlideDown {
    from { 
        opacity: 0; 
        transform: translateY(-20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    /* মোবাইলের জন্য প্যানেলের সাইজ ঠিক করা হলো */
    #active-panel-container { 
        width: calc(100% - 40px); /* স্ক্রিনের সাথে মানিয়ে নেওয়ার জন্য */
        bottom: 80px; 
    } 
    #toast-container { top: auto; bottom: 20px; left: 50%; transform: translateX(-50%); right: auto; }
}
body.light-mode #time-preview {
    color: #0f172a !important;
}
/* =========================================
   YOUTUBE STYLE THUMBNAIL CARDS
   ========================================= */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    width: 100%;
}

.thumb-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    background: var(--card-bg);
    border-radius: var(--radius-main);
    overflow: hidden;
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: var(--soft-shadow);
}

.thumb-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--glow-shadow);
    border-color: var(--accent);
}

.thumb-image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #1e293b;
    overflow: hidden;
}

.thumb-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.thumb-card:hover .thumb-image-wrapper img {
    transform: scale(1.05);
}

.thumb-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    backdrop-filter: blur(4px);
}

.thumb-content {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.thumb-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-main);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.thumb-materials {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: auto; /* Pushes materials to the bottom */
    padding-top: 10px;
}

body.light-mode .thumb-card {
    background: rgba(255, 255, 255, 0.9);
}
body.light-mode .thumb-title {
    color: #0f172a;
}
/* ভিডিও লিস্টের টাইটেল নরমাল ফন্ট করার জন্য */
.video-item-title {
    font-size: 1.05rem;
    font-weight: 300 !important; /* এখানে নরমাল ফন্ট ওয়েট দেওয়া হয়েছে */
    color: var(--text-main);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* সাবজেক্ট কার্ডের আইকন স্টাইল */
.subject-icon {
    font-size: 5rem;
    opacity: 0.8;
    filter: drop-shadow(0 5px 15px rgba(0,0,0,0.2));
}
/* =========================================
   CHAPTER NAVIGATION TABS (WITH ARROWS)
   ========================================= */
.tabs-wrapper {
    display: flex;
    align-items: center;
    position: relative;
    margin-bottom: 25px;
    width: 100%;
}

.chapter-nav-tabs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    flex-grow: 1;
    padding: 5px 0; /* পরিবর্তন: ডানে-বামের প্যাডিং সরিয়ে দেওয়া হয়েছে যাতে প্রথম ও শেষ ট্যাব একদম এলাইনমেন্টে থাকে */
}

.chapter-nav-tabs::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera - স্ক্রলবার হাইড */
}

.chapter-tab {
    padding: 10px 20px;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.chapter-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.chapter-tab.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-color: transparent;
}

/* Light Mode Support for Tabs */
body.light-mode .chapter-tab {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
    color: var(--text-muted);
}

body.light-mode .chapter-tab:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-main);
}

body.light-mode .chapter-tab.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

/* Arrow Styles */
.tab-arrow {
    position: absolute; /* পরিবর্তন: বাটনগুলোকে ভাসমান করা হয়েছে */
    top: 50%; /* পরিবর্তন: লম্বালম্বি মাঝখানে আনার জন্য */
    transform: translateY(-50%); /* পরিবর্তন: লম্বালম্বি মাঝখানে আনার জন্য */
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.5); /* পরিবর্তন: শ্যাডো একটু কমানো/বাড়ানো হয়েছে যাতে স্পষ্ট বোঝা যায় */
    transition: 0.3s;
    font-size: 14px;
}

.tab-arrow:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.left-arrow { 
    left: 0; /* পরিবর্তন: একদম বামে সেট করা হয়েছে */
}
.right-arrow { 
    right: 0; /* পরিবর্তন: একদম ডানে সেট করা হয়েছে */
}

.tab-arrow.hidden {
    display: none !important;
}

body.light-mode .tab-arrow {
    background: rgba(255, 255, 255, 0.9);
    color: #0f172a;
}
body.light-mode .tab-arrow:hover {
    background: var(--primary);
    color: white;
}
/* চ্যাপ্টার ম্যাটেরিয়ালস এর লেখার ফন্ট ওয়েট 300 করার জন্য */
#chap-materials .action-btn, #slide-buttons-container .action-btn {
    font-weight: 300 !important;
}
/* Global Search Specific */
.global-search-wrapper {
    margin: 0 auto clamp(20px, 4vw, 30px) auto;
    max-width: 800px;
}
.search-section-title {
    color: var(--accent);
    margin: 30px 0 15px 5px;
    font-size: 1.3rem;
    font-weight: 600;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 10px;
}
.search-chapter-title {
    margin-top: 40px; 
    text-align: left; 
    color: #fff; 
    border-bottom: 2px solid var(--primary); 
    padding-bottom: 10px;
    font-size: 1.8rem;
    font-weight: 300;
    text-shadow: none;
}
body.light-mode .search-chapter-title {
    color: #0f172a;
}
/* =========================================
   UI/UX UPGRADES (ANIMATIONS & EFFECTS)
   ========================================= */

/* ১. অ্যানিমেটেড ব্যাকগ্রাউন্ড */
body {
    background-size: 200% 200%;
    animation: gradientMove 15s ease infinite;
}

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ২. স্মুথ স্ক্রিন ট্রানজিশন */
.screen-transition {
    animation: screenFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes screenFadeIn {
    0% { opacity: 0; transform: translateY(15px) scale(0.98); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ৩. কার্ডগুলোর স্ট্যাগার অ্যানিমেশন (একটার পর একটা আসবে) */
.thumb-card {
    animation: popIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes popIn {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* কার্ডের ডিলে (Delay) সেট করা */
.thumb-card:nth-child(1) { animation-delay: 0.05s; }
.thumb-card:nth-child(2) { animation-delay: 0.1s; }
.thumb-card:nth-child(3) { animation-delay: 0.15s; }
.thumb-card:nth-child(4) { animation-delay: 0.2s; }
.thumb-card:nth-child(5) { animation-delay: 0.25s; }
.thumb-card:nth-child(6) { animation-delay: 0.3s; }
.thumb-card:nth-child(7) { animation-delay: 0.35s; }
.thumb-card:nth-child(8) { animation-delay: 0.4s; }

/* ৪. রিপল ইফেক্ট (Ripple) এর স্টাইল */
.ripple {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    animation: ripple-anim 0.6s linear;
    background-color: rgba(255, 255, 255, 0.4);
    pointer-events: none;
}

@keyframes ripple-anim {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

.action-btn, .chapter-tab, .search-btn, .btn-back {
    position: relative;
    overflow: hidden;
}
/* =========================================
   YOUTUBE LIKE SEEK ANIMATION
   ========================================= */
.seek-ripple {
    position: absolute;
    top: 0; bottom: 0;
    width: 30%;
    background: rgba(255, 255, 255, 0.15);
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s;
    z-index: 50;
}
.seek-ripple.left { left: 0; border-top-right-radius: 100%; border-bottom-right-radius: 100%; }
.seek-ripple.right { right: 0; border-top-left-radius: 100%; border-bottom-left-radius: 100%; }
.seek-ripple.animate { animation: rippleFade 0.6s ease-out; }

.seek-arrows { display: flex; gap: 5px; color: white; font-size: 24px; font-weight: bold; }
.seek-arrows span { animation: arrowBlink 0.6s infinite; opacity: 0.3; }
.seek-arrows.left-dir span:nth-child(1) { animation-delay: 0.0s; }
.seek-arrows.left-dir span:nth-child(2) { animation-delay: 0.2s; }
.seek-arrows.left-dir span:nth-child(3) { animation-delay: 0.4s; }
.seek-arrows span:nth-child(1) { animation-delay: 0.4s; }
.seek-arrows span:nth-child(2) { animation-delay: 0.2s; }
.seek-arrows span:nth-child(3) { animation-delay: 0.0s; }

.seek-text { color: white; font-weight: bold; margin-top: 10px; font-size: 14px; }

@keyframes rippleFade {
    0% { opacity: 0.8; width: 25%; }
    100% { opacity: 0; width: 35%; }
}
@keyframes arrowBlink {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* --- Force Hide Volume on Mobile Devices (including landscape) --- */
@media (hover: none) and (pointer: coarse) {
    .volume-container { display: none !important; }
}