/* =====================================================================
   TEAM CODE DẠO - CINEMA PLAYER & VIDEO STYLES (CINEMA CSS)
   Tách riêng từ single.php & category-phim-ai.php
   Hỗ trợ: Click-to-Play 100/100 PageSpeed, Ambient Lighting, 16:9 Responsive
   ===================================================================== */

/* Container Rạp chiếu phim */
.cinema-player-wrap {
    max-width: 1400px;
    margin: 20px auto 40px;
    padding: 0 16px;
    position: relative;
    z-index: 10;
}

/* Lớp phủ rạp chiếu phim (Dim background khi bật Theater mode) */
#cinema-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.92);
    z-index: 999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
#cinema-overlay.active {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* Khung Player 16:9 Chuẩn Cinema */
.cinema-screen-box {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.25);
    border: 1px solid #1e293b;
    z-index: 1000;
    transition: all 0.3s ease;
}

.cinema-active .cinema-screen-box {
    box-shadow: 0 0 50px rgba(37, 99, 235, 0.5), 0 0 100px rgba(0, 0, 0, 0.9);
}

.cinema-iframe-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* =====================================================================
   CLICK-TO-PLAY POSTER OVERLAY (TĂNG TỐC ĐỘ 100/100 PAGESPEED)
   ===================================================================== */
.cinema-poster-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    transition: opacity 0.3s ease;
}
.cinema-poster-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.7) 100%);
}

.btn-big-play {
    position: relative;
    z-index: 2;
    width: 78px;
    height: 78px;
    background: #2563eb;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 30px;
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7);
    animation: cinemaPulse 2s infinite;
    transition: transform 0.2s ease, background 0.2s ease;
    padding-left: 4px;
}
.cinema-poster-overlay:hover .btn-big-play {
    transform: scale(1.1);
    background: #1d4ed8;
}

.cinema-poster-overlay span.play-hint {
    position: relative;
    z-index: 2;
    color: #ffffff;
    font-size: 14.5px;
    font-weight: 700;
    margin-top: 14px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.6);
    letter-spacing: 0.3px;
}

@keyframes cinemaPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7);
    }
    70% {
        box-shadow: 0 0 0 20px rgba(37, 99, 235, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
    }
}

/* =====================================================================
   CINEMA CONTROLS TOOLBAR
   ===================================================================== */
.cinema-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 18px;
    margin-top: 14px;
    flex-wrap: wrap;
    gap: 10px;
}
body.tcd-dark-mode .cinema-toolbar {
    background: #131b2e;
    border-color: #1e293b;
}

.cinema-title-box h1 {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-main);
    margin: 0 0 4px;
    line-height: 1.35;
}
.cinema-title-box .cinema-meta {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.cinema-action-btns {
    display: flex;
    align-items: center;
    gap: 8px;
}
.cinema-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #334155;
    transition: all 0.15s ease;
}
.cinema-btn:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #2563eb;
}
body.tcd-dark-mode .cinema-btn {
    background: #1e293b;
    border-color: #334155;
    color: #cbd5e1;
}
body.tcd-dark-mode .cinema-btn:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: #3b82f6;
    color: #60a5fa;
}

/* =====================================================================
   PLAYLIST / TẬP PHIM (EPISODE SELECTOR)
   ===================================================================== */
.cinema-episodes-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px 20px;
    margin-top: 18px;
}
.cinema-episodes-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.cinema-episodes-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.cinema-ep-btn {
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 700;
    border-radius: 6px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #334155;
    text-decoration: none;
    transition: all 0.15s ease;
}
.cinema-ep-btn.active, .cinema-ep-btn:hover {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

/* =====================================================================
   CATEGORY PHIM AI / VIDEO GRID (1400PX)
   ===================================================================== */
.video-ai-container {
    max-width: 1400px;
    margin: 30px auto 60px;
    padding: 0 16px;
    width: 100%;
}
.video-ai-header {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 24px 30px;
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.video-ai-header-left h1 {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.video-ai-header-left p {
    font-size: 15px;
    color: var(--text-muted);
    margin: 0;
}
.video-ai-badge-count {
    background: #eff6ff;
    color: #2563eb;
    font-size: 14px;
    font-weight: 700;
    padding: 8px 18px;
    border-radius: 20px;
    border: 1px solid #bfdbfe;
    white-space: nowrap;
}
body.tcd-dark-mode .video-ai-badge-count {
    background: rgba(59, 130, 246, 0.2);
    border-color: #3b82f6;
    color: #60a5fa;
}

.video-ai-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

@media (max-width: 1100px) {
    .video-ai-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 768px) {
    .video-ai-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .cinema-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
}
@media (max-width: 500px) {
    .video-ai-grid {
        grid-template-columns: 1fr;
    }
}

/* =====================================================================
   CATEGORY PHIM AI / VIDEO GRID FULL STYLES
   ===================================================================== */
.video-ai-search-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    margin-bottom: 25px;
    box-shadow: var(--shadow-sm);
}
.video-ai-search-form {
    display: flex;
    align-items: center;
    gap: 12px;
}
.video-ai-search-input {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 11px 16px;
    font-size: 15px;
    outline: none;
    background: #f8fafc;
    color: var(--text-main);
    transition: all 0.15s ease;
}
.video-ai-search-input:focus {
    background: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.video-ai-search-btn {
    padding: 11px 24px;
    background: var(--primary);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-weight: 700;
    font-size: 14.5px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease;
}
.video-ai-search-btn:hover {
    background: var(--primary-hover);
}

.video-ai-thumb-link {
    display: block;
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #0f172a;
    overflow: hidden;
}
.video-ai-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}
.video-ai-card:hover .video-ai-thumb-img {
    transform: scale(1.05);
}
.video-ai-badge-hd {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(37, 99, 235, 0.9);
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    z-index: 2;
}
.video-ai-badge-server {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(15, 23, 42, 0.85);
    color: #38bdf8;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    z-index: 2;
}
.video-ai-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 48px;
    height: 48px;
    background: rgba(37, 99, 235, 0.95);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
    opacity: 0.85;
    transition: all 0.25s ease;
    z-index: 2;
}
.video-ai-card:hover .video-ai-play-btn {
    transform: translate(-50%, -50%) scale(1.1);
    opacity: 1;
    background: #2563eb;
    box-shadow: 0 0 25px rgba(37, 99, 235, 0.7);
}

.video-ai-body {
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.video-ai-title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.45;
    margin: 0 0 8px;
}
.video-ai-title a {
    color: var(--text-main);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.15s ease;
}
.video-ai-title a:hover {
    color: var(--primary);
}
.video-ai-meta {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.video-ai-excerpt {
    font-size: 13.5px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}
.video-ai-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-light);
    padding-top: 12px;
    margin-top: auto;
}
.video-ai-date {
    font-size: 12px;
    color: var(--text-dim);
}
.video-ai-watch-link {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.video-ai-watch-link:hover {
    text-decoration: underline;
}

/* Phân trang Video */
.video-ai-pagination {
    display: flex;
    justify-content: center;
    margin: 40px 0 20px;
}
.video-ai-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 14px;
    margin: 0 4px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-main);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
}
.video-ai-pagination .page-numbers.current {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}
.video-ai-pagination .page-numbers:hover:not(.current) {
    background: var(--primary-light);
    color: var(--primary);
    border-color: #bfdbfe;
}

/* Empty State */
.video-ai-empty {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 50px 20px;
    text-align: center;
}
.video-ai-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}
.video-ai-empty-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
}
.video-ai-empty-desc {
    font-size: 14.5px;
    color: var(--text-muted);
    margin-bottom: 20px;
}
