/* ==========================================
   Classic Cartoon Cinema - Main Stylesheet
   Version: 2024-cozy-drapes-v5-soft-fade
   ========================================== */

:root {
    --drape-red: #8B0000;
    --drape-red-light: #A52A2A;
    --drape-red-dark: #5C0000;
    --gold: #D4AF37;
    --gold-light: #F0E68C;
    --screen-bg: #1a1a2e;
    --screen-surface: #16213e;
    --text-light: #f0f0f0;
    --text-muted: #a0a0a0;
    --accent: #e94560;
    --heart-red: #e74c3c;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    background: #0a0a0a;
    color: var(--text-light);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ==========================================
   DRAPES - Desktop Only
   ========================================== */
.drapes-container {
    display: none;
}

@media (min-width: 1024px) {
    .drapes-container {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        pointer-events: none;
        z-index: 100;
    }

    .drape {
        position: absolute;
        top: 0;
        bottom: 0;
        width: 80px;
        background: linear-gradient(
            90deg,
            var(--drape-red-dark) 0%,
            var(--drape-red) 30%,
            var(--drape-red-light) 50%,
            var(--drape-red) 70%,
            var(--drape-red-dark) 100%
        );
        box-shadow: inset 0 0 30px rgba(0,0,0,0.5);
    }

    .drape::before {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        width: 100%;
        background: repeating-linear-gradient(
            180deg,
            transparent 0px,
            transparent 20px,
            rgba(0,0,0,0.1) 20px,
            rgba(0,0,0,0.1) 22px
        );
    }

    /* Drape folds effect */
    .drape::after {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        width: 100%;
        background: repeating-linear-gradient(
            90deg,
            transparent 0px,
            transparent 8px,
            rgba(0,0,0,0.15) 8px,
            rgba(0,0,0,0.15) 12px,
            transparent 12px,
            transparent 20px
        );
    }

    .drape-left {
        left: 0;
        border-right: 4px solid var(--gold);
        box-shadow: 5px 0 20px rgba(0,0,0,0.5);
    }

    .drape-right {
        right: 0;
        border-left: 4px solid var(--gold);
        box-shadow: -5px 0 20px rgba(0,0,0,0.5);
    }

    /* Top drape valance - luxurious velvet curtain rod */
    .drape-top {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 45px;
        background: linear-gradient(
            180deg,
            var(--gold) 0px,
            var(--gold) 4px,
            #4a0000 4px,
            var(--drape-red-dark) 8px,
            var(--drape-red) 15px,
            var(--drape-red-light) 22px,
            var(--drape-red) 32px,
            var(--drape-red-dark) 40px,
            var(--gold) 40px,
            var(--gold) 45px
        );
        box-shadow: 0 5px 20px rgba(0,0,0,0.7);
        z-index: 2;
    }

    /* Inner drape - soft fade to transparent center */
    .drape-inner {
        position: absolute;
        top: 40px;
        left: 60px;
        right: 60px;
        height: 35px;
        background: linear-gradient(
            180deg,
            var(--drape-red-dark) 0px,
            var(--drape-red) 10px,
            var(--drape-red-light) 18px,
            var(--drape-red) 26px,
            var(--drape-red-dark) 32px,
            var(--gold) 32px,
            var(--gold) 35px
        );
        -webkit-mask: linear-gradient(
            90deg,
            black 0%,
            black 10%,
            rgba(0,0,0,0.7) 20%,
            rgba(0,0,0,0.3) 35%,
            rgba(0,0,0,0.1) 45%,
            transparent 50%,
            rgba(0,0,0,0.1) 55%,
            rgba(0,0,0,0.3) 65%,
            rgba(0,0,0,0.7) 80%,
            black 90%,
            black 100%
        );
        mask: linear-gradient(
            90deg,
            black 0%,
            black 10%,
            rgba(0,0,0,0.7) 20%,
            rgba(0,0,0,0.3) 35%,
            rgba(0,0,0,0.1) 45%,
            transparent 50%,
            rgba(0,0,0,0.1) 55%,
            rgba(0,0,0,0.3) 65%,
            rgba(0,0,0,0.7) 80%,
            black 90%,
            black 100%
        );
        box-shadow: 0 4px 15px rgba(0,0,0,0.5);
        z-index: 1;
        border-radius: 0 0 12px 12px;
    }

    /* Adjust content for drapes */
    .cinema-frame {
        margin: 0 80px;
        padding-top: 85px;
    }
}

/* ==========================================
   MAIN LAYOUT
   ========================================== */
.cinema-frame {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, var(--screen-bg) 0%, #0d0d1a 100%);
}

.cinema-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(0,0,0,0.3);
    border-bottom: 2px solid var(--gold);
}

/* Hide header on desktop - just show the drapes */
@media (min-width: 1024px) {
    .cinema-header {
        display: none;
    }
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--gold);
}

.logo-icon {
    font-size: 1.5rem;
}

.logo-text {
    font-size: 1.2rem;
    font-weight: bold;
    letter-spacing: 1px;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-links a {
    color: var(--text-light);
    text-decoration: none;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--gold);
}

