* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --accent: #ec4899;
    --bg: #0a0a0f;
    --bg-secondary: #141419;
    --bg-card: #1a1a24;
    --text: #e2e8f0;
    --text-secondary: #94a3b8;
    --border: #2d2d3a;
    --success: #10b981;
    --danger: #ef4444;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 10px;
}

/* Navbar with collapsing search */
.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    position: relative;
    transition: all 0.3s ease;
}

.nav-search-container {
    flex: 1;
    max-width: 600px; /* Limit width like YouTube */
    display: flex;
    justify-content: center;
}

.search-box {
    display: flex;
    width: 100%;
    background: #121212;
    border: 1px solid #303030;
    border-radius: 40px;
    overflow: hidden;
}
.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 10px 20px;
    color: white;
    font-size: 1rem;
    outline: none;
}

.search-btn {
    width: 60px;
    background: #222;
    border: none;
    border-left: 1px solid #303030;
    color: #aaa;
    cursor: pointer;
}

.search-btn:hover {
    background: #303030;
    color: white;
}

/* 3. Right Auth Area */
.nav-right {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 100px
}
@media (max-width: 768px) {
    .nav-search-container {
        display: none; /* Hide search bar on small screens for now, or make it an icon */
    }
    
    .signin-text {
        display: none; /* Hide "Sign In" text on mobile, show only icon */
    }
    
    .btn-signin {
        padding: 8px; /* Make button smaller */
    }
}

/* Nav search - fixed height with smooth transitions */
.nav-search {
    flex: 1;
    max-width: 550px;
    position: relative;
    height: 50px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    visibility: visible;
    max-height: 60px;
    will-change: opacity, transform, max-width;
}


/* Scrolled state - smooth transition */
.navbar.scrolled .nav-search {
    opacity: 0;
    visibility: hidden;
    max-width: 0;
    max-height: 0;
    margin: 0;
    flex: 0;
    transform: scale(0.95);
}

/* Mobile - keep smooth transition but faster */
@media (max-width: 768px) {
    .nav-search {
        height: 45px;
        transition: all 0.3s ease;
    }
    
    .navbar.scrolled .nav-search {
        /* Don't use display: none on mobile */
        opacity: 0;
        visibility: hidden;
        max-height: 0;
        margin: 0;
    }
}



/* Modern Stylish Navbar */
.navbar {
    background: linear-gradient(135deg, rgba(10, 10, 15, 0.98), rgba(20, 20, 25, 0.95));
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid transparent;
    border-image: linear-gradient(90deg, transparent, var(--primary), var(--accent), transparent) 1;
    padding: 8px 0;
    position: sticky;
    justify-content: space-between;
    top: 0;
    z-index: 1000;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(99, 102, 241, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: padding, box-shadow;
}

.navbar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary), var(--accent), transparent);
    opacity: 0.5;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    position: relative;
    transition: gap 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-right: 20px;
}

.nav-brand h1 {
    font-size: 1.85rem;
    font-weight: 800;
    background: linear-gradient(135deg, #8b5cf6, var(--primary), var(--accent), #f472b6);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 8s ease infinite;
    letter-spacing: -0.5px;
    text-shadow: 0 0 30px rgba(99, 102, 241, 0.3);
}

@keyframes gradientShift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.nav-brand a {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}





.nav-search input {
    width: 100%;
    padding: 13px 52px 13px 22px;
    background: rgba(26, 26, 36, 0.6);
    border: 2px solid rgba(99, 102, 241, 0.2);
    border-radius: 14px;
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.2);
}

.nav-search input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.nav-search input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(26, 26, 36, 0.8);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1), inset 0 2px 8px rgba(0, 0, 0, 0.3);
    transform: translateY(-1px);
}

