/* ============================================
   KV-Netflix Watch Page Styles
   Apple TV+ Inspired Design
   ============================================ */

/* ============================================
   Watch Page Variables
   ============================================ */
:root {
    --watch-bg: #000000;
    --watch-text-primary: #ffffff;
    --watch-text-secondary: rgba(255, 255, 255, 0.55);
    --watch-accent: #ffffff;
    /* Apple uses white for selection/focus */
    --watch-button-bg: #ffffff;
    --watch-button-text: #000000;
    --watch-glass-bg: rgba(255, 255, 255, 0.1);
    --watch-glass-border: rgba(255, 255, 255, 0.15);

    --font-primary: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
    --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
}

/* ============================================
   Page Layout
   ============================================ */
.watch-page {
    background: var(--watch-bg);
    color: var(--watch-text-primary);
    min-height: 100vh;
    font-family: var(--font-primary);
    overflow-x: hidden;
}

/* ============================================
   Watch Header - Minimal Design
   ============================================ */
.watch-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    z-index: 1000;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
    transition: background 0.4s ease, backdrop-filter 0.4s ease;
}

.watch-header.scrolled {
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.watch-header__left,
.watch-header__right {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
}

.watch-header__center {
    flex: 0;
}

.watch-header__right {
    justify-content: flex-end;
}

.watch-header__back {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s ease;
    padding: 8px 12px;
    border-radius: 50px;
}

.watch-header__back:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.watch-header__logo {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    letter-spacing: -0.5px;
    opacity: 0.9;
}

.watch-header__btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.2s ease;
}

.watch-header__btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: scale(1.05);
}

/* ============================================
   Watch Main Content
   ============================================ */
.watch-main {
    padding-bottom: 80px;
}

/* ============================================
   Video Theater Section
   ============================================ */
.video-theater {
    position: relative;
    width: 100%;
    background: #000;
    height: 70vh;
    /* Reduced for better spacing */
    max-height: 900px;
    min-height: 500px;
}

.video-theater__container {
    position: relative;
    width: 100%;
    height: 100%;
}

.video-theater__player {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
}

/* Ensure iframe fills container */
.video-theater__player iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Loading State */
.video-theater__loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    color: rgba(255, 255, 255, 0.6);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Gradient Overlay - Crucial for the "Immersive" feel */
.video-theater__gradient {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 400px;
    background: linear-gradient(to bottom, transparent 0%, #000000 90%);
    pointer-events: none;
    z-index: 2;
}

/* ============================================
   Movie Details Section - Immersive Overlay
   ============================================ */
.movie-details {
    position: relative;
    margin-top: 0;
    /* Clean separation - no overlap */
    padding-top: 40px;
    z-index: 10;
    padding-bottom: 40px;
}

.movie-details__container {
    max-width: 1400px;
    /* Wide container */
    margin: 0 auto;
    padding: 0 60px;
}

/* Info Elements */
.info-content {
    max-width: 800px;
}

/* Dynamic Badge Container */
.info-badges {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    align-items: center;
}

.badge-logo {
    height: 20px;
    width: auto;
    opacity: 0.8;
}

/* Title */
.info-title {
    font-family: var(--font-display);
    font-size: 56px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 8px 0;
    letter-spacing: -1px;
    line-height: 1.1;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.info-original-title {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.6);
    margin: 0 0 20px 0;
    font-weight: 400;
}

/* Metadata Row */
.info-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    font-size: 15px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
}

.meta-divider {
    width: 3px;
    height: 3px;
    background-color: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
}

.meta-quality {
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 1px 4px;
    border-radius: 4px;
    font-size: 11px;
    line-height: 1.2;
}

/* Action Buttons */
.info-actions {
    display: flex;
    gap: 16px;
    margin-bottom: 32px;
    margin-top: 32px;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 32px;
    border-radius: 40px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border: none;
    letter-spacing: -0.01em;
}

/* Primary Play Button - White Pill */
.action-btn--primary {
    background: #ffffff;
    color: #000000;
}

