:root {
    --bg-color: #0f0f12;
    --card-bg: #18181c;
    --accent-color: #ff2a5f;
    --accent-hover: #e01e4f;
    --text-color: #f1f1f5;
    --text-muted: #a0a0ab;
    --border-color: #2a2a32;
    --input-bg: #222228;
    --header-bg: rgba(15, 15, 18, 0.95);
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* Light Theme Variables */
body:not(.dark-theme) {
    --bg-color: #f5f5f8;
    --card-bg: #ffffff;
    --text-color: #121215;
    --text-muted: #666673;
    --border-color: #e1e1e8;
    --input-bg: #eaeaea;
    --header-bg: rgba(245, 245, 248, 0.95);
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
}

/* Modern 2-Row Header Design */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Row 1: Logo and Navigation Actions */
.nav-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo a {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-color);
    text-decoration: none;
    letter-spacing: -0.5px;
}

.logo .highlight {
    color: var(--accent-color);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-icon-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.nav-icon-btn:hover {
    background: var(--accent-color);
    color: #ffffff;
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

/* Row 2: Full Width Search Bar */
.nav-bottom {
    width: 100%;
}

.search-box {
    display: flex;
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.search-box:focus-within {
    border-color: var(--accent-color);
}

.search-box input {
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-color);
    font-size: 0.95rem;
}

.search-box button {
    padding: 0 20px;
    background: var(--accent-color);
    border: none;
    color: #ffffff;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.search-box button:hover {
    background: var(--accent-hover);
}

/* Main Layout Structure */
.main-layout {
    display: flex;
    min-height: calc(100vh - 140px);
}

/* Sidebar Styles */
.sidebar {
    width: 240px;
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    padding: 20px 12px;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    border-radius: 10px;
    transition: all 0.2s;
}

.sidebar a:hover, .sidebar a.active {
    background: var(--accent-color);
    color: #ffffff;
}

/* Content Area & Category Bar (Updated) */
.content {
    flex: 1;
    padding: 20px;
    min-width: 0; /* Flexbox overflow bugs সমাধান করার জন্য */
}

.category-bar {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 8px;
    margin-bottom: 20px;
    width: 100%;
    /* সুন্দর স্ক্রোলিংয়ের জন্য */
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* স্ক্রোলবার লুকিয়ে ফেলার জন্য (অপশনাল কিন্তু ক্লিন লুকের জন্য কার্যকর) */
.category-bar::-webkit-scrollbar {
    display: none;
}
.category-bar {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

.cat-btn {
    padding: 8px 18px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0; /* বাটনগুলোকে চেপে যাওয়া থেকে রক্ষা করবে */
    transition: all 0.2s;
}

.cat-btn.active, .cat-btn:hover {
    background: var(--accent-color);
    color: #ffffff;
    border-color: var(--accent-color);
}


/* ==========================================================================
   Video Card & Responsive Layout Fixes
   ========================================================================== */

/* Video Grid Correction */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    width: 100%;
}

/* Responsive Card Box */
.video-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
}

.video-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.video-card a {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* Thumbnail Box (Prevents Overflow) */
.video-card img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    background-color: var(--input-bg);
}

/* Card Info Alignment */
.video-card .video-info, 
.video-card-content {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Title Truncation Fix */
.video-card h3, 
.video-card h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-color);
    line-height: 1.4;
    margin: 8px 12px 4px 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* ২ লাইনের বেশি হলে কেটে যাবে */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
}

/* Views & Category Meta Alignment */
.video-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0 12px 12px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.video-card p i {
    color: var(--accent-color);
}

/* Responsive Embed Player for watch.html */
.player-wrapper {
    width: 100%;
    max-width: 100%;
    margin-bottom: 20px;
}

.embed-responsive-16by9 {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
    border-radius: 12px;
    background: #000;
}

.embed-responsive-16by9 iframe,
.embed-responsive-16by9 embed,
.embed-responsive-16by9 object,
.embed-responsive-16by9 video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

footer{
  text-align: center;
}
/* Mobile Devices Optimization */
@media (max-width: 600px) {
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(100%, 1fr));
        gap: 16px;
    }
    
    .content {
        padding: 12px;
    }
}



/* Sidebar Overlay for Mobile/Toggle */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Right Side Drawer Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    right: -280px; /* ডানপাশে লুকিয়ে থাকবে */
    left: auto;
    width: 280px;
    height: 100vh;
    background: var(--card-bg);
    border-left: 1px solid var(--border-color);
    border-right: none;
    padding: 24px 16px;
    z-index: 1002;
    transition: right 0.3s ease-in-out;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.3);
}

.sidebar.active {
    right: 0; /* ডানপাশ থেকে স্ক্রিনে আসবে */
}

/* Close Button inside Sidebar Header */
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h3 {
    font-size: 1.2rem;
    color: var(--text-color);
}

.close-sidebar-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
    transition: color 0.2s;
}

.close-sidebar-btn:hover {
    color: var(--accent-color);
}



/* PWA Bottom Toast Popup Design */
.pwa-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(150%);
    width: calc(100% - 32px);
    max-width: 420px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    box-shadow: var(--shadow);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* JavaScript দিয়ে ক্লাস অ্যাড করলে এটি স্ক্রিনে আসবে */
.pwa-toast.show {
    transform: translateX(-50%) translateY(0);
}

.pwa-toast-content {
    display: flex;
    align-items: center;
    gap: 14px;
}

.pwa-icon {
    width: 44px;
    height: 44px;
    background: rgba(255, 42, 95, 0.1);
    color: var(--accent-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.pwa-text h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 2px;
}

.pwa-text p {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.3;
}

.pwa-toast-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.pwa-btn-install {
    background: var(--accent-color);
    color: #ffffff;
    border: none;
    padding: 8px 18px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.pwa-btn-install:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.pwa-btn-dismiss {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.2s;
}

.pwa-btn-dismiss:hover {
    background: var(--input-bg);
    color: var(--text-color);
}
