/* --- BASE LAYOUT & GLOBAL STYLES --- */
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: #f4f7f6; /* Light background for the page */
    color: #1e293b;
}

/* --- LAYOUT STRUCTURE --- */
.gallery-layout {
    display: flex;
    gap: 40px;
    padding: 40px 5%;
    align-items: flex-start;
    width: 100%;
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
}

.sidebar-nav {
    flex: 0 0 280px; /* Fixed width for sidebar */
    position: sticky;
    top: 20px; /* Stick to the top with some offset */
    height: fit-content; /* Sidebar height adjusts to content */
}

.main-content {
    flex: 1; /* Takes up remaining space */
    min-width: 0; /* Allows flex items to shrink properly */
}

/* --- SIDEBAR STYLES --- */
.sidebar-glass-panel {
    background: rgba(255, 255, 255, 0.7); /* Frosted glass effect */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px); /* For Safari */
    border: 1px solid rgba(226, 232, 240, 0.5); /* Semi-transparent border */
    border-radius: 25px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05); /* Subtle shadow */
}

.sidebar-heading {
    font-weight: 800;
    margin-bottom: 20px;
    color: #1e293b;
    font-size: 1.5rem;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    margin-bottom: 10px;
    border-radius: 15px;
    text-decoration: none !important;
    color: #64748b;
    transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
    background-color: white; /* Default background */
    border: 1px solid #e2e8f0; /* Default border */
}

.category-item:hover {
    background-color: #f1f5f9; /* Light hover background */
    border-color: #cbd5e1;
}

.active-cat {
    background: #3b82f6; /* Primary blue */
    color: white !important;
    box-shadow: 0 10px 20px rgba(59, 130, 246, 0.2);
    border: none; /* Remove border for active state */
}

.active-cat:hover {
     background: #2563eb; /* Darker blue on hover for active */
}


/* --- VIDEO HERO SECTION --- */
.video-hero {
    background: #0f172a; /* Dark background */
    border-radius: 40px; /* Fully rounded */
    padding: 60px 40px;
    margin-bottom: 40px;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    box-shadow: 0 15px 30px rgba(15, 23, 42, 0.3);
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 15px;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1.1rem;
    opacity: 0.8;
    max-width: 600px;
    line-height: 1.5;
}

/* --- VIDEO GRID ENGINE --- */
.video-grid {
    display: grid;
    /* Responsive grid: automatically fills columns, min 280px wide, max 1fr */
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    width: 100%;
}

.video-card {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9; /* Enforces cinematic shape */
    border-radius: 20px;
    overflow: hidden;
    background: #000;
    display: block; /* Ensure it takes up space */
    text-decoration: none !important;
    transition: all 0.4s ease-out; /* Smoother transitions */
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Prevents image stretching, fills container */
    display: block;
    transition: filter 0.5s ease, transform 0.5s ease; /* Smooth image effects */
}

/* --- OVERLAY & TEXT ON CARDS --- */
.card-overlay {
    position: absolute;
    inset: 0;
    /* Dark gradient so text is readable */
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, transparent 60%);
    z-index: 1;
}

.card-info {
    position: absolute;
    bottom: 15px;
    right: 15px;
    left: 15px;
    color: white;
    z-index: 2;
    transition: transform 0.3s ease-out;
}

.v-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 4px 0;
    line-height: 1.3;
}

.v-brief {
    font-size: 0.8rem;
    opacity: 0.8;
    line-height: 1.4;
    display: -webkit-box; /* For multi-line text ellipsis if needed */
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- HOVER EFFECTS --- */
.video-card:hover {
    transform: translateY(-5px); /* Slight lift on hover */
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.25);
}

.video-card:hover .card-img {
    filter: brightness(0.4) blur(2px); /* Dim and blur image on hover */
}

.play-btn-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -60%); /* Initial slight move up */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    opacity: 0; /* Hidden by default */
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
    z-index: 3; /* Ensure play button is above overlay */
}