.action-btn--primary:hover {
    transform: scale(1.04);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

/* Secondary Buttons - Glass/Circle */
.action-btn--glass {
    background: var(--glass-bg);
    color: #ffffff;
    backdrop-filter: var(--glass-blur) var(--glass-saturate);
    -webkit-backdrop-filter: var(--glass-blur) var(--glass-saturate);
    border: var(--apple-border);
    padding: 12px 24px;
    border-radius: 40px;
}

.action-btn--glass.icon-only {
    padding: 0;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    min-width: 48px;
    justify-content: center;
    flex: 0 0 48px;
    /* Force circle */
}

.action-btn--glass:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.06);
}

.action-btn--glass.active {
    background: #ffffff;
    color: #000000;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
}

/* Description */
.info-description {
    font-size: 17px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 50px;
    max-width: 700px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Genres */
.info-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.genre-tag {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: color 0.2s;
}

.genre-tag:hover {
    color: #fff;
    text-decoration: underline;
}

/* ============================================
   Section Styling (Shared)
   ============================================ */
.content-section {
    padding: 40px 0;
    opacity: 0;
    animation: fadeIn 0.8s ease forwards;
    animation-delay: 0.3s;
}

.content-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 60px;
}

.section-title {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 24px 0;
    letter-spacing: -0.5px;
}

/* ============================================
   Episodes Section
   ============================================ */
.episodes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* Episode Card */
.episode-card {
    background: transparent;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.episode-card:hover {
    transform: scale(1.02);
}

.episode-card.active .episode-thumb {
    box-shadow: 0 0 0 3px #fff;
}

.episode-thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
    background: #1a1a1a;
}

.episode-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s;
}

.episode-card:hover .episode-thumb img {
    opacity: 0.8;
}

/* Modal Content */
.modal__content {
    position: relative;
    width: 100%;
    max-width: 480px;
    margin: var(--spacing-xl);
    padding: var(--spacing-xl);
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur-deep) var(--glass-saturate);
    -webkit-backdrop-filter: var(--glass-blur-deep) var(--glass-saturate);
    border: var(--apple-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
}

/* Play Icon Overlay */
.episode-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s;
    backdrop-filter: blur(4px);
}

.episode-card:hover .episode-play {
    opacity: 1;
}

.episode-info h3 {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    margin: 0 0 4px 0;
}

.episode-info p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================
   Carousel (Recommendations & Cast)
   ============================================ */