.nav-search button {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    padding: 9px 18px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.nav-search button:hover {
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.nav-search button:active {
    transform: translateY(-50%) scale(0.98);
}


/* Filters - Horizontal Scroll */
.filters {
    display: flex;
    gap: 10px;
    padding: 0.3rem 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.filters::-webkit-scrollbar {
    height: 6px;
}

.filters::-webkit-scrollbar-track {
    background: transparent;
}

.filters::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

.filters::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

#categoryFilters {
    display: flex;
    gap: 10px;
}

.filter-btn {
    padding: 10px 20px;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 2px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.filter-btn:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.filter-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
}

/* Featured Carousel - Auto-scrolling */
.featured-section {
    margin: 40px 0;
}

.featured-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.featured-section h3 {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.scroll-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
}

.scroll-arrow {
    color: var(--primary);
    animation: scrollHint 2s ease-in-out infinite;
}

@keyframes scrollHint {
    0%, 100% {
        transform: translateX(0);
        opacity: 1;
    }
    50% {
        transform: translateX(10px);
        opacity: 0.5;
    }
}

.carousel-container {
    position: relative;
    padding: 0;
    overflow: hidden;
}

.carousel-wrapper {
    overflow: hidden;
    border-radius: 12px;
    cursor: grab;
}

.carousel-wrapper:active {
    cursor: grabbing;
}

.carousel-track {
    display: flex;
    gap: 16px;
    will-change: transform;
}

.carousel-card {
    flex: 0 0 280px;
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.carousel-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    border-color: var(--primary);
}

.carousel-card-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
}

.carousel-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.carousel-card:hover .carousel-card-thumb img {
    transform: scale(1.1);
}

.carousel-card-views {
    position: absolute;
    bottom: 8px;
    right: 8px;
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.carousel-card-info {
    padding: 12px;
}

.carousel-card-info h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.carousel-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .carousel-card {
        flex: 0 0 180px;
    }
    
    .carousel-card-info h4 {
        font-size: 0.85rem;
    }
    
    .scroll-indicator {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .carousel-card {
        flex: 0 0 150px;
    }
    
    .featured-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}


/* Ad Sections */
.ad-banner {
    background: linear-gradient(135deg, var(--bg-card), var(--bg-secondary));
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    margin: 30px 0;
    color: var(--text-secondary);
}

.ad-banner.small {
    padding: 20px;
    margin: 20px 0;
}

/* Video Grid - 4 Desktop, 3 Mobile */
.video-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    padding: 1rem 0 2rem;
}

.video-card {
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border);
}

.video-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px var(--primary);
}

.video-card-thumbnail {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: var(--bg-secondary);
}

.video-card-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.video-card:hover .video-card-thumbnail img {
    transform: scale(1.1);
}

.video-card-duration {
    position: absolute;
    bottom: 10px;
    right: 10px;
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}

.video-card-content {
    padding: 16px;
}

.video-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
}

.video-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.category-badge {
    display: inline-block;
    padding: 4px 12px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Category Sections */
.category-section {
    margin: 60px 0;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}

.category-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.view-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    text-decoration: none;
    border: 2px solid var(--border);
    border-radius: 24px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.view-all-btn:hover {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    border-color: var(--primary);
    transform: translateX(5px);
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 40px 0;
}

.pagination button {
    padding: 12px 20px;
    background: var(--bg-card);
    color: var(--text);
    border: 2px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.pagination button:hover:not(:disabled) {
    background: var(--primary);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination .page-info {
    padding: 12px 20px;
    background: var(--bg-card);
    border-radius: 10px;
    font-weight: 600;
}

/* Watch Page */
.watch-page {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.watch-container {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 350px;
    gap: 30px;
    align-items: start;
}

.main-video-section {
    max-width: 100%;
    min-width: 0;
}

.player-wrapper {
    position: relative;
    background: #000;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 2rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.player-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
}

.video-thumbnail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
}

.video-thumbnail-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0,0,0,0.3), rgba(0,0,0,0.7));
}

.play-button-overlay {
    width: 90px;
    height: 90px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.3s ease;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.play-button-overlay:hover {
    transform: scale(1.1);
    background: white;
}

.play-button-overlay::after {
    content: '';
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 18px 0 18px 30px;
    border-color: transparent transparent transparent #000;
    margin-left: 6px;
}

#videoPlayer {
    width: 100%;
    height: 100%;
    display: block;
}

/* Custom Controls */
.custom-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.95), rgba(0,0,0,0.7), transparent);
    padding: 20px 15px 15px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.player-container:hover .custom-controls,
.custom-controls.show {
    opacity: 1;
}

