/* ============================================================
   CONTENT LAYOUT — Two-column: left sidebar + main content
   ============================================================ */

.content-layout {
    display: flex;
    align-items: flex-start;
    min-height: 60vh;
    background: var(--bg-primary);
    position: relative;
}

/* ============================================================
   LEFT SIDEBAR
   ============================================================ */

.left-sidebar {
    width: 230px;
    flex-shrink: 0;
    position: sticky;
    top: 64px; /* offset for fixed header */
    height: calc(100vh - 64px);
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
}

.left-sidebar::-webkit-scrollbar {
    width: 4px;
}
.left-sidebar::-webkit-scrollbar-thumb {
    background: #2a2a2a;
    border-radius: 2px;
}

.sidebar-inner {
    padding: 20px 0 40px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* ---- Section ---- */
.sidebar-section {
    padding: 0;
}

.sidebar-section-label {
    display: block;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.4px;
    color: var(--text-secondary);
    padding: 12px 20px 6px;
    text-transform: uppercase;
}

/* ---- Nav list ---- */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 10px;
}

/* ---- Nav item ---- */
.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
    position: relative;
    user-select: none;
}

.sidebar-nav-item i:first-child {
    font-size: 15px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    color: var(--text-secondary);
    transition: color 0.18s ease;
}

.sidebar-nav-item:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-primary);
}

.sidebar-nav-item:hover i:first-child {
    color: var(--brand-red);
}

.sidebar-nav-item.active {
    background: var(--brand-red-light);
    color: var(--brand-red);
}

.sidebar-nav-item.active i:first-child {
    color: var(--brand-red);
}

/* Expandable row */
.sidebar-expandable {
    cursor: pointer;
}

.sidebar-chevron {
    margin-left: auto;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.35) !important;
    transition: transform 0.25s ease, color 0.18s ease;
}

/* ---- Submenu ---- */
.sidebar-submenu {
    max-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 1px;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-submenu.open {
    max-height: 600px;
}

.sidebar-sub-item {
    display: block;
    padding: 7px 12px 7px 42px;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 13px;
    font-weight: 400;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    margin: 0 10px;
    transition: background 0.15s ease, color 0.15s ease;
    cursor: pointer;
}

.sidebar-sub-item:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-primary);
}

.sidebar-sub-item.active {
    color: var(--brand-red);
    background: var(--brand-red-light);
}

/* ---- Divider ---- */
.sidebar-divider {
    height: 1px;
    background: var(--border-color);
    margin: 12px 20px;
}

/* ---- Subscribe CTA block ---- */
.sidebar-cta-block {
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-cta-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #e50914 0%, #c10000 100%);
    color: #fff;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-decoration: none;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(229, 9, 20, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.sidebar-cta-btn i {
    font-size: 13px;
}

.sidebar-cta-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(229, 9, 20, 0.5);
    filter: brightness(1.1);
}

.sidebar-cta-note {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
}

/* ---- Mobile toggle (hidden on desktop) ---- */
.sidebar-mobile-toggle {
    display: none;
}

/* ---- Close button (inside drawer, shown only on mobile) ---- */
.sidebar-close-btn {
    display: none; /* shown via CSS at <=860px */
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 14px 20px 10px;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    margin-bottom: 6px;
    transition: color 0.15s ease;
}

.sidebar-close-btn i {
    font-size: 16px;
}

.sidebar-close-btn:hover {
    color: #fff;
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */

.content-main {
    flex: 1;
    min-width: 0;
    padding: 20px 16px 40px;
}

.content-main-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.content-main-title {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.1px;
    text-transform: none;
    margin: 0;
}

/* Override the video-grid to fit the new 6-column layout */
.content-main .video-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px 10px;
    width: 100%;
    margin-top: 0;
}

/* ---- Thumbnail badge row (duration + views) ---- */
.thumb-badges {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 0 5px 5px;
    pointer-events: none;
}

.duration-badge {
    background: rgba(0, 0, 0, 0.82);
    color: #fff;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 5px;
    border-radius: 3px;
    letter-spacing: 0.3px;
    pointer-events: none;
    white-space: nowrap;
    /* reset any old positioning */
    position: static;
}

.views-badge {
    background: rgba(0, 0, 0, 0.82);
    color: #fff;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 5px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    gap: 3px;
    pointer-events: none;
    white-space: nowrap;
}

.views-badge i {
    font-size: 9px;
    opacity: 0.85;
}

/* Card title — tighter, max 2 lines */
.content-main .video-title {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 5px;
}

/* Thumb aspect ratio — match reference (roughly 16:9) */
.content-main .video-thumb-container {
    aspect-ratio: 16 / 9;
    border-radius: 6px;
}

/* Card gap and hover */
.content-main .video-card {
    gap: 0;
    cursor: pointer;
    border-radius: 6px;
    overflow: hidden;
    transition: transform 0.18s ease;
}

.content-main .video-card:hover {
    transform: scale(1.02);
}

/* ============================================================
   MOBILE HAMBURGER BUTTON (visible only on mobile)
   ============================================================ */

.sidebar-open-btn {
    display: none; /* hidden on desktop */
}

/* ============================================================
   SIDEBAR DRAWER BACKDROP (mobile only)
   ============================================================ */

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(2px);
    z-index: 199;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-backdrop.visible {
    opacity: 1;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1400px) {
    .content-main .video-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 1100px) {
    .content-main .video-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 1024px) {
    .left-sidebar {
        width: 200px;
    }
    .content-main {
        padding: 20px 20px 40px;
    }
    .content-main .video-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 860px) {

    /* ---- Hamburger open button ---- */
    .sidebar-open-btn {
        display: flex;
        align-items: center;
        gap: 7px;
        padding: 7px 12px;
        background: var(--bg-secondary);
        border: 1px solid var(--border-color);
        border-radius: 8px;
        color: var(--text-primary);
        font-family: 'Inter', system-ui, sans-serif;
        font-size: 13px;
        font-weight: 500;
        cursor: pointer;
        flex-shrink: 0;
        transition: background 0.18s ease, color 0.18s ease;
    }

    .sidebar-open-btn:hover {
        background: rgba(255, 255, 255, 0.1);
        color: #fff;
    }

    .sidebar-open-btn i {
        font-size: 14px;
    }

    /* ---- Content header row on mobile ---- */
    .content-main-header {
        display: flex;
        align-items: center;
        gap: 12px;
        flex-wrap: wrap;
    }

    .content-main-title {
        flex: 1;
    }

    /* ---- Sidebar hidden by default on mobile ---- */
    .left-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        z-index: 200;
        transform: translateX(-100%);
        transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
        border-right: 1px solid var(--border-color);
        background: var(--bg-secondary);
        overflow-y: auto;
        overflow-x: hidden;
        /* override sticky positioning */
        padding-top: env(safe-area-inset-top, 0px);
    }

    .left-sidebar.drawer-open {
        transform: translateX(0);
    }

    /* ---- Backdrop ---- */
    .sidebar-backdrop {
        display: block;
        pointer-events: none;
    }

    .sidebar-backdrop.visible {
        pointer-events: all;
    }

    /* ---- Close button inside drawer ---- */
    .sidebar-close-btn {
        display: flex !important;
    }

    /* ---- Content layout no longer column stacks ---- */
    .content-layout {
        flex-direction: row;
    }

    .content-main {
        width: 100%;
        padding: 14px 12px 40px;
    }

    .content-main .video-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
}

@media (max-width: 600px) {
    .content-main .video-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
}

@media (max-width: 400px) {
    .content-main .video-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .content-main {
        padding: 10px 8px 40px;
    }
}