.play-btn-circle {
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #3b82f6;
    font-size: 1.2rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.play-text {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    padding: 5px 15px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: bold;
    opacity: 0.9;
}

.video-card:hover .play-btn-wrapper {
    opacity: 1;
    transform: translate(-50%, -50%); /* Centered on hover */
}

/* Push text up slightly when play button appears on hover */
.video-card:hover .card-info {
    transform: translateY(-30px); /* Moves text up to make space for play button */
}


/* ==========================================
   MOBILE RESPONSIVE STYLES
   ========================================== */
@media (max-width: 768px) {

    /* --- GLOBAL MOBILE ADJUSTMENTS --- */
    body, html {
        overflow-x: hidden; /* Prevent horizontal scroll */
        width: 100%;
    }

    .gallery-layout {
        display: flex !important; /* Use flex again, but for vertical stacking */
        flex-direction: column !important; /* Stack children vertically */
        gap: 20px !important; /* Reduced gap between sections */
        padding: 20px 5% !important; /* Reduced padding */
        align-items: center !important; /* Center items when stacked */
    }

    /* --- SIDEBAR MOBILE --- */
    .sidebar-nav {
        flex: none !important; /* Override flex-grow/shrink/basis */
        width: 100% !important; /* Take full width */
        max-width: 100% !important; /* Ensure it doesn't exceed screen */
        position: relative !important; /* Reset positioning */
        top: auto !important; /* Reset sticky offset */
        order: -1; /* Place sidebar at the top */
        margin-bottom: 20px !important; /* Space below sidebar */
        height: auto; /* Allow height to adjust naturally */
    }

    .sidebar-glass-panel {
        padding: 15px; /* Slightly less padding */
        border-radius: 18px; /* Slightly smaller radius */
    }

    .sidebar-heading {
        font-size: 1.3rem; /* Slightly smaller heading */
        margin-bottom: 15px;
    }

    .category-item {
        padding: 10px 15px;
        margin-bottom: 8px;
        font-size: 0.95rem;
        border-radius: 12px;
    }

    /* --- MAIN CONTENT MOBILE --- */
    .main-content {
        width: 100% !important; /* Ensure it takes full width */
        max-width: 100% !important;
        flex: none !important; /* Override flex */
        margin: 0 !important;
        display: block; /* Ensure it behaves as a block */
    }

    /* --- VIDEO HERO MOBILE --- */
    .video-hero {
        border-radius: 25px !important; /* Smaller radius for mobile */
        padding: 30px 20px !important; /* Reduced padding */
        margin-bottom: 30px !important;
    }

    .hero-title {
        font-size: 1.8rem !important; /* Smaller hero title */
    }

    .hero-subtitle {
        font-size: 1rem !important; /* Smaller hero subtitle */
    }

    /* --- VIDEO GRID MOBILE --- */
    .video-grid {
        grid-template-columns: 1fr !important; /* Force single column */
        gap: 15px !important;
    }

    .video-card {
        border-radius: 15px !important; /* Smaller radius for cards */
    }

    .card-info {
        bottom: 10px !important;
        right: 10px !important;
        left: 10px !important;
    }

    .v-title {
        font-size: 1rem !important;
    }

    .v-brief {
        font-size: 0.8rem !important;
    }

    /* --- HOVER EFFECTS MOBILE ADJUSTMENTS --- */
    /* Hover effects might not work on touch devices, consider tap for interaction */
    .video-card:hover {
        transform: none; /* Remove lift on hover for mobile */
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15); /* Reset shadow */
    }
    .video-card:hover .card-img {
        filter: none; /* Remove dim/blur on hover for mobile */
        transform: none;
    }
    .video-card:hover .play-btn-wrapper {
        opacity: 1; /* Keep play button visible */
        transform: translate(-50%, -50%);
    }
    .video-card:hover .card-info {
        transform: translateY(-30px); /* Still push info up */
    }

    .play-btn-circle {
        width: 50px;
        height: 50px;
        font-size: 1rem;
    }
    .play-text {
        font-size: 0.8rem;
    }
}

/* Optional: Further adjustments for very small screens (< 480px) */
@media (max-width: 480px) {
    .sidebar-heading {
        font-size: 1.2rem;
    }
    .category-item {
        font-size: 0.9rem;
    }
    .hero-title {
        font-size: 1.6rem !important;
    }
    .hero-subtitle {
        font-size: 0.95rem !important;
    }
    .v-title {
        font-size: 0.95rem !important;
    }
    .v-brief {
        font-size: 0.75rem !important;
    }
}
