/* ==========================================================================
   CINEMATIC VIDEO PLAYER — Premium Dark Glassmorphic Design System
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── Page Shell ─────────────────────────────────────────────────────────── */
.video-page {
    font-family: 'Inter', var(--font-ui, sans-serif);
    background: #0b0700;
    color: #fff;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Cinematic ambient background glow */
.video-page::before {
    content: '';
    position: fixed;
    top: -30%;
    left: 50%;
    transform: translateX(-50%);
    width: 80vw;
    height: 80vh;
    background: radial-gradient(ellipse, rgba(200,150,62,0.06) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* Subtle dot-grid texture */
.video-page::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image: radial-gradient(rgba(255,255,255,0.018) 1px, transparent 1px);
    background-size: 36px 36px;
    pointer-events: none;
    z-index: 0;
}

.video-page > * { position: relative; z-index: 1; }

/* ── Top Navigation Bar ─────────────────────────────────────────────────── */
.video-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 32px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: rgba(255,255,255,0.65);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04);
    transition: all 0.25s ease;
}
.back-link:hover {
    color: var(--accent, #c8963e);
    border-color: rgba(200,150,62,0.4);
    background: rgba(200,150,62,0.08);
    transform: translateX(-3px);
}

/* ── Book Info Strip ────────────────────────────────────────────────────── */
.video-book-strip {
    display: flex;
    align-items: center;
    gap: 16px;
}
.video-book-strip img {
    width: 42px;
    height: 60px;
    object-fit: cover;
    border-radius: 5px;
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: 0 4px 14px rgba(0,0,0,0.5);
    flex-shrink: 0;
}
.video-book-strip-info h2 {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    margin: 0 0 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
}
.video-book-strip-info p {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
    margin: 0;
}

/* Genre badge */
.genre-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(200,150,62,0.15);
    color: var(--accent, #c8963e);
    border: 1px solid rgba(200,150,62,0.3);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    margin-top: 4px;
}

/* ── Main Theater Layout ────────────────────────────────────────────────── */
.video-theater-wrap {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 0;
    min-height: calc(100vh - 72px);
    align-items: start;
}

/* Left: Player panel */
.video-player-panel {
    padding: 28px 28px 28px 32px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Now-playing title */
.now-playing-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent, #c8963e);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}
.now-playing-badge .pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent, #c8963e);
    animation: pulseDot 1.5s ease-in-out infinite;
}
@keyframes pulseDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.7); }
}

.current-video-title {
    font-size: 1.55rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
    margin: 0;
    letter-spacing: -0.3px;
}

/* ── Video Player Container ─────────────────────────────────────────────── */
.video-player-container {
    background: #000;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.06);
    position: relative;
    margin-bottom: 0;
}

.custom-html5-video-wrapper {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.custom-html5-video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.youtube-embed-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    background: #000;
    width: 100%;
}
.youtube-embed-wrapper iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* No video state */
.video-empty-state {
    padding: 80px 40px;
    text-align: center;
    background: rgba(255,255,255,0.02);
}
.video-empty-state .empty-icon { font-size: 3.5rem; margin-bottom: 20px; }
.video-empty-state h3 { color: #fff; font-size: 1.4rem; margin-bottom: 10px; }
.video-empty-state p { color: rgba(255,255,255,0.55); max-width: 360px; margin: 0 auto 24px; font-size: 0.95rem; line-height: 1.6; }

/* ── Right: Playlist Panel ──────────────────────────────────────────────── */
.video-playlist-panel {
    border-left: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.018);
    min-height: calc(100vh - 72px);
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.playlist-header {
    padding: 24px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.playlist-header h3 {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.55);
    margin: 0;
}
.playlist-count {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.06);
    border-radius: 20px;
    padding: 2px 10px;
}

.playlist-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    scrollbar-width: thin;
    scrollbar-color: rgba(200,150,62,0.3) transparent;
}
.playlist-scroll::-webkit-scrollbar { width: 4px; }
.playlist-scroll::-webkit-scrollbar-track { background: transparent; }
.playlist-scroll::-webkit-scrollbar-thumb { background: rgba(200,150,62,0.3); border-radius: 4px; }

/* ── Chapter Button ─────────────────────────────────────────────────────── */
.video-chapter-button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 14px;
    text-align: left;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    background: transparent;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    transition: all 0.22s ease;
    position: relative;
    overflow: hidden;
}
.video-chapter-button::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(200,150,62,0.12) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.22s ease;
}
.video-chapter-button:hover {
    border-color: rgba(200,150,62,0.3);
    color: #fff;
    transform: translateX(3px);
}
.video-chapter-button:hover::before { opacity: 1; }

.video-chapter-button.active {
    border-color: rgba(200,150,62,0.5);
    background: rgba(200,150,62,0.1);
    color: #fff;
}
.video-chapter-button.active::before { opacity: 1; }
.video-chapter-button.active .video-chapter-number {
    background: var(--accent, #c8963e);
    color: #1a0f05;
}

.video-chapter-number {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(255,255,255,0.06);
    color: var(--accent, #c8963e);
    font-size: 0.75rem;
    font-weight: 700;
    transition: all 0.22s ease;
}

.video-chapter-content {
    flex: 1;
    min-width: 0;
}
.video-chapter-title {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.video-chapter-type {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.35);
    margin-top: 2px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.video-chapter-button.active .video-chapter-type { color: rgba(200,150,62,0.7); }

/* Playing indicator for active item */
.playing-indicator {
    flex-shrink: 0;
    display: none;
    gap: 2px;
    align-items: flex-end;
    height: 16px;
}
.video-chapter-button.active .playing-indicator { display: flex; }
.playing-indicator span {
    display: block;
    width: 3px;
    background: var(--accent, #c8963e);
    border-radius: 2px;
    animation: barBounce 0.8s ease-in-out infinite alternate;
}
.playing-indicator span:nth-child(1) { height: 6px; animation-delay: 0s; }
.playing-indicator span:nth-child(2) { height: 12px; animation-delay: 0.15s; }
.playing-indicator span:nth-child(3) { height: 8px; animation-delay: 0.3s; }
@keyframes barBounce {
    from { transform: scaleY(0.4); }
    to   { transform: scaleY(1); }
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
    .video-theater-wrap {
        grid-template-columns: 1fr;
    }
    .video-playlist-panel {
        border-left: none;
        border-top: 1px solid rgba(255,255,255,0.07);
        min-height: auto;
    }
    .playlist-scroll {
        max-height: 320px;
    }
    .video-topbar {
        padding: 14px 18px;
    }
    .video-player-panel {
        padding: 20px 16px;
    }
}

@media (max-width: 640px) {
    .video-book-strip { display: none; }
    .video-topbar { padding: 12px 16px; }
    .current-video-title { font-size: 1.2rem; }
}
