/* ===== AUTE — Netflix-Style YouTube App ===== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #141414;
    --bg-card: #1a1a2e;
    --bg-card-hover: #22223a;
    --surface: #1e1e2f;
    --text-primary: #f0f0f0;
    --text-secondary: #a0a0b0;
    --text-muted: #6a6a7a;
    --accent: #677D7D;
    --accent-hover: #7F9696;
    --accent-glow: rgba(103, 125, 125, 0.35);
    --gold: #f5c518;
    --glass-bg: rgba(20, 20, 40, 0.75);
    --glass-border: rgba(255, 255, 255, 0.08);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.6);
    --shadow-modal: 0 25px 80px rgba(0, 0, 0, 0.8);
    --transition-fast: 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --transition-smooth: 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --header-height: 68px;

    /* Z-Index Layers */
    --z-negative: -1;
    --z-normal: 1;
    --z-hero-content: 2;
    --z-content: 5;
    --z-carousel-arrow: 10;
    --z-card-hover: 20;
    --z-dropdown: 100;
    --z-header: 1000;
    --z-modal: 5000;
    --z-loading: 9999;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
    width: 6px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ---------- Loading Overlay ---------- */
#loading-overlay {
    position: fixed;
    inset: 0;
    inset: 0;
    z-index: var(--z-loading);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    transition: opacity 0.5s ease;
}

#loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader-logo {
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: 6px;
    color: var(--accent);
    margin-bottom: 32px;
    text-shadow: 0 0 40px var(--accent-glow);
    animation: pulse-glow 1.8s ease-in-out infinite;
}

.loader-bar {
    width: 200px;
    height: 3px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 99px;
    overflow: hidden;
}

.loader-bar::after {
    content: '';
    display: block;
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    border-radius: 99px;
    animation: loader-slide 1.2s ease-in-out infinite;
}

@keyframes loader-slide {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(350%);
    }
}

@keyframes pulse-glow {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* ---------- Header ---------- */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    height: var(--header-height);
    z-index: var(--z-header);
    display: flex;
    align-items: center;
    padding: 0 4%;
    transition: background var(--transition-smooth);
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.85) 0%, transparent 100%);
}

.header.scrolled {
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.header-logo {
    font-size: 1.65rem;
    font-weight: 900;
    letter-spacing: 5px;
    color: var(--accent);
    text-shadow: 0 0 25px var(--accent-glow);
}

.header-tagline {
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 2px;
    text-transform: uppercase;
    display: none;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
}

/* Search */
.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1.15rem;
    padding: 8px;
    display: flex;
    align-items: center;
    transition: color var(--transition-fast);
}

.search-toggle .icon-back {
    display: none;
}

@media (hover: hover) {
    .search-toggle:hover {
        color: var(--accent);
    }
}

.search-input {
    width: 0;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: width 0.35s ease, padding 0.35s ease, background 0.35s ease;
}

.search-wrapper.active .search-input {
    width: 260px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
}

/* Custom Dropdown */
.custom-dropdown {
    position: relative;
    z-index: var(--z-dropdown);
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    max-width: 220px;
}

.dropdown-toggle:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
}

.custom-dropdown.open .dropdown-toggle {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.1);
}

.dropdown-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-chevron {
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.custom-dropdown.open .dropdown-chevron {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    left: auto;
    min-width: 100%;
    max-width: 280px;
    max-height: 360px;
    overflow-y: auto;
    background: rgba(10, 10, 10, 0.92);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.97);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
}

.custom-dropdown.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.dropdown-item {
    padding: 10px 14px;
    font-size: 0.82rem;
    font-weight: 400;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.dropdown-item.active {
    color: var(--accent);
    font-weight: 600;
    background: rgba(103, 125, 125, 0.08);
}

/* ---------- Hero ---------- */
.hero {
    position: relative;
    width: 100%;
    min-height: 85vh;
    display: flex;
    align-items: flex-end;
    padding: 0 4% 80px;
    overflow: hidden;
    margin-bottom: 10px;
}

@media (min-width: 769px) {
    .hero {
        padding: 0 max(80px, 4%) 80px;
        /* Ensure hero aligns with playlist content (4%) on large screens,
           but keeps 80px minimum on standard desktops to clear arrows */
    }
}

.hero-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center top;
    /* Default scale is 1 */
    --hero-scale: 1;
    transform: scale(var(--hero-scale));
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-out;
}

