/* ============================================
   CineVault — Dark Theme Video Gallery
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #16161f;
    --bg-card-hover: #1c1c28;
    --bg-surface: #1e1e2a;
    --text-primary: #eaeaef;
    --text-secondary: #8b8b9e;
    --text-muted: #5a5a6e;
    --accent: #7c5cfc;
    --accent-light: #9b7fff;
    --accent-glow: rgba(124, 92, 252, 0.3);
    --accent-secondary: #fc5c8c;
    --gradient-1: linear-gradient(135deg, #7c5cfc, #fc5c8c);
    --gradient-2: linear-gradient(135deg, #7c5cfc 0%, #5ca0fc 50%, #fc5c8c 100%);
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 64px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(124, 92, 252, 0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* --- Ambient Background --- */
.ambient-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.4;
    animation: blobFloat 20s ease-in-out infinite;
}

.blob-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(124, 92, 252, 0.15), transparent 70%);
    top: -200px;
    left: -100px;
    animation-delay: 0s;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(252, 92, 140, 0.1), transparent 70%);
    bottom: -150px;
    right: -100px;
    animation-delay: -7s;
}

.blob-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(92, 160, 252, 0.1), transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
}

@keyframes blobFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(40px, -30px) scale(1.05); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(30px, 40px) scale(1.02); }
}

/* --- Navbar --- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 40px;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(20px) saturate(1.5);
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
    border-bottom: 1px solid var(--border);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.brand-icon {
    width: 28px;
    height: 28px;
    color: var(--accent);
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.brand-text {
    font-size: 1.3rem;
    font-weight: 700;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.nav-search {
    position: relative;
    flex: 0 1 400px;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}

.nav-search input {
    width: 100%;
    padding: 10px 16px 10px 44px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 50px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}

.nav-search input::placeholder {
    color: var(--text-muted);
}

.nav-search input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: var(--bg-card);
}

.nav-actions {
    display: flex;
    gap: 6px;
}

.nav-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.nav-btn:hover,
.nav-btn.active {
    background: var(--bg-surface);
    border-color: var(--accent);
    color: var(--accent-light);
}

.nav-btn svg {
    width: 18px;
    height: 18px;
}

/* --- Hero --- */
.hero {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 80px 40px 40px;
}

.hero-title {
    font-size: clamp(2.2rem, 5vw, 4rem);
    font-weight: 900;
    line-height: 1.15;
    letter-spacing: -0.03em;
    margin-bottom: 16px;
}

.title-accent {
    background: var(--gradient-2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 500px;
    margin: 0 auto;
    font-weight: 300;
}

/* --- Filter Bar --- */
.filter-bar {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 20px 40px 40px;
}

.filter-chip {
    padding: 8px 22px;
    border: 1px solid var(--border);
    border-radius: 50px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.filter-chip:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
    background: var(--bg-surface);
}

.filter-chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    box-shadow: 0 4px 20px var(--accent-glow);
}

/* --- Gallery Grid --- */
.gallery {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    padding: 0 40px 60px;
    max-width: 1440px;
    margin: 0 auto;
    transition: var(--transition);
}

.gallery.list-view {
    grid-template-columns: 1fr;
    max-width: 900px;
}

.gallery.list-view .card {
    display: grid;
    grid-template-columns: 280px 1fr;
}

.gallery.list-view .card-thumbnail {
    height: 180px;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.gallery.list-view .card-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* --- Video Card --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    opacity: 0;
    transform: translateY(30px);
    animation: cardIn 0.6s ease forwards;
}

.card:hover {
    transform: translateY(-6px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    background: var(--bg-card-hover);
}

@keyframes cardIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.15s; }
.card:nth-child(4) { animation-delay: 0.2s; }
.card:nth-child(5) { animation-delay: 0.25s; }
.card:nth-child(6) { animation-delay: 0.3s; }
.card:nth-child(7) { animation-delay: 0.35s; }
.card:nth-child(8) { animation-delay: 0.4s; }
.card:nth-child(9) { animation-delay: 0.45s; }

.card-thumbnail {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: var(--bg-secondary);
}

.card-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-slow);
}

.card:hover .card-thumbnail img {
    transform: scale(1.08);
}

.card-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: var(--transition);
}

.card:hover .card-play-overlay {
    opacity: 1;
}

.play-btn {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 8px 32px rgba(124, 92, 252, 0.4);
    transform: scale(0.8);
    transition: var(--transition);
}

.card:hover .play-btn {
    transform: scale(1);
}

.play-btn svg {
    width: 24px;
    height: 24px;
    color: #fff;
    margin-left: 3px;
}

.card-duration {
    position: absolute;
    bottom: 10px;
    right: 10px;
    padding: 3px 8px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.03em;
}

.card-category-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 12px;
    background: var(--gradient-1);
    border-radius: 50px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.card-body {
    padding: 18px 20px 20px;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.card-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-meta svg {
    width: 14px;
    height: 14px;
}

/* --- No Results --- */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

.no-results svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.4;
}

.no-results h3 {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    position: relative;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: var(--transition);
    box-shadow: var(--shadow-lg);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--accent);
    transform: rotate(90deg);
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-video-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
}

.modal-video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.modal-info {
    padding: 24px 28px 28px;
}

.modal-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
}

.modal-meta span {
    padding: 4px 14px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 500;
}

.modal-category {
    background: var(--gradient-1);
    color: #fff;
}

.modal-duration {
    background: var(--bg-surface);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.modal-views {
    background: var(--bg-surface);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.modal-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.7;
}

/* --- Footer --- */
.footer {
    position: relative;
    z-index: 1;
    border-top: 1px solid var(--border);
    padding: 40px;
    text-align: center;
}

.footer-content {
    max-width: 600px;
    margin: 0 auto;
}

.footer-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.footer-brand .brand-icon {
    width: 22px;
    height: 22px;
}

.footer-text {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--accent-light);
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-surface);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .navbar {
        padding: 12px 20px;
        flex-wrap: wrap;
        gap: 12px;
    }

    .nav-search {
        order: 3;
        flex: 1 1 100%;
    }

    .hero {
        padding: 50px 20px 20px;
    }

    .hero-title {
        font-size: 2rem;
    }

    .filter-bar {
        padding: 16px 20px 24px;
    }

    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 16px;
        padding: 0 20px 40px;
    }

    .gallery.list-view .card {
        grid-template-columns: 1fr;
    }

    .gallery.list-view .card-thumbnail {
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        height: 200px;
    }

    .modal {
        width: 95%;
        border-radius: var(--radius-lg);
    }

    .footer {
        padding: 30px 20px;
    }
}

@media (max-width: 480px) {
    .gallery {
        grid-template-columns: 1fr;
    }

    .nav-actions {
        display: none;
    }
}
