/* ===================================================
   JDMovies - CINEMATIC PLAYER & WATCH PAGE STYLES
   Optimized for Desktop, Tablet, and Mobile Screens
   =================================================== */

:root {
    --player-blue: #2563eb;
    --player-blue-hover: #1d4ed8;
    --player-blue-glow: rgba(37, 99, 235, 0.45);
    --player-cyan: #38bdf8;
    --player-dark-card: #090d16;
    --player-dark-border: rgba(255, 255, 255, 0.08);
}

/* 1. Main Watch Page Container */
.watch-container {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 0 0 30px 0; /* Full-bleed on mobile */
}

@media (min-width: 768px) {
    .watch-container {
        padding: 24px 16px 40px 16px;
        gap: 28px;
    }
}

/* 2. Cinematic Player Section (Stage) */
.player-section {
    width: 100%;
    background: #000;
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 0; /* Flush on mobile */
    overflow: hidden;
    box-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.95), 0 0 25px rgba(37, 99, 235, 0.12);
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .player-section {
        border-radius: var(--radius-md);
        border: 1px solid rgba(59, 130, 246, 0.25);
    }
}

/* 16:9 Responsive Cinema Ratio */
.video-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
}

.video-container {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-container iframe,
.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    display: block;
    object-fit: contain;
    background: #000;
}