.hero-bg.is-hq {
    background-position: center center;
    /* Scale up for HQ to cover bars */
    --hero-scale: 1.35;
}

.hero-content {
    position: relative;
    z-index: var(--z-hero-content);
    max-width: 650px;
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-out;
}

.hero.fading-out .hero-bg {
    opacity: 0;
    /* Zoom slightly from the CURRENT scale */
    transform: scale(calc(var(--hero-scale) * 1.05));
}

.hero.fading-out .hero-content {
    opacity: 0;
    transform: translateY(-10px);
}

.hero-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom,
            rgba(10, 10, 10, 0.1) 0%,
            rgba(10, 10, 10, 0.4) 50%,
            rgba(10, 10, 10, 0.95) 85%,
            var(--bg-primary) 100%);
}

.hero-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
            rgba(10, 10, 10, 0.8) 0%,
            transparent 60%);
    z-index: 1;
}



.hero-title {
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 16px;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}

.hero-description {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 28px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hero-indicators {
    position: absolute;
    bottom: 30px;
    right: 4%;
    display: flex;
    right: 4%;
    display: flex;
    gap: 10px;
    z-index: 10;
}

/* On mobile, center them */
@media (max-width: 768px) {
    .hero-indicators {
        bottom: 20px;
        right: 50%;
        transform: translateX(50%);
    }
}

.hero-dot {
    width: 6px;
    height: 6px;
    background-color: rgba(255, 255, 255, 0.4);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: width 0.3s ease, background-color 0.3s ease;
    padding: 0;
    margin: 0;
    outline: none;
}

@media (hover: hover) {
    .hero-dot:hover {
        background-color: rgba(255, 255, 255, 0.8);
    }
}

.hero-dot.active {
    background-color: #fff;
    width: 15px;
    border-radius: 10px;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

/* Hero Arrows (Desktop) */
.hero-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    z-index: 20;
    padding: 0 20px;
    opacity: 0;
    transition: opacity 0.4s ease, color 0.3s ease, transform 0.3s ease;
    display: none;
    /* Hidden by default (mobile) */
}

.hero-arrow svg {
    width: 40px;
    height: 40px;
    display: block;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.hero-arrow:hover {
    color: #fff;
    transform: translateY(-50%) scale(1.1);
}

.hero-arrow.prev {
    left: 0;
}

.hero-arrow.next {
    right: 0;
}

@media (min-width: 769px) {
    .hero-arrow {
        display: block;
    }

    .hero:hover .hero-arrow {
        opacity: 1;
    }
}

.hero-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-play {
    background: #ffffff;
    color: #000000;
    font-weight: 700;
}

.btn-play:hover {
    background: #e6e6e6;
    transform: scale(1.03);
}

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes hero-fade-in {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero.hero-enter {
    animation: hero-fade-in 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

/* Mobile Landscape Fix */
@media (max-width: 1024px) and (orientation: landscape) and (max-height: 600px) {
    .hero {
        min-height: 70dvh !important;
        height: 70dvh !important;
        max-height: 70dvh !important;
        padding-bottom: 20px !important;
        align-items: flex-end !important;
        /* Force bottom alignment */
        margin-bottom: 10px !important;
    }

    .hero-content {
        width: 100%;
        max-width: 95%;
        padding-bottom: 0px;
        padding-bottom: 0px;
        position: relative;
        z-index: 10;
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-end !important;
        align-items: flex-start !important;
        gap: 15px !important;
    }

    .hero-title {
        font-size: 1.25rem !important;
        margin-bottom: 0 !important;
        line-height: 1.1;
        text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
    }

    .hero-description {
        display: none !important;
        /* Hide description to save space if needed, or keep very short */
    }

    /* If user wants description, we can allow 1 line, but 70% is short */
    /* Let's keep description hidden or very small for 70% landscape */

    .hero-indicators {
        bottom: 10px;
        right: 20px;
        transform: none;
    }

    .btn {
        padding: 4px 12px;
        font-size: 0.75rem;
        height: 28px;
    }

    .hero-arrow {
        display: none !important;
    }

    .hero-bg {
        /* Ensure background fits consistently */
        background-size: cover;
        background-position: center;
    }

    .dropdown-menu {
        max-height: 60dvh !important;
        overflow-y: auto !important;
    }
}

/* ---------- Content Section ---------- */
/* ---------- Content Section ---------- */
.content-section {
    /* Sticky Footer: Flex 1 to push footer down */
    flex: 1;
    position: relative;
    flex: 1;
    position: relative;
    z-index: var(--z-content);
    padding: 0 0 30px;
}

/* ---------- Playlist Row ---------- */
.playlist-row {
    margin-bottom: 32px;
    padding: 0 4%;
    animation: fade-in 0.6s ease both;
}

.row-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.row-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Carousel Container */
.carousel-container {
    position: relative;
    /* Masking for elastic effect */
    isolation: isolate;
}

.carousel-mask {
    overflow: hidden;
    width: 100%;
}

.carousel {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 10px 0 20px;
    -ms-overflow-style: none;
    scrollbar-width: none;
    user-select: none;
}

.carousel img {
    pointer-events: none;
    -webkit-user-drag: none;
}

.carousel::-webkit-scrollbar {
    display: none;
}

/* Carousel Navigation Arrows */
.carousel-arrow {
    position: absolute;
    top: 0;
    bottom: 20px;
    top: 0;
    bottom: 20px;
    width: 55px;
    z-index: var(--z-carousel-arrow);
    display: none;
    /* Mobile default: hidden */
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--transition-fast), color 0.3s ease, transform 0.3s ease;
    color: rgba(255, 255, 255, 0.7);
}

.carousel-arrow svg {
    width: 28px;
    /* Adjusted size for aesthetics */
    height: 28px;
    display: block;
    pointer-events: none;
    /* Prevent SVG from capturing clicks */
}

@media (min-width: 769px) {
    .carousel-arrow {
        display: flex;
    }
}

.carousel-arrow.is-hidden {
    opacity: 0 !important;
    pointer-events: none;
    cursor: default;
}

.carousel-container:hover .carousel-arrow {
    opacity: 1;
}

.carousel-arrow.left {
    left: -10px;
    background: linear-gradient(90deg, rgba(10, 10, 10, 0.9), transparent);
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    justify-content: flex-start;
    /* Align icon slightly to the left/center */
    padding-left: 12px;
}

.carousel-arrow.right {
    right: -10px;
    background: linear-gradient(-90deg, rgba(10, 10, 10, 0.9), transparent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    justify-content: flex-end;
    /* Align icon slightly to the right/center */
    padding-right: 12px;
}

.carousel-arrow:hover {
    color: #fff;
    transform: scale(1.1);
}

/* ---------- Video Card ---------- */
.video-card {
    flex: 0 0 calc(100% / 2.3);
    min-width: 200px;
    border-radius: 0;
    overflow: visible;
    cursor: pointer;
    position: relative;
    background: transparent;
    transition: transform var(--transition-smooth), z-index 0s;
}

.video-card:hover {
    z-index: var(--z-card-hover);
}

.card-thumbnail {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-card);
    transition: box-shadow var(--transition-smooth);
}

.video-card:hover .card-thumbnail {
    box-shadow: var(--shadow-hover);
}

.card-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.video-card:hover .card-thumbnail img {
    transform: scale(1.1);
}

.card-play-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.video-card:hover .card-play-icon {
    opacity: 1;
}

.card-play-icon svg {
    width: 48px;
    height: 48px;
    fill: white;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
}

.card-info {
    padding: 6px 0 0 0;
    text-align: center;
    position: relative;
    z-index: 2;
}

.card-title {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 5px;
}

/* ---------- Video Modal ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    width: 90%;
    max-width: 960px;
    max-height: 85vh;
    max-height: 85dvh;
    /* Ensure some margin top/bottom */
    overflow-y: auto;
    /* Allow scrolling within the modal if content is tall */
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-modal);
    transform: scale(0.92) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
}

.modal-video-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
}