.controls-top {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.control-btn {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.control-btn:active {
    transform: scale(0.95);
}

.control-btn.play-pause {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    border-radius: 50%;
    font-size: 1.2rem;
}

.control-btn.play-pause:hover {
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.6);
}

.time-display {
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    margin-left: auto;
    margin-right: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    cursor: pointer;
    position: relative;
}

.progress-filled {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 10px;
    width: 0%;
    transition: width 0.1s ease;
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.5);
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.volume-slider {
    width: 80px;
    height: 4px;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    outline: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(0,0,0,0.3);
}

.volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.video-info {
    padding: 1.5rem 0;
}

.video-info h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    line-height: 1.3;
}

.video-meta {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
    flex-wrap: wrap;
}

.video-meta span {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.video-description {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    white-space: pre-wrap;
    border: 1px solid var(--border);
    line-height: 1.8;
}

.video-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag {
    padding: 6px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Sidebar */
.video-sidebar {
    position: sticky;
    top: 90px;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    padding-right: 5px;
}

.video-sidebar::-webkit-scrollbar {
    width: 6px;
}

.video-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.video-sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

.video-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.sidebar-section {
    margin-bottom: 30px;
}

.sidebar-section h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    font-weight: 700;
}

.sidebar-video-card {
    display: flex;
    gap: 12px;
    padding: 10px;
    background: var(--bg-card);
    border-radius: 10px;
    margin-bottom: 12px;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.sidebar-video-card:hover {
    background: var(--bg-secondary);
    transform: translateX(5px);
}

.sidebar-video-thumb {
    width: 120px;
    aspect-ratio: 16/9;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sidebar-video-info h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.sidebar-video-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Ad Popup */
.ad-popup {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 320px;
    background: var(--bg-card);
    border: 2px solid var(--primary);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    z-index: 9999;
    animation: slideInRight 0.4s ease;
}

.ad-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.ad-popup-header h4 {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.ad-popup-close {
    background: var(--danger);
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.ad-popup-close:hover {
    transform: scale(1.1);
}

.ad-popup-content {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(236, 72, 153, 0.15));
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ad-popup-content:hover {
    transform: scale(1.02);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(236, 72, 153, 0.25));
}

.ad-popup-content h3 {
    font-size: 1rem;
    margin-bottom: 8px;
}

.ad-popup-content p {
    font-size: 0.85rem;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Ad Overlay */
.ad-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    cursor: pointer;
}

.ad-overlay-content {
    text-align: center;
    padding: 40px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.ad-overlay-content h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: white;
}

.ad-overlay-content p {
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.ad-overlay-logo {
    font-size: 3rem;
    margin-bottom: 20px;
}

.ad-skip-button {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
}

.ad-skip-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(99, 102, 241, 0.6);
}

.loading {
    text-align: center;
    padding: 4rem;
    color: var(--text-secondary);
    grid-column: 1 / -1;
}

footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 2.5rem 0;
    text-align: center;
    color: var(--text-secondary);
    margin-top: 4rem;
}



/* Search Suggestions - Google Style */
.nav-search {
    position: relative;
}

.search-suggestions {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 12px;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.search-suggestions.show {
    display: block;
}

.suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: var(--bg-secondary);
}

.suggestion-icon {
    color: var(--text-secondary);
    font-size: 1rem;
}

.suggestion-text {
    flex: 1;
    color: var(--text);
    font-size: 0.9rem;
}

.suggestion-text strong {
    color: var(--primary);
    font-weight: 600;
}

/* Search Results Header */
.search-results-header {
    padding: 2rem 0 1.5rem;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1.5rem;
    display: none;
}

.search-results-header h2 {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
    font-weight: 700;
}

.search-results-info {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.search-results-info strong {
    color: var(--primary);
    font-weight: 600;
}

.clear-search-btn {
    padding: 8px 20px;
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 2px solid var(--danger);
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.clear-search-btn:hover {
    background: var(--danger);
    color: white;
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .search-results-header {
        padding: 1.5rem 0 1rem;
    }
    
    .search-results-header h2 {
        font-size: 1.3rem;
    }
    
    .search-results-info {
        font-size: 0.85rem;
    }
    
    .clear-search-btn {
        font-size: 0.85rem;
        padding: 6px 16px;
    }

    .main-video-section {
        margin: 0 1rem;
    }
}

/* No Results State */
.no-results {
    text-align: center;
    padding: 4rem 2rem;
    grid-column: 1 / -1;
}

.no-results h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.no-results p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1rem;
}

.no-results button {
    padding: 12px 30px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.no-results button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
}


/* Responsive Watch Popup */
.ad-overlay-content {
    text-align: center;
    padding: 40px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    max-width: 90%;
    margin: 0 auto;
}

.ad-overlay-logo {
    font-size: 3rem;
    margin-bottom: 20px;
}

.ad-overlay-content h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: white;
}

.ad-overlay-content p {
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.ad-skip-button {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
}

.ad-skip-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(99, 102, 241, 0.6);
}

@media (max-width: 768px) {
    .ad-overlay-content {
        padding: 30px 20px;
        max-width: 95%;
    }
    
    .ad-overlay-logo {
        font-size: 2rem;
        margin-bottom: 15px;
    }
    
    .ad-overlay-content h3 {
        font-size: 1.2rem;
        margin-bottom: 15px;
    }
    
    .ad-overlay-content p {
        font-size: 0.9rem;
        margin-bottom: 20px;
    }
    
    .ad-skip-button {
        padding: 12px 30px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .ad-overlay-content {
        padding: 20px 15px;
    }
    
    .ad-overlay-logo {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }
    
    .ad-overlay-content h3 {
        font-size: 1rem;
    }
    
    .ad-overlay-content p {
        font-size: 0.85rem;
    }
    
    .ad-skip-button {
        padding: 10px 24px;
        font-size: 0.9rem;
    }
}

/* Disable text/video selection on watch page */
.watch-page video {
    pointer-events: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.watch-page video::cue {
    display: none;
}

/* Re-enable controls */
.custom-controls,
.custom-controls * {
    pointer-events: auto;
}



/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 1200px) {
    .video-grid,
    .category-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .watch-container {
        grid-template-columns: 1fr;
    }
    
    .video-sidebar {
        position: static;
        max-height: none;
        margin-top: 30px;
    }
}

@media (max-width: 1024px) {
    .category-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-search {
        max-width: 100%;
        width: 100%;
        order: 2;
    }
    
    .ad-banner {
        padding: 20px;
        margin: 20px 0;
    }
    
    .ad-banner.small {
        padding: 15px;
        margin: 15px 0;
    }
    
    .carousel-card {
        flex: 0 0 160px;
    }

    .carousel-nav {
        width: 35px;
        height: 35px;
        font-size: 1.2rem;
    }
    
    .carousel-card-info h4 {
        font-size: 0.85rem;
    }
    
    .video-card h3 {
        font-size: 0.85rem;
        -webkit-line-clamp: 2;
        line-height: 1.3;
    }
    
    .video-card-content {
        padding: 10px;
    }
    
    .video-card-meta {
        font-size: 0.7rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .category-badge {
        font-size: 0.65rem;
        padding: 2px 8px;
    }
    
    .video-card-duration {
        font-size: 0.7rem;
        padding: 2px 6px;
        bottom: 6px;
        right: 6px;
    }
    
    .video-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
    
    .category-section {
        margin: 35px 0;
    }
    
    .category-header {
        flex-wrap: wrap;
        gap: 10px;
        margin-bottom: 20px;
    }
    
    .category-title {
        font-size: 1.2rem;
    }
    
    .view-all-btn {
        padding: 6px 16px;
        font-size: 0.8rem;
    }
    
    .category-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
    
    .pagination {
        padding: 30px 0;
        gap: 8px;
    }
    
    .pagination button,
    .pagination .page-info {
        padding: 10px 16px;
        font-size: 0.85rem;
    }
    
    .watch-page {
        padding: 1rem 0;
    }
    
        .player-container {
        border-radius: 8px;
    }
    
    .player-wrapper {
        margin-bottom: 1rem;
    }
    
    /* Ensure player fills width */
    .watch-page .container {
        padding: 0 10px;
    }
    
    .control-btn {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }
    
    .control-btn.play-pause {
        width: 46px;
        height: 46px;
        font-size: 1.1rem;
    }
    
    .time-display {
        font-size: 0.8rem;
        margin-right: 5px;
    }
    
    .progress-bar {
        height: 5px;
    }

    .video-info h1 {
        font-size: 1.3rem;
        margin-bottom: 1rem;
    }
    
    .navbar.scrolled {
        padding: 0 !important;
    }

    .video-meta {
        gap: 1rem;
        padding: 1rem;
        flex-direction: column;
    }
    
    .video-description {
        padding: 1.2rem;
        font-size: 0.9rem;
    }
    
    .video-tags {
        gap: 6px;
    }
    
    .tag {
        padding: 5px 12px;
        font-size: 0.8rem;
    }
    
    .sidebar-video-card {
        padding: 8px;
    }
    
    .sidebar-video-thumb {
        width: 100px;
    }
    
    .sidebar-video-info h4 {
        font-size: 0.85rem;
    }
    
    .volume-control {
        display: none;
    }
    
    .control-btn {
        width: 36px;
        height: 36px;
    }
    
    .control-btn.play-pause {
        width: 44px;
        height: 44px;
    }
    
    .ad-popup {
        width: calc(100% - 40px);
        right: 20px;
        left: 20px;
    }
}

@media (max-width: 480px) {
    .filter-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
    
    .carousel-card {
        flex: 0 0 140px;
    }
    
    .carousel-nav {
        width: 30px;
        height: 30px;
        font-size: 1rem;
    }
    
    .category-title {
        font-size: 1.1rem;
    }
    
    .video-card h3 {
        font-size: 0.85rem;
    }
    
    .video-grid,
    .category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

        .video-card-meta {
        font-size: 0.65rem;
    }
    
    .control-btn {
        width: 34px;
        height: 34px;
        font-size: 0.9rem;
    }
    
    .control-btn.play-pause {
        width: 42px;
        height: 42px;
        font-size: 1rem;
    }

}

/* Make navbar sticky */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* Make video player section sticky */
.main-video-section {
    position: sticky;
    top: 60px; /* Height of navbar */
    z-index: 999;
    background: var(--bg);
    padding-top: 0;
    margin-top: 0;
}

/* Make only the content below scrollable */
.watch-container {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 350px;
    gap: 30px;
    align-items: start;
    max-height: calc(100vh - 60px); /* Full viewport height minus navbar */
    overflow-y: auto; /* Enable scrolling for the container */
}

/* Adjust the scrollable area */
.watch-page {
    padding: 0;
    max-width: 1400px;
    margin: 0 auto;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Ensure video info and sidebar are scrollable */
.video-info,
.video-sidebar {
    position: relative;
    z-index: 1;
}

/* Adjust player wrapper to not have bottom margin since it's sticky */
.player-wrapper {
    margin-bottom: 0;
}

/* Remove sticky from sidebar since container handles scrolling */
.video-sidebar {
    position: static;
    max-height: none;
    overflow-y: visible;
}

/* Adjust responsive behavior */
@media (max-width: 1200px) {
    .watch-container {
        grid-template-columns: 1fr;
        max-height: calc(100vh - 60px);
    }
    
    .main-video-section {
        position: sticky;
        top: 60px;
    }
}

@media (max-width: 768px) {
    .main-video-section {
        top: 50px; /* Adjust for smaller navbar on mobile */
    }
    
    .watch-container {
        max-height: calc(100vh - 50px);
    }
    
    .watch-page {
        padding: 0;
    }
}


/* --- AUTH MODAL & NAVBAR --- */

/* User Avatar in Nav */
.user-nav-area {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #ec4899);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
    cursor: pointer;
    position: relative;
    border: 2px solid rgba(255,255,255,0.1);
}

.user-dropdown {
    position: absolute;
    top: 50px;
    right: 20px;
    background: #1e1e24;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    width: 200px;
    display: none; /* Hidden by default */
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    z-index: 2000;
    overflow: hidden;
}

.user-dropdown.active {
    display: flex;
}

.dropdown-header {
    padding: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.02);
}

.dropdown-header strong {
    display: block;
    color: white;
    margin-bottom: 4px;
}

.dropdown-header span {
    font-size: 0.85rem;
    color: #94a3b8;
}

.dropdown-item {
    padding: 12px 15px;
    color: #e2e8f0;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dropdown-item:hover {
    background: rgba(255,255,255,0.05);
    color: #6366f1;
}

/* Sign In Button */
.btn-signin {
    background: rgba(255,255,255,0.1);
    color: #6366f1;
    border: 1px solid rgba(99, 102, 241, 0.3);
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-signin:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: #6366f1;
}

/* Auth Modal Overlay */
.auth-modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    z-index: 3000;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
}

.auth-modal-overlay.active {
    display: flex;
}

/* Auth Box */
.auth-box {
    background: #1a1a20;
    width: 100%;
    max-width: 400px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.1);
    padding: 30px;
    position: relative;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.auth-close {
    position: absolute;
    top: 15px; right: 15px;
    background: none;
    border: none;
    color: #666;
    font-size: 1.2rem;
    cursor: pointer;
}

.auth-close:hover { color: white; }

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 25px;
    color: white;
}

.auth-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.auth-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    color: #94a3b8;
    font-weight: 600;
    border-bottom: 2px solid transparent;
}

.auth-tab.active {
    color: #6366f1;
    border-bottom-color: #6366f1;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.auth-input {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 12px;
    border-radius: 8px;
    color: white;
    font-family: inherit;
}

.auth-input:focus {
    outline: none;
    border-color: #6366f1;
}

.btn-auth-submit {
    background: #6366f1;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 10px;
    transition: background 0.2s;
}

.btn-auth-submit:hover {
    background: #4f46e5;
}

.auth-error {
    color: #ef4444;
    font-size: 0.9rem;
    text-align: center;
    margin-top: 10px;
    display: none;
}


/* --- NAVBAR & SEARCH (Fixed) --- */

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 60px;
    background: #0f0f0f;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    position: relative;
    z-index: 1000;
}

/* Search Container - Always Flex */
.nav-search-container {
    flex: 1;
    max-width: 600px;
    display: flex;
    justify-content: center;
    margin: 0 20px;
}

/* The Search Box */
.search-box {
    display: flex;
    width: 100%;
    background: #121212;
    border: 1px solid #303030;
    border-radius: 40px;
    overflow: hidden;
    position: relative;
}

/* Input Field */
.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0 20px;
    color: white;
    font-size: 16px;
    height: 40px;
    outline: none;
    /* Critical: Remove browser default icons */
    appearance: none;
    -webkit-appearance: none;
}

