/**
 * Hyperdope Homepage & Search Styles
 * Responsive layouts for homepage sections and search results
 * Version: 1.0.0 (October 2025)
 */

/* ===== COMMON GRID LAYOUTS ===== */

.content-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.section {
    margin-bottom: 50px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #ff6600;
}

.section-title {
    font-size: 24px;
    font-weight: bold;
    color: #333;
}

.section-subtitle {
    font-size: 14px;
    color: #666;
}

.see-all-link {
    color: #ff6600;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s;
}

.see-all-link:hover {
    color: #ff8833;
    text-decoration: underline;
}

/* ===== VIDEO GRID LAYOUTS ===== */

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.video-grid-featured {
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
}

.video-grid-trending {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.video-grid-large {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

/* ===== VIDEO CARDS ===== */

.video-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
}

.video-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 16px rgba(255, 102, 0, 0.3);
}

.video-card-thumbnail {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
    background: #000;
}

.video-card-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-card-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.video-card-info {
    padding: 15px;
}

.video-card-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    min-height: 44px; /* 2 lines worth of space */
}

.video-card-meta {
    font-size: 14px;
    color: #666;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.video-card-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.video-card-stats {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    font-size: 13px;
    color: #999;
}

.video-card-stat {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ===== FEATURED CARDS (Larger) ===== */

.video-card-featured {
    background: linear-gradient(135deg, #ff6600 0%, #ff8833 100%);
    color: white;
}

.video-card-featured .video-card-title {
    color: white;
    font-size: 18px;
}

.video-card-featured .video-card-meta {
    color: rgba(255, 255, 255, 0.9);
}

.featured-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.9);
    color: #ff6600;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    z-index: 1;
}

/* ===== SERIES CARDS ===== */

.series-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
}

.series-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.series-header {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #ff6600;
}

.series-title {
    font-size: 20px;
    font-weight: bold;
    color: #333;
}