.cinema-screen {
    flex: 1;
    padding: 1rem;
}

.cinema-footer {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.cinema-footer .footer-title {
    color: var(--gold);
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
}

.cinema-footer .footer-nav {
    margin-bottom: 1rem;
}

.cinema-footer .footer-nav a {
    color: var(--text-light);
    text-decoration: none;
    margin: 0 1rem;
    transition: color 0.2s;
}

.cinema-footer .footer-nav a:hover {
    color: var(--gold);
}

/* ==========================================
   LOBBY / GALLERY
   ========================================== */
.lobby {
    max-width: 1400px;
    margin: 0 auto;
}

/* Section Headers */
.section-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem 1rem;
    margin: 1rem 0;
    position: relative;
    scroll-margin-top: 20px;
}

.section-header::before {
    content: '';
    position: absolute;
    top: 1.5rem;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.3), transparent);
}

.section-logo {
    position: relative;
    z-index: 1;
    background: var(--screen-bg);
    padding: 0.5rem;
    opacity: 0.6;
    transition: opacity 0.3s;
    border-radius: 12px;
    overflow: hidden;
    order: 2;
}

.section-logo:hover {
    opacity: 0.9;
}

.disney-logo {
    height: 110px;
    width: auto;
    border-radius: 12px;
}

.tomandjerry-logo {
    height: 120px;
    width: auto;
    border-radius: 12px;
}

.section-jump {
    position: relative;
    z-index: 1;
    color: var(--gold);
    text-decoration: none;
    font-size: 0.85rem;
    padding: 0.4rem 1rem;
    background: var(--screen-bg);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 20px;
    opacity: 0.6;
    transition: opacity 0.3s, border-color 0.3s;
    order: 1;
}

.section-jump:hover {
    opacity: 1;
    border-color: var(--gold);
}

/* Continue Watching */
.continue-watching {
    margin-bottom: 2rem;
    padding: 1rem;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    border-left: 4px solid var(--gold);
}

.continue-watching h2 {
    color: var(--gold);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.continue-list {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.continue-item {
    flex-shrink: 0;
    width: 150px;
    text-decoration: none;
    color: var(--text-light);
}

.continue-item .thumb {
    position: relative;
    width: 150px;
    height: 100px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--screen-surface);
}

.continue-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.continue-item .progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--accent);
}

.continue-item .title {
    margin-top: 0.3rem;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Controls */
.controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 200px;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 25px;
    background: rgba(255,255,255,0.1);
    color: var(--text-light);
    font-size: 1rem;
    transition: border-color 0.2s, background 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--gold);
    background: rgba(255,255,255,0.15);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.sort-options {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sort-options label {
    color: var(--text-muted);
}

.sort-options select {
    padding: 0.5rem 1rem;
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    background: rgba(255,255,255,0.1);
    color: var(--text-light);
    cursor: pointer;
}

.sort-options select option {
    background: #1a1a2e;
    color: var(--text-light);
}

/* Cartoon Grid */
.cartoon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

@media (min-width: 1024px) {
    .cartoon-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 600px) {
    .cartoon-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
}

/* Cartoon Card */
.cartoon-card {
    text-decoration: none;
    color: var(--text-light);
    background: var(--screen-surface);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.4s ease forwards;
}

.cartoon-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cartoon-card .thumbnail {
    position: relative;
    aspect-ratio: 4/3;
    background: #0a0a1a;
    overflow: hidden;
}

.cartoon-card .thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.cartoon-card:hover .thumbnail img {
    transform: scale(1.05);
}

.cartoon-card .thumbnail .play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.4);
    opacity: 0;
    transition: opacity 0.3s;
}

.cartoon-card:hover .play-overlay {
    opacity: 1;
}

.play-overlay .play-icon {
    font-size: 3rem;
    color: white;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

/* Watched badge */
.watched-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: rgba(46, 204, 113, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    color: white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* Unavailable card - darkened, no spotlight */
.cartoon-card.unavailable {
    cursor: default;
}

.cartoon-card.unavailable .thumbnail {
    filter: grayscale(100%) brightness(0.4);
}

.cartoon-card.unavailable:hover {
    transform: none;
    box-shadow: none;
}

.cartoon-card.unavailable:hover .thumbnail img {
    transform: none;
}

.cartoon-card.unavailable .info {
    opacity: 0.5;
}


/* Unavailable screen in theater/watch page */
.unavailable-screen {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
}

.unavailable-screen img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: grayscale(100%) brightness(0.4);
}

.unavailable-screen .unavailable-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.5);
    gap: 1rem;
}

.unavailable-screen .unavailable-icon {
    font-size: 5rem;
    color: rgba(255,255,255,0.6);
    font-weight: 200;
}