/* 3. Server Selector Panel */
.server-panel {
    background: #080c14;
    padding: 12px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

@media (min-width: 768px) {
    .server-panel {
        padding: 14px 18px;
    }
}

.server-title {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.server-grid {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.server-grid::-webkit-scrollbar {
    display: none;
}

.btn-server {
    background: #101624;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all 0.2s ease;
    flex-shrink: 0;
    white-space: nowrap;
}

.btn-server:hover {
    border-color: var(--player-blue);
    background: #172033;
    color: white;
}

.btn-server.active {
    background: #0f224a;
    border-color: var(--player-blue);
    color: #93c5fd;
    box-shadow: 0 0 14px rgba(37, 99, 235, 0.35);
}

.active-dot {
    position: relative;
    display: inline-flex;
    width: 8px;
    height: 8px;
    margin-left: 2px;
}

.active-dot .ping {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: var(--accent-cyan);
    opacity: 0.75;
    animation: ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.active-dot .dot {
    position: relative;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent-cyan);
}

@keyframes ping {
    75%, 100% {
        transform: scale(2.2);
        opacity: 0;
    }
}

/* 4. TV Control Bar (Fullscreen, Ep Number, Prev/Next) */
.tv-control-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin: 0 12px;
    gap: 8px;
}

@media (min-width: 768px) {
    .tv-control-bar {
        margin: 0;
        padding: 12px 18px;
    }
}

.current-ep-number {
    font-size: 13px;
    font-weight: 700;
    color: #60a5fa;
    background: rgba(37, 99, 235, 0.15);
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid rgba(37, 99, 235, 0.35);
    text-align: center;
    white-space: nowrap;
}

.tv-nav-controls {
    display: flex;
    gap: 6px;
}

.tv-control-btn {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    color: white;
    padding: 7px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 600;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tv-control-btn:hover:not(:disabled) {
    background: var(--player-blue);
    border-color: var(--player-blue);
}

.tv-control-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* 5. Episodes Selector Section */
.content-panel {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    margin: 0 12px;
}

@media (min-width: 768px) {
    .content-panel {
        margin: 0;
        padding: 22px;
    }
}

.ep-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.ep-title h2 {
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
}

.dropdown-container {
    position: relative;
}

.dropdown-btn {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    color: white;
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: 0.2s;
}

.dropdown-btn:hover {
    background: var(--bg-hover);
    border-color: var(--player-blue);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-top: 6px;
    min-width: 160px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 30;
    box-shadow: 0 10px 25px rgba(0,0,0,0.7);
}

.season-option {
    padding: 10px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.season-option:hover {
    background: var(--bg-hover);
}

.season-option.active {
    background: rgba(37, 99, 235, 0.2);
    color: var(--accent-cyan);
    font-weight: 700;
}

.ep-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ep-list {
    flex: 1;
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scroll-behavior: smooth;
    scrollbar-width: none;
}

.ep-list::-webkit-scrollbar {
    display: none;
}

.ep-btn {
    min-width: 44px;
    height: 40px;
    padding: 0 10px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    flex-shrink: 0;
}

.ep-btn:hover {
    background: var(--bg-hover);
    border-color: var(--player-blue);
}

.ep-btn.active {
    background: var(--player-blue);
    border-color: var(--player-blue);
    box-shadow: 0 0 12px var(--player-blue-glow);
}

.btn-all-episodes {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    color: white;
    padding: 0 14px;
    height: 40px;
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: 0.2s;
}

.btn-all-episodes:hover {
    background: var(--bg-hover);
    border-color: var(--player-blue);
}

/* 6. Movie & Show Metadata Section */
.movie-details-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

@media (min-width: 768px) {
    .movie-details-grid {
        display: grid;
        grid-template-columns: 220px 1fr;
        gap: 28px;
    }
}

.movie-poster-card {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
    aspect-ratio: 2 / 3;
    max-width: 200px;
    margin: 0 auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

@media (min-width: 768px) {
    .movie-poster-card {
        max-width: 100%;
        margin: 0;
    }
}

.movie-poster-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.details-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.details-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.details-title {
    font-size: 22px;
    font-weight: 800;
    color: white;
    line-height: 1.2;
}

@media (min-width: 768px) {
    .details-title {
        font-size: 28px;
    }
}

.details-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 4px 0;
}

.badge-quality {
    background: rgba(56, 189, 248, 0.15);
    color: var(--accent-cyan);
    border: 1px solid rgba(56, 189, 248, 0.4);
    font-size: 11px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.badge-rating {
    background: rgba(234, 179, 8, 0.15);
    color: #facc15;
    border: 1px solid rgba(234, 179, 8, 0.4);
    font-size: 12px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
}

.badge-year,
.badge-audio {
    background: #111827;
    color: #cbd5e1;
    border: 1px solid var(--border-color);
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 4px;
}

.genres-pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 4px 0;
}

.genre-pill {
    background: #111827;
    border: 1px solid rgba(59, 130, 246, 0.25);
    color: #93c5fd;
    font-size: 11.5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 500;
}

.details-storyline {
    font-size: 13.5px;
    color: #94a3b8;
    line-height: 1.6;
    margin-top: 6px;
}

.details-meta-list {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
}

.details-meta-item {
    color: #94a3b8;
}

.details-meta-item strong {
    color: #e2e8f0;
}

/* 7. Downloads Section */
.downloads-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dl-v2-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 13.5px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.dl-v2-btn:hover {
    background: #172033;
    border-color: var(--player-blue);
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
}

.dl-v2-icon {
    width: 32px;
    height: 32px;
    background: rgba(37, 99, 235, 0.15);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--player-blue);
}

/* 8. Screenshots & Cast Carousels */
.section-title {
    font-size: 17px;
    font-weight: 700;
    color: white;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.screenshot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}

@media (min-width: 768px) {
    .screenshot-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 14px;
    }
}

.screen-item {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.screen-item:hover {
    transform: scale(1.03);
    border-color: var(--player-blue);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
}

/* Cast Horizontal Carousel */
.scroll-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.nav-btns {
    display: flex;
    gap: 6px;
}

.nav-btn {
    width: 32px;
    height: 32px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.nav-btn:hover {
    background: var(--player-blue);
    border-color: var(--player-blue);
}

.h-scroll-container {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 6px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.h-scroll-container::-webkit-scrollbar {
    display: none;
}

.cast-card {
    min-width: 110px;
    max-width: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

@media (min-width: 768px) {
    .cast-card {
        min-width: 130px;
        max-width: 130px;
    }
}

.cast-img-box {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--border-color);
    margin-bottom: 6px;
    background: #151515;
}

@media (min-width: 768px) {
    .cast-img-box {
        width: 90px;
        height: 90px;
    }
}

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

.cast-name {
    font-size: 12.5px;
    font-weight: 700;
    color: white;
    line-height: 1.2;
}

.cast-role {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* 9. Modals (Lightbox & All Episodes) */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-img {
    max-width: 95%;
    max-height: 88vh;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.close-lightbox {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 32px;
    cursor: pointer;
    transition: 0.2s;
}

.close-lightbox:hover {
    color: white;
}

.modal-content {
    background: var(--bg-panel);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 700px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

.modal-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 17px;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-season-selector {
    padding: 10px 18px;
    background: var(--bg-light);
    border-bottom: 1px solid var(--border-color);
}

.modal-episodes-grid {
    padding: 16px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(65px, 1fr));
    gap: 8px;
}

.modal-ep-btn {
    padding: 10px 4px;
    border-radius: 6px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    color: white;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    transition: 0.2s;
}

.modal-ep-btn:hover {
    background: var(--player-blue);
    border-color: var(--player-blue);
}

.modal-ep-btn.active {
    background: var(--player-blue);
    border-color: var(--player-blue);
    box-shadow: 0 0 10px var(--player-blue-glow);
}