.series-videos {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.series-video-item {
    display: flex;
    gap: 12px;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.series-video-item:hover {
    background: #f5f5f5;
}

.series-video-thumb {
    width: 120px;
    height: 68px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

.series-video-info {
    flex: 1;
}

.series-video-title {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.series-video-meta {
    font-size: 12px;
    color: #666;
}

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

@media (max-width: 1200px) {
    .content-container {
        max-width: 100%;
        padding: 15px;
    }

    .video-grid,
    .video-grid-featured,
    .video-grid-trending,
    .video-grid-large {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .section {
        margin-bottom: 35px;
    }

    .section-title {
        font-size: 20px;
    }

    .video-grid,
    .video-grid-featured,
    .video-grid-trending,
    .video-grid-large {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }

    .series-container {
        grid-template-columns: 1fr;
    }

    .series-video-thumb {
        width: 100px;
        height: 56px;
    }
}

@media (max-width: 480px) {
    .content-container {
        padding: 10px;
    }

    .video-grid,
    .video-grid-featured,
    .video-grid-trending,
    .video-grid-large {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .video-card-title {
        font-size: 14px;
        min-height: 40px;
    }

    .video-card-meta {
        font-size: 12px;
    }

    .series-videos {
        gap: 8px;
    }

    .series-video-item {
        flex-direction: column;
    }

    .series-video-thumb {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
    }
}

/* ===== LOADING STATES ===== */

.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-card {
    border-radius: 10px;
    overflow: hidden;
}

.skeleton-thumbnail {
    width: 100%;
    padding-bottom: 56.25%;
    background: #f0f0f0;
}

.skeleton-text {
    height: 16px;
    margin: 10px 15px;
    border-radius: 4px;
}

.skeleton-text-short {
    width: 60%;
}

/* ===== EMPTY STATES ===== */

.empty-section {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-section img {
    width: 100px;
    opacity: 0.3;
    margin-bottom: 20px;
}

.empty-section h3 {
    font-size: 22px;
    margin-bottom: 10px;
}

.empty-section p {
    font-size: 16px;
}

/* ===== BADGES & INDICATORS ===== */

.locked-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 1;
}

.trending-badge {
    background: linear-gradient(135deg, #ff6600, #ff3300);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    display: inline-block;
}

.new-badge {
    background: #4CAF50;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    display: inline-block;
}

/* ===== PAGINATION ===== */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 40px;
    padding: 20px;
}

.pagination-btn {
    padding: 10px 20px;
    border: 2px solid #ff6600;
    background: white;
    color: #ff6600;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.pagination-btn:hover {
    background: #ff6600;
    color: white;
}

.pagination-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pagination-info {
    font-size: 14px;
    color: #666;
}

/* ============================================ */
/* HOMEPAGE LAYOUT - YouTube-Style Sidebar     */
/* Updated: 2025-11-14 - Responsive sidebar system */
/* ============================================ */

.sidebar-main-container {
    display: flex;
    background: #f9f9f9;
    min-height: calc(100vh - 60px);
}

/* Base sidebar - white background, right border for separation */
.left-sidebar {
    width: 200px;
    background: #fff;
    position: fixed;
    top: 0; /* Extend to top, under navbar */
    left: 0;
    bottom: 0;
    padding-top: 60px; /* Push content below navbar */
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid #ddd;
    z-index: 1000;
    transform: translateX(0); /* Visible by default on desktop */
    transition: transform 0.3s ease, width 0.3s ease;
}

/* Hide Browse header */
.left-sidebar h3 {
    display: none;
}

/* Desktop: Collapsed icon mode (72px) with small labels */
.left-sidebar.sidebar-collapsed {
    width: 72px;
}

.left-sidebar.sidebar-collapsed .category-item span.category-text {
    display: block;
    font-size: 10px;
    text-align: center;
    line-height: 1.2;
    max-width: 64px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.left-sidebar.sidebar-collapsed .category-item {
    justify-content: center;
    padding: 8px 4px;
    margin: 2px 4px;
    flex-direction: column;
    gap: 4px;
}

.left-sidebar.sidebar-collapsed .category-item .category-icon {
    margin: 0 auto;
}

/* Overlay mode (medium/mobile) - narrower to not cover search box */
.left-sidebar.sidebar-overlay-mode {
    width: 180px;
    top: 0; /* Covers main navbar - horizontal line aligns via navbar height */
    transform: translateX(-100%); /* Hidden by default */
    z-index: 12000; /* Above top navbar for overlay effect */
    padding-top: 0; /* No padding - overlay has its own navbar */
}

.left-sidebar.sidebar-overlay-mode.sidebar-overlay-visible {
    transform: translateX(0); /* Slide in */
}

/* Category items - light styling for white background */
.category-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin: 0 8px;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 12px;
    border-radius: 8px;
}

.category-item:hover {
    background: #f5f5f5; /* Subtle gray pill */
}

.category-item img {
    flex-shrink: 0;
}

.category-item span {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Content area - shifts right based on sidebar state (desktop only) */
.sidebar-main-container .home-container {
    margin-left: 200px; /* Default offset for full sidebar on desktop */
    flex: 1;
    padding-left: 20px;
    padding-right: 20px;
    padding-top: 20px;
    padding-bottom: 20px;
    transition: margin-left 0.3s ease;
}

/* Adjust content margin for collapsed icon mode (desktop) */
body:has(.left-sidebar.sidebar-collapsed:not(.sidebar-overlay-mode)) .sidebar-main-container .home-container {
    margin-left: 72px;
}

/* No content shift for overlay mode (medium/mobile) */
body:has(.left-sidebar.sidebar-overlay-mode) .sidebar-main-container .home-container {
    margin-left: 0;
}

/* Also shift category view when it's visible (desktop only) */
#category-view {
    margin-left: 200px;
    padding: 20px;
    width: calc(100% - 200px);
    box-sizing: border-box;
    transition: margin-left 0.3s ease;
}

body:has(.left-sidebar.sidebar-collapsed:not(.sidebar-overlay-mode)) #category-view {
    margin-left: 72px;
    width: calc(100% - 72px);
}

body:has(.left-sidebar.sidebar-overlay-mode) #category-view {
    margin-left: 0;
    width: 100%;
}

/* Homepage section spacing */
.homepage-section {
    margin-bottom: 40px;
}

.homepage-section h2 {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    padding-left: 5px;
}

/* ========================================== */
/* HAMBURGER MENU BUTTON (Mobile Only)       */
/* ========================================== */

.hamburger-btn {
    display: flex; /* Visible on ALL platforms */
    flex-direction: column;
    justify-content: space-around;
    width: 20px; /* Consistent size across platforms */
    height: 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-left: 10px; /* Desktop left edge spacing */
    margin-right: 10px; /* Desktop spacing */
    z-index: 1001;
}

.hamburger-btn span {
    width: 100%;
    height: 3px;
    background: #333;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger-btn:hover span {
    background: #667eea;
}

/* ========================================== */
/* SIDEBAR OVERLAY (Mobile Only)             */
/* ========================================== */

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ========================================== */
/* CATEGORY DIVIDERS & ACTIVE STATE           */
/* ========================================== */

.category-divider {
    height: 1px;
    background: #eee;
    margin: 8px 12px;
}

.category-item.active {
    background: #f0f0f0;
    color: #333;
}

/* ========================================== */
/* SIDEBAR OVERLAY NAVBAR (Medium/Mobile)    */
/* ========================================== */

.sidebar-overlay-navbar {
    display: none; /* Hidden by default, shown in overlay mode */
    align-items: center;
    height: 59px; /* 59px + 1px border = 60px total to align with main navbar */
    padding: 0 16px;
    margin-bottom: 12px; /* Space between navbar and first category item */
    border-bottom: 1px solid #ddd;
    gap: 10px;
    background: #fff;
}

.sidebar-overlay-mode .sidebar-overlay-navbar {
    display: flex;
}

.logo-overlay {
    width: 115px;
    height: auto;
    cursor: pointer;
}

.hamburger-btn-overlay {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 20px;
    height: 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
}

.hamburger-btn-overlay span {
    width: 100%;
    height: 3px;
    background: #333;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* ========================================== */
/* OVERLAY DIMMING BACKGROUND                */
/* ========================================== */

.sidebar-overlay-dim {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1050;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay-dim.active {
    display: block;
    opacity: 1;
}

/* ========================================== */
/* RESPONSIVE BREAKPOINTS - YouTube Style    */
/* ========================================== */

/* Wide Desktop (>1024px) - Sidebar visible by default, toggle icon/full modes */
@media (min-width: 1025px) {
    .left-sidebar {
        transform: translateX(0); /* Always visible */
    }

    .sidebar-main-container .home-container {
        margin-left: 200px; /* Full sidebar by default */
    }

    #category-view {
        margin-left: 200px;
    }
}

/* Medium (600px - 1024px) - Icon mode visible by default */
@media (min-width: 600px) and (max-width: 1024px) {
    .left-sidebar {
        width: 72px; /* Icon mode by default */
        top: 0; /* Extend to top, under navbar */
        transform: translateX(0); /* Visible */
    }

    /* Show small text labels below icons */
    .left-sidebar .category-item span.category-text {
        display: block;
        font-size: 10px;
        text-align: center;
        line-height: 1.2;
        max-width: 64px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .left-sidebar .category-item {
        justify-content: center;
        padding: 8px 4px;
        margin: 2px 4px;
        flex-direction: column;
        gap: 4px;
    }

    /* Content shifts for icon mode */
    .sidebar-main-container .home-container {
        margin-left: 72px !important;
    }

    #category-view {
        margin-left: 72px !important;
    }

    /* When overlay opens, narrower to not cover search box */
    .left-sidebar.sidebar-overlay-visible {
        width: 180px;
        top: 0;
        z-index: 12000; /* Above top navbar for YouTube-style overlay */
        padding-top: 0; /* No padding - overlay has its own navbar */
    }

    /* Show category text when overlay opens */
    .left-sidebar.sidebar-overlay-visible .category-item span.category-text {
        display: block;
    }

    /* Restore normal layout (left-justified) when overlay opens */
    .left-sidebar.sidebar-overlay-visible .category-item {
        justify-content: flex-start;
        padding: 12px 16px;
        margin: 0 8px;
        gap: 12px;
        flex-direction: row;
    }

    /* Show overlay navbar when overlay is visible */
    .left-sidebar.sidebar-overlay-visible .sidebar-overlay-navbar {
        display: flex;
    }

    /* Content doesn't shift when overlay opens */
    body:has(.left-sidebar.sidebar-overlay-visible) .sidebar-main-container .home-container {
        margin-left: 0 !important;
    }

    body:has(.left-sidebar.sidebar-overlay-visible) #category-view {
        margin-left: 0 !important;
    }
}

/* Mobile (<600px) - Narrower to not cover search box */
@media (max-width: 599px) {
    .left-sidebar {
        width: 180px;
        top: 0;
        transform: translateX(-100%);
        z-index: 12000; /* Above top navbar for YouTube-style overlay */
        padding-top: 0; /* No padding - overlay has its own navbar */
    }

    .sidebar-main-container .home-container {
        margin-left: 0 !important;
        padding-left: 15px;
        padding-right: 15px;
    }

    #category-view {
        margin-left: 0 !important;
        padding: 15px;
    }

    /* Mobile-specific hamburger sizing */
    .hamburger-btn {
        width: 20px !important;
        height: 16px !important;
        margin-left: 3px !important;
        margin-right: 3px !important;
    }

    /* Hide "Browse" header on mobile */
    .left-sidebar h3 {
        display: none;
    }
}