/* Remove the 'X' and default search icon in WebKit browsers */
.search-box input::-webkit-search-decoration,
.search-box input::-webkit-search-cancel-button,
.search-box input::-webkit-search-results-button,
.search-box input::-webkit-search-results-decoration {
    display: none;
}

/* Search Button */
.search-btn {
    width: 64px;
    height: 40px;
    background: #222;
    border: none;
    border-left: 1px solid #303030;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.search-btn:hover {
    background: #303030;
}

/* The Magnifying Glass Icon */
.search-btn::before {
    font-size: 18px;
    color: #909090;
    filter: grayscale(100%); /* Remove purple tint */
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .nav-search-container {
        position: absolute;
        top: 60px;
        left: 0;
        width: 100%;
        max-width: 100%;
        background: #0f0f0f;
        padding: 8px 15px;
        margin: 0;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        z-index: 900;
    }
    
    /* Adjust main content to not be hidden by the search bar */
    main.container {
        margin-top: 60px; 
    }
}


/* === TOAST NOTIFICATIONS (top‑right) === */
.toast-container {
    position: fixed;
    top: 80px;               /* below navbar */
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    background: rgba(20,20,25,0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.12);
    padding: 12px 16px;
    border-radius: 10px;
    color: #e5e7eb;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 260px;
    max-width: 360px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
    animation: toast-in 0.25s ease-out forwards;
}
.toast.success { border-left: 4px solid #10b981; }
.toast.error   { border-left: 4px solid #ef4444; }
.toast.info    { border-left: 4px solid #3b82f6; }

.toast.hiding { animation: toast-out 0.25s ease-in forwards; }

@keyframes toast-in {
    from { opacity: 0; transform: translateX(100%); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(100%); }
}

/* === CENTER CONFIRM MODAL === */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.custom-modal {
    background: #111827;
    border-radius: 14px;
    border: 1px solid #374151;
    padding: 22px 22px 18px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    transform: scale(0.9);
    transition: transform 0.2s ease;
}
.modal-overlay.active .custom-modal {
    transform: scale(1);
}
.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
}
.modal-msg {
    font-size: 0.93rem;
    color: #9ca3af;
    margin-bottom: 18px;
    line-height: 1.5;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.btn-modal {
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
}
.btn-modal.cancel {
    background: transparent;
    color: #9ca3af;
    border: 1px solid #4b5563;
}
.btn-modal.cancel:hover {
    background: rgba(249,250,251,0.06);
}
.btn-modal.confirm {
    background: #6366f1;
    color: white;
}
.btn-modal.confirm:hover {
    background: #4f46e5;
}