.modal-video-wrapper iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    /* Remove bottom gap */
}

/* ── Vertical Video Layout ── */
.modal-content.is-vertical {
    position: relative;
    display: flex;
    flex-direction: row;
    max-width: 820px;
    max-height: 85vh;
    overflow: hidden;
}

.modal-content.is-vertical .modal-video-wrapper {
    flex: 0 0 45%;
    aspect-ratio: 9/16;
    height: auto;
    align-self: center;
}

.modal-content.is-vertical .modal-details {
    flex: 1 1 55%;
    overflow-y: auto;
    max-height: 85vh;
    padding: 24px 28px 20px;
}

.modal-content.is-vertical .modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    float: none;
    margin: 0;
    z-index: 10;
}

.modal-close {
    position: sticky;
    top: 12px;
    float: right;
    margin-bottom: -48px;
    margin-right: 12px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.modal-close:hover {
    background: var(--accent);
    transform: rotate(90deg);
}

.modal-details {
    padding: 24px 28px 20px;
}

.modal-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.modal-meta {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.modal-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.65;
    /* Let the container scroll instead of this small box */
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* Tighten modal when no description */
.modal-content.no-description .modal-details {
    padding-bottom: 24px;
    /* Match top padding for symmetry */
}

.modal-content.no-description .modal-description {
    display: none;
}

.modal-content.no-description .modal-meta {
    margin-bottom: 0;
}

/* ---------- No Results ---------- */
.no-results {
    text-align: center;
    padding: 80px 20px;
    animation: fade-in 0.5s ease;
}

.no-results-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.4;
}

.no-results h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.no-results p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ---------- Footer ---------- */
.footer {
    padding: 20px 4% 30px;
    border-top: 1px solid var(--glass-border);
    text-align: center;
}

.footer-brand {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 4px;
    color: var(--accent);
    margin-bottom: 8px;
}

.footer-text {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.footer-text a {
    color: var(--text-secondary);
    text-decoration: none;
}

.footer-text a:hover {
    color: var(--accent);
}

/* ---------- Search Results Mode ---------- */
.content-section.search-mode .playlist-row {
    display: none;
}

.search-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    padding: 20px 4% 60px;
}

.search-results-grid .video-card {
    flex: none;
    min-width: unset;
}

.search-results-header {
    padding: 20px 4% 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: none;
}

.content-section.search-mode .search-results-header {
    display: block;
}

/* ---------- Animations ---------- */
@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Staggered fade-in for cards — delay set via JS */
.video-card {
    animation: fade-in 0.5s ease backwards;
}

/* ---------- Responsive ---------- */
@media (min-width: 600px) {
    .video-card {
        flex: 0 0 calc(100% / 3.3);
    }

    .header-tagline {
        display: block;
    }
}

@media (min-width: 900px) {
    .video-card {
        flex: 0 0 calc(100% / 4.3);
    }
}

@media (min-width: 1200px) {
    .video-card {
        flex: 0 0 calc(100% / 5.3);
    }
}

@media (min-width: 1600px) {
    .video-card {
        flex: 0 0 calc(100% / 6.3);
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0 3%;
    }

    .header-nav {
        gap: 10px;
    }

    .header-logo {
        font-size: 1.3rem;
        letter-spacing: 3px;
    }

    .hero {
        min-height: 60vh;
        padding: 0 3% 50px;
    }

    .hero-title {
        font-size: 1.5rem;
    }

    .hero-description {
        font-size: 0.85rem;
        line-clamp: 3;
        -webkit-line-clamp: 3;
    }

    .playlist-row {
        padding: 0 3%;
        margin-bottom: 32px;
    }

    .row-title {
        font-size: 1rem;
    }

    .btn {
        padding: 10px 20px;
        font-size: 0.85rem;
    }

    .search-wrapper.active .search-input {
        width: 160px;
    }

    .dropdown-toggle {
        font-size: 0.75rem;
        padding: 7px 12px;
        max-width: 160px;
    }

    .dropdown-menu {
        max-width: 220px;
    }

    .dropdown-item {
        font-size: 0.78rem;
        padding: 9px 12px;
    }

    /* Modal — wider on tablets */
    .modal-content {
        width: 95%;
        max-width: none;
        border-radius: var(--radius-md);
    }

    .modal-details {
        padding: 18px 20px 14px;
    }

    .modal-title {
        font-size: 1.15rem;
    }

    .modal-description {
        font-size: 0.85rem;
        /* max-height removed to allow full scroll */
    }

    /* Vertical video — stack on tablets */
    .modal-content.is-vertical {
        display: block;
        max-width: none;
        max-height: 90vh;
        max-height: 90dvh;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .modal-content.is-vertical .modal-video-wrapper {
        width: 100%;
        aspect-ratio: 9/16;
        max-height: calc(90vh - 140px);
        max-height: calc(90dvh - 140px);
        flex: none;
    }

    .modal-content.is-vertical .modal-details {
        max-height: none;
        overflow-y: visible;
    }

    .modal-content.is-vertical .modal-close {
        position: sticky;
        float: right;
        margin-bottom: -48px;
    }

    .carousel-arrow {
        width: 36px;
        font-size: 1.6rem;
    }

    /* Search results */
    .search-results-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        padding: 16px 3% 40px;
    }

    .search-results-header {
        padding: 16px 3% 0;
        font-size: 1rem;
    }

}

@media (max-width: 480px) {
    :root {
        --header-height: 52px;
    }

    /* ── Header compact ── */
    .header {
        padding: 0 12px;
    }

    .header-brand {
        gap: 6px;
    }

    .header-tagline {
        display: none;
    }

    .header-logo {
        font-size: 1.15rem;
        letter-spacing: 2px;
    }

    .header-nav {
        gap: 6px;
    }

    /* Dropdown — compact on mobile */
    .dropdown-toggle {
        font-size: 0.72rem;
        padding: 6px 10px;
        max-width: 170px;
    }

    .dropdown-label {
        max-width: 140px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .dropdown-menu {
        right: 0;
        left: auto;
        min-width: 180px;
    }

    /* Search — integrated in header on mobile */
    .search-wrapper {
        position: relative;
        /* Reserve space to prevent layout shift */
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Fixed toggle on active */
    .search-wrapper.active .search-toggle {
        position: fixed;
        top: 0;
        left: 0;
        width: 40px;
        height: var(--header-height);
        background: transparent;
        /* Background handled by input for sync */
        z-index: 1200;
        padding: 0;
        justify-content: center;
        align-items: center;
        border-radius: 0;
    }

    .search-toggle,
    .search-toggle:hover,
    .search-toggle:focus,
    .search-toggle:active,
    .search-toggle:focus-visible {
        color: var(--text-primary) !important;
        -webkit-tap-highlight-color: transparent;
        outline: none;
    }

    .search-wrapper.active .search-toggle .icon-search {
        display: none;
    }

    .search-wrapper.active .search-toggle .icon-back {
        display: inline;
    }

    .search-input {
        position: fixed;
        top: 0;
        left: 0;
        /* Starts at edge, covers arrow background */
        right: 0;
        width: 100% !important;
        height: var(--header-height);
        background: #0a0a0a !important;
        /* Override desktop specificity */
        border: none;
        border-bottom: 1px solid var(--glass-border);
        padding: 0 12px 0 40px !important;
        /* Left padding for arrow space */
        box-sizing: border-box !important;
        z-index: 1100;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        transform: none;
        border-radius: 0 !important;
        box-shadow: none;
    }

    .search-wrapper.active .search-input {
        opacity: 1;
        pointer-events: auto;
    }

    /* ── Hero compact ── */
    .hero {
        min-height: 55vh;
        padding: 0 4% 44px;
        margin-bottom: 40px;
    }

    .hero-title {
        font-size: 1.3rem;
        line-height: 1.3;
    }

    .hero-description {
        font-size: 0.8rem;
        line-clamp: 2;
        -webkit-line-clamp: 2;
    }

    .hero-actions {
        gap: 8px;
        margin-top: 16px;
    }

    .btn {
        padding: 10px 18px;
        font-size: 0.8rem;
        gap: 6px;
    }

    /* ── Cards ── */
    .video-card {
        flex: 0 0 65%;
        min-width: 180px;
    }

    .card-info {
        padding: 10px 12px;
    }

    .card-title {
        font-size: 0.82rem;
    }

    .playlist-row {
        padding: 0 12px;
        margin-bottom: 28px;
    }

    .row-title {
        font-size: 0.95rem;
    }

    /* ── Modal — centered on phones ── */
    .modal-overlay {
        padding: 16px;
        align-items: center;
    }

    .modal-content {
        width: 100%;
        max-width: none;
        max-height: 75vh;
        max-height: 75dvh;
        border-radius: var(--radius-lg);
    }

    .modal-close {
        width: 32px;
        height: 32px;
        font-size: 1rem;
        top: 12px;
        margin-right: 12px;
    }

    .modal-details {
        padding: 14px 16px 14px;
    }

    .modal-title {
        font-size: 1.05rem;
    }

    .modal-meta {
        font-size: 0.75rem;
    }

    .modal-description {
        font-size: 0.82rem;
        /* max-height removed */
    }

    /* Vertical video — constrained on phones */
    .modal-content.is-vertical {
        display: block;
        max-width: none;
        max-height: 88vh;
        max-height: 88dvh;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .modal-content.is-vertical .modal-video-wrapper {
        width: 100%;
        aspect-ratio: 9/16;
        max-height: calc(88vh - 140px);
        max-height: calc(88dvh - 140px);
        flex: none;
    }

    .modal-content.is-vertical .modal-details {
        max-height: none;
        overflow-y: visible;
        padding: 14px 16px 14px;
    }

    .modal-content.is-vertical .modal-close {
        position: sticky;
        float: right;
        margin-bottom: -48px;
    }

    /* Hide carousel arrows on mobile (use drag) */
    .carousel-arrow {
        display: none;
    }

    /* ── Search results ── */
    .search-results-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        padding: 12px 12px 30px;
    }

    .search-results-header {
        padding: 12px 12px 0;
        font-size: 0.9rem;
    }

    /* ── Misc ── */
    .no-results-icon {
        font-size: 3rem;
    }

    .no-results h3 {
        font-size: 1.1rem;
    }

    .no-results p {
        font-size: 0.82rem;
    }

    .footer {
        padding: 30px 4% 24px;
    }

    .footer-brand {
        font-size: 1rem;
    }

    .footer-text {
        font-size: 0.72rem;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    :root {
        --header-height: 48px;
    }

    .header {
        padding: 0 4%;
        display: flex;
        height: var(--header-height);
    }

    .hero {
        min-height: auto;
        height: auto;
        padding: calc(var(--header-height) + 12px) 4% 40px;
        display: flex;
        align-items: flex-start;
        margin-bottom: 10px;
    }

    .hero-content {
        max-width: 85%;
        margin-top: 0;
    }

    .hero-title {
        font-size: 1.25rem;
        margin-bottom: 6px;
    }

    .hero-description {
        font-size: 0.85rem;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        margin-bottom: 12px;
        max-width: 600px;
    }

    .btn {
        padding: 8px 16px;
        font-size: 0.8rem;
    }

    .video-card {
        flex: 0 0 220px;
    }

    .playlist-row {
        margin-bottom: 20px;
    }

    /* ── Modal Optimization ── */
    .modal-overlay {
        padding: 0;
        align-items: center;
        /* Center vertically */
    }

    .modal-content {
        width: 100%;
        height: 100%;
        /* Full screen modal for small landscape */
        max-width: none;
        max-height: none;
        border-radius: 0;
        margin: 0;
        transform: none;
        display: flex;
        flex-direction: row;
        /* Side-by-side */
        overflow: hidden;
        position: relative;
    }

    /* Standard Video (16:9) */
    .modal-video-wrapper {
        flex: 0 0 50%;
        width: 50%;
        height: 100%;
        background: black;
    }

    .modal-video-wrapper iframe {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

    .modal-details {
        flex: 1 1 50%;
        /* Take remaining space */
        width: 50%;
        height: 100%;
        padding: 48px 24px 24px;
        /* Top padding for close button */
        overflow-y: auto;
        background: var(--bg-secondary);
        position: relative;
    }

    .modal-close {
        position: absolute;
        top: 12px;
        right: 12px;
        margin: 0;
        width: 32px;
        height: 32px;
        z-index: 20;
        background: rgba(0, 0, 0, 0.6);
        font-size: 1rem;
    }

    .modal-title {
        font-size: 1.1rem;
        margin-bottom: 6px;
        line-height: 1.3;
        padding-right: 30px;
        /* Avoid overlap with close button if it flows there */
    }

    .modal-meta {
        font-size: 0.75rem;
        margin-bottom: 12px;
    }

    .modal-description {
        font-size: 0.85rem;
        line-height: 1.5;
    }

    /* ── Vertical Video (9:16) in Landscape ── */
    .modal-content.is-vertical {
        display: flex;
        flex-direction: row;
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border-radius: 0;
        margin: 0;
    }

    .modal-content.is-vertical .modal-video-wrapper {
        flex: 0 0 40%;
        /* Give vertical video reasonable width */
        width: 40%;
        max-width: 320px;
        /* Cap width so it doesn't dominate */
        height: 100%;
        background: #000;
        display: flex;
    }

    .modal-content.is-vertical .modal-video-wrapper iframe {
        width: 100%;
        height: 100%;
        position: relative;
    }

    .modal-content.is-vertical .modal-details {
        flex: 1 1 auto;
        /* Fill rest */
        width: auto;
        height: 100%;
        padding: 48px 24px 24px;
        overflow-y: auto;
    }

    .modal-content.is-vertical .modal-close {
        position: absolute;
        top: 12px;
        right: 12px;
    }
}