.carousel-wrapper {
    position: relative;
    margin: 0 -60px;
    /* Bleed out */
    padding: 0 60px;
    /* Padding in */
    overflow-x: auto;
    display: flex;
    gap: 20px;
    padding-bottom: 30px;
    /* Space for scrollbar/shadow */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.carousel-wrapper::-webkit-scrollbar {
    display: none;
}

/* Recommended Video Card */
.rec-card {
    flex: 0 0 180px;
    /* Smaller cards for more movies */
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.rec-card:hover {
    transform: scale(1.03);
}

.rec-img-container {
    aspect-ratio: 2 / 3;
    /* Poster style */
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 10px;
    background: #1a1a1a;
}

.rec-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rec-title {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.rec-meta {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

/* Cast Specifics */
.cast-member {
    flex: 0 0 100px;
    /* Reduced from 140px */
    text-align: center;
}

.cast-avatar {
    width: 100px;
    /* Reduced from 140px */
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 8px;
    /* Reduced from 12px */
    background: #1a1a1a;
    transition: transform 0.3s;
}

.cast-member:hover .cast-avatar {
    transform: scale(1.05);
}

.cast-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Hide avatar if it's a placeholder */
.cast-member.no-photo .cast-avatar {
    display: none;
}

.cast-name {
    font-size: 13px;
    /* Reduced from 14px */
    font-weight: 600;
    color: #fff;
    margin-bottom: 2px;
}

.cast-role {
    font-size: 11px;
    /* Reduced from 12px */
    color: rgba(255, 255, 255, 0.5);
}

/* Clickable cast hover effect */
a.cast-member:hover .cast-name {
    text-decoration: underline;
    color: var(--color-accent, #e5c07b);
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 1024px) {
    .video-theater {
        height: 60vh;
        min-height: auto;
    }

    .movie-details {
        margin-top: -100px;
    }

    .info-title {
        font-size: 40px;
    }

    .movie-details__container,
    .content-container {
        padding: 0 30px;
    }

    .carousel-wrapper {
        margin: 0 -30px;
        padding: 0 30px;
    }
}

@media (max-width: 768px) {
    .watch-header {
        padding: 0 20px;
        height: 60px;
    }

    .video-theater {
        height: 50vh;
    }

    .info-title {
        font-size: 32px;
    }

    .info-actions {
        flex-wrap: wrap;
    }

    .action-btn {
        flex: 0 0 auto;
        justify-content: center;
    }

    .movie-details__container,
    .content-container {
        padding: 0 20px;
    }

    .carousel-wrapper {
        margin: 0 -20px;
        padding: 0 20px;
    }

    .rec-card {
        flex: 0 0 140px;
    }
}

/* Toast Override */
.toast-container {
    z-index: 2000;
}

/* ============================================
   Netflix Title Page Styles
   ============================================ */

/* Player Section */
.title-player-section {
    padding-top: 70px;
    background: #000;
}

.title-player-section .video-theater__player {
    max-width: 1600px;
    margin: 0 auto;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 0;
}

/* Title Details Container */
.title-details {
    background: #141414;
    padding: 40px 0 60px;
}

.title-details__container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 60px;
}

/* Title Info */
.title-info {
    margin-bottom: 32px;
}

.title-info__name {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 12px;
    letter-spacing: -0.5px;
}

.title-info__meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    font-size: 15px;
    color: rgba(255, 255, 255, 0.7);
}

.title-info__meta .meta-quality {
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.title-info__meta .meta-divider {
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
}

.title-info__description {
    font-size: 1rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.75);
    margin: 0 0 24px;
    max-width: 800px;
}

/* Title Action Buttons */
.title-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.title-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.title-action-btn--icon {
    width: 44px;
    height: 44px;
}

.title-action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.title-action-btn.active {
    background: #fff;
    color: #000;
    border-color: #fff;
}

/* ============================================
   Netflix Floating Pill Tabs
   ============================================ */
.title-tabs {
    display: flex;
    gap: 8px;
    margin: 40px 0 24px;
    padding: 0;
    border-bottom: none;
}

.title-tab {
    padding: 10px 24px;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    border-radius: 9999px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.title-tab:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.title-tab.active {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* Title Panels */
.title-panel {
    animation: fadeIn 0.3s ease;
}

/* ============================================
   Episode Buttons Grid (Netflix Style)
   ============================================ */
.episodes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.episodes-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

.episodes-count {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.5);
}

.episodes-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.episode-btn {
    min-width: 54px;
    height: 44px;
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.episode-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.03);
}

.episode-btn.active {
    background: #e50914;
    border-color: #e50914;
    color: #fff;
}

/* ============================================
   More Like This Section
   ============================================ */
.rec-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.rec-section:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.rec-section-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #fff;
    margin: 0 0 16px;
}

.rec-carousel {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 16px;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.rec-carousel::-webkit-scrollbar {
    display: none;
}

/* Netflix Poster Cards - 150x210px */
.rec-card {
    flex: 0 0 150px;
    text-decoration: none;
    color: #fff;
    transition: transform 0.2s ease;
}

.rec-card:hover {
    transform: scale(1.05);
}

.rec-card .rec-img-container {
    width: 150px;
    height: 210px;
    border-radius: 4px;
    overflow: hidden;
    background: #2a2a2a;
    margin-bottom: 8px;
}

.rec-card .rec-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rec-card-title {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.rec-card-meta {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

/* ============================================
   Details Panel - Cast & Crew
   ============================================ */
.details-section {
    margin-bottom: 32px;
}

.details-section__title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #fff;
    margin: 0 0 16px;
}

.cast-carousel {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 16px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.cast-carousel::-webkit-scrollbar {
    display: none;
}

/* ============================================
   Responsive - Title Page
   ============================================ */
@media (max-width: 1024px) {
    .title-details__container {
        padding: 0 40px;
    }

    .title-info__name {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .title-details__container {
        padding: 0 20px;
    }

    .title-info__name {
        font-size: 1.5rem;
    }

    .title-tabs {
        flex-wrap: wrap;
    }

    .title-tab {
        padding: 8px 16px;
        font-size: 13px;
    }

    .rec-card {
        flex: 0 0 120px;
    }

    .rec-card .rec-img-container {
        width: 120px;
        height: 168px;
    }
}