.unavailable-screen .unavailable-text {
    font-size: 1.2rem;
    color: rgba(255,255,255,0.6);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.cartoon-card .info {
    padding: 0.75rem;
}

.cartoon-card .title {
    font-size: 0.95rem;
    font-weight: bold;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cartoon-card .meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.cartoon-card .hearts {
    color: var(--heart-red);
}

/* Loading */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.film-reel {
    display: inline-block;
    width: 40px;
    height: 40px;
    margin-bottom: 0.5rem;
}

.reel {
    width: 100%;
    height: 100%;
    border: 3px solid var(--gold);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.end-message {
    text-align: center;
    padding: 2rem;
    font-size: 1.5rem;
    font-style: italic;
    color: var(--gold);
}

/* ==========================================
   VIDEO PLAYER / THEATER
   ========================================== */
.theater {
    max-width: 1000px;
    margin: 0 auto;
    min-height: calc(100vh - 150px);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.movie-screen {
    background: #000;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
}

.movie-screen video {
    display: block;
    width: 100%;
    max-height: 70vh;
}

.movie-info {
    padding: 1.5rem 0;
}

.movie-title {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--gold);
}

.movie-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.like-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 2px solid var(--heart-red);
    border-radius: 25px;
    background: transparent;
    color: var(--heart-red);
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s, transform 0.2s;
}

.like-btn:hover {
    background: var(--heart-red);
    color: white;
}

.like-btn:active {
    transform: scale(0.95);
}

.like-btn.liked {
    background: var(--heart-red);
    color: white;
}

.heart-icon {
    font-size: 1.2rem;
}

.view-count {
    color: var(--text-muted);
}

.movie-description {
    line-height: 1.6;
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

.back-link {
    display: inline-block;
    color: var(--gold);
    text-decoration: none;
    transition: opacity 0.2s;
}

.back-link:hover {
    opacity: 0.8;
}

/* ==========================================
   STATISTICS PAGE
   ========================================== */
.stats-page {
    max-width: 1000px;
    margin: 0 auto;
}

.stats-page h1 {
    color: var(--gold);
    margin-bottom: 1.5rem;
    text-align: center;
}

.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--screen-surface);
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    border-top: 3px solid var(--gold);
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    color: var(--gold);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stats-section {
    background: var(--screen-surface);
    padding: 1.5rem;
    border-radius: 8px;
}

.stats-section h2 {
    color: var(--gold);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.stats-list {
    list-style: none;
    counter-reset: item;
}

.stats-list li {
    counter-increment: item;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stats-list li::before {
    content: counter(item) ".";
    color: var(--gold);
    font-weight: bold;
    min-width: 1.5rem;
}

.stats-list .count {
    margin-left: auto;
    color: var(--text-muted);
}

.chart-section {
    grid-column: 1 / -1;
}

.chart-container {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    height: 150px;
    padding: 1rem 0;
}

.chart-bar {
    flex: 1;
    background: linear-gradient(to top, var(--accent), var(--gold));
    border-radius: 4px 4px 0 0;
    position: relative;
    min-height: 10px;
    transition: height 0.3s;
}

.chart-bar .label {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.chart-bar .value {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    color: var(--text-light);
}

/* ==========================================
   TABLET OPTIMIZATIONS
   ========================================== */
@media (min-width: 768px) and (max-width: 1023px) {
    .cartoon-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .cartoon-card {
        animation-duration: 0.3s;
    }

    .cinema-header {
        padding: 1rem 1.5rem;
    }

    .cinema-screen {
        padding: 1.5rem;
    }
}

/* ==========================================
   MOBILE OPTIMIZATIONS
   ========================================== */
@media (max-width: 767px) {
    .logo-text {
        font-size: 1rem;
    }

    .movie-title {
        font-size: 1.4rem;
    }

    .controls {
        flex-direction: column;
    }

    .sort-options {
        justify-content: flex-end;
    }

    .continue-watching h2 {
        font-size: 1rem;
    }

    .continue-item {
        width: 120px;
    }

    .continue-item .thumb {
        width: 120px;
        height: 80px;
    }
}

/* ==========================================
   LAZY LOADING PLACEHOLDER
   ========================================== */
.thumbnail img[data-src] {
    background: linear-gradient(
        90deg,
        var(--screen-surface) 25%,
        rgba(255,255,255,0.1) 50%,
        var(--screen-surface) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

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

/* Virtual scroll placeholder - maintains grid position */
.cartoon-card-placeholder {
    aspect-ratio: 4/5;
    background: var(--screen-surface);
    border-radius: 8px;
}

/* ==========================================
   CUSTOM SCROLLBAR - Cinema Theme
   ========================================== */
/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--drape-red) var(--screen-bg);
}

/* Chrome, Edge, Safari */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--screen-bg);
    border-left: 1px solid rgba(212, 175, 55, 0.2);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(
        180deg,
        var(--drape-red-dark) 0%,
        var(--drape-red) 30%,
        var(--drape-red-light) 50%,
        var(--drape-red) 70%,
        var(--drape-red-dark) 100%
    );
    border-radius: 6px;
    border: 2px solid var(--screen-bg);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(
        180deg,
        var(--drape-red) 0%,
        var(--drape-red-light) 30%,
        #c44 50%,
        var(--drape-red-light) 70%,
        var(--drape-red) 100%
    );
}

::-webkit-scrollbar-corner {
    background: var(--screen-bg);
}
