/* ========================================
   WATCH PAGE CRITICAL CSS v4.2.6
   Last updated: 2026-04-09
   Critical CSS for watch page - Moved from episode-phimus.php
   ======================================== */

/* Body and Layout */
body.single-ophim {
    background: #0a0a0a !important;
    color: #fff !important;
    font-family: 'Roboto', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    line-height: 1.6 !important;
}

body.single-ophim .container {
    max-width: 1200px !important;
    margin: 0 auto !important;
    padding: 0 15px !important;
}

/* Breadcrumb box + margin → motchill-breadcrumbs.css (header, load trước file này) */

/* Player Box */
body.single-ophim .box-player {
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%) !important;
    border-radius: 15px !important;
    padding: 20px !important;
    margin-bottom: 30px !important;
    box-shadow: 0 8px 25px rgba(0,0,0,0.4) !important;
    border: 1px solid rgba(102, 126, 234, 0.1) !important;
}

/* Video Player — fill aspect-ratio box; fixed px height caused empty black band below ArtPlayer */
body.single-ophim #player {
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    background: #000 !important;
    box-sizing: border-box !important;
}

/* ========================================
   FIX FOUC: LOADING SPINNER CRITICAL CSS
   Prevent flash of unstyled content on page load
   ======================================== */

/* Video Container - MUST load first */
.motchill-video-container {
    position: relative !important;
    width: 100% !important;
    height: 0 !important;
    padding-bottom: 56.25% !important; /* 16:9 aspect ratio */
    background: #000 !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
    opacity: 1 !important;
    transition: opacity 0.3s ease-in-out !important;
}

.motchill-video-player {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: #000 !important;
}

/* Loading Spinner - Critical for first paint */
.motchill-loading-spinner {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(0, 0, 0, 0.95) !important;
    z-index: 10 !important;
    opacity: 1 !important;
    transition: opacity 0.3s ease-out !important;
}

.motchill-loading-spinner.hidden {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Spinner animation */
.motchill-loading-spinner .spinner {
    width: 50px !important;
    height: 50px !important;
    border: 4px solid rgba(102, 126, 234, 0.3) !important;
    border-top-color: #667eea !important;
    border-radius: 50% !important;
    animation: spin 1s linear infinite !important;
    margin-bottom: 20px !important;
}

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

/* Loading text */
.motchill-loading-spinner p {
    color: #fff !important;
    font-size: 16px !important;
    font-weight: 500 !important;
    margin: 10px 0 !important;
    text-align: center !important;
}

/* Loading progress bar */
.loading-progress {
    width: 200px !important;
    height: 4px !important;
    background: rgba(255, 255, 255, 0.1) !important;
    border-radius: 2px !important;
    overflow: hidden !important;
    margin-top: 15px !important;
}

.loading-progress .progress-bar {
    height: 100% !important;
    background: linear-gradient(90deg, #667eea, #764ba2) !important;
    width: 0% !important;
    animation: loadProgress 2s ease-in-out infinite !important;
}

@keyframes loadProgress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* ========================================
   FIX FOUC: CRITICAL BUTTONS & CONTROLS CSS
   Must load first to prevent unstyled buttons flash
   ======================================== */

/* Control Buttons - Critical styling for immediate display */
.motchill-control-btn {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 8px 12px !important;
    background: #1f2126 !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 8px !important;
    color: rgba(245, 247, 255, 0.92) !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    backdrop-filter: blur(10px) !important;
    min-width: auto !important;
}

.motchill-control-btn:hover {
    background: #2a2d35 !important;
    border-color: rgba(161, 174, 255, 0.42) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.22) !important;
}

.motchill-control-btn i {
    font-size: 16px !important;
    width: 16px !important;
    height: 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}

/* Theater button non-active: đồng bộ control mặc định */
.motchill-theater-btn:not(.active) {
    background: #1f2126 !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    color: rgba(245, 247, 255, 0.92) !important;
    box-shadow: none !important;
}

/* Toggle ON/OFF indicator */
.motchill-toggle {
    background: #667eea !important;
    color: #fff !important;
    padding: 2px 8px !important;
    border-radius: 12px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
}

/* Server Selection Buttons - VIP #1, VIP #2 */
.motchill-server-btn {
    padding: 8px 16px !important;
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 6px !important;
    color: #ffffff !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    min-width: 70px !important;
}

.motchill-server-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border-color: #667eea !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4) !important;
}

.motchill-server-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border-color: #667eea !important;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4) !important;
}

/* Server Controls Container */
.motchill-server-controls {
    display: flex !important;
    gap: 10px !important;
    flex-wrap: wrap !important;
}

/* Player Controls Section */
.motchill-player-controls {
    display: flex !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
    align-items: center !important;
}

/* Rating Section - Critical for immediate display */
.motchill-rating-bottom {
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
}

.motchill-rating-bottom-content {
    display: flex !important;
    align-items: center !important;
    gap: 15px !important;
}

.motchill-rating-bottom-label {
    font-size: 13px !important;
    color: rgba(255, 255, 255, 0.7) !important;
    font-weight: 600 !important;
}

.motchill-rating-bottom-stars {
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
}

.motchill-rating-bottom-star {
    font-size: 16px !important;
    color: #ffc107 !important;
}

.motchill-rating-bottom-score {
    font-size: 16px !important;
    font-weight: 700 !important;
    color: #fff !important;
}

.motchill-rating-bottom-slash,
.motchill-rating-bottom-max {
    font-size: 12px !important;
    color: rgba(255, 255, 255, 0.5) !important;
}

.motchill-rating-bottom-votes {
    font-size: 11px !important;
    color: rgba(255, 255, 255, 0.4) !important;
}

.motchill-rating-bottom-btn {
    padding: 8px 16px !important;
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%) !important;
    border: none !important;
    border-radius: 8px !important;
    color: #fff !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 3px 10px rgba(33, 150, 243, 0.3) !important;
}

.motchill-rating-bottom-btn:hover {
    background: linear-gradient(135deg, #42a5f5 0%, #1e88e5 100%) !important;
    box-shadow: 0 5px 15px rgba(33, 150, 243, 0.5) !important;
    transform: translateY(-2px) !important;
}

/* ========================================
   FIX FOUC: HIDE ELEMENTS UNTIL CSS LOADS
   Prevent flash of partially styled elements
   ======================================== */

/* Secondary elements - hide until fully styled */
.motchill-episodes-section,
.motchill-movie-info,
.motchill-comments-section {
    opacity: 0 !important;
    animation: fadeInSlow 0.5s ease-in-out 0.3s forwards !important;
}

@keyframes fadeInSlow {
    to {
        opacity: 1 !important;
    }
}

/* Ensure player section is visible */
.motchill-player-section {
    opacity: 1 !important;
}

/* Smooth page reveal */
body.single-ophim {
    animation: pageReveal 0.3s ease-in-out !important;
}

@keyframes pageReveal {
    from {
        opacity: 0.95;
    }
    to {
        opacity: 1;
    }
}

/* Chiều cao player do .motchill-video-container (padding-bottom %) quyết định — không set px ở đây */

/* Rating Modal Styles */
.motchill-rating-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(10px);
}

.motchill-rating-content {
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    padding: 30px;
    border-radius: 15px;
    border: 1px solid rgba(102, 126, 234, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.motchill-rating-title {
    color: #fff;
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
}

.motchill-emoji-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.motchill-emoji-item {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.motchill-emoji-item:hover {
    background: rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}

.motchill-emoji-item.selected {
    background: #667eea;
    border-color: #667eea;
}

.motchill-emoji {
    font-size: 24px;
    display: block;
    margin-bottom: 5px;
}

.motchill-emoji-label {
    font-size: 12px;
    color: #fff;
}

.motchill-rating-submit {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.motchill-rating-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.motchill-rating-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.7;
}

.motchill-rating-close:hover {
    opacity: 1;
}

/* CSS-only Tab Switching (replaces JavaScript) */
.motchill-tab-radio {
    display: none;
}

.motchill-tab-content {
    display: none;
}

.motchill-tab-radio:checked + .motchill-tab-content {
    display: block;
}

.motchill-tab-btn {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.motchill-tab-btn:hover {
    background: rgba(102, 126, 234, 0.14);
    border-color: rgba(102, 126, 234, 0.4);
    color: #fff;
}

.motchill-tab-radio:checked + .motchill-tab-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-color: transparent;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Video Player Responsive */
.motchill-video-container video {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
}

/* Smart Rating System Styles */
.add-review-prompt {
    color: #ffd700;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s;
}

.add-review-prompt:hover {
    color: #ffed4e;
}

.no-rating-text {
    color: #888;
    font-style: italic;
    margin-top: 10px;
}

.rating-source-label {
    font-size: 0.85em;
    color: #999;
    margin-left: 5px;
}

/* Rating Modal Styles - ThungPhim Style */
.motchill-rating-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.motchill-rating-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
}

.motchill-rating-modal-content {
    position: relative;
    background: #2a2a3e;
    border-radius: 16px;
    padding: 0;
    max-width: 545px !important;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.motchill-rating-header {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    padding: 20px;
    text-align: center;
    color: #fff;
}

.motchill-rating-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.motchill-rating-body {
    padding: 30px;
}

.motchill-rating-emoji-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.motchill-rating-emoji-item {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 20px 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.motchill-rating-emoji-item:hover {
    background: rgba(255, 107, 53, 0.1);
    border-color: rgba(255, 107, 53, 0.3);
}

.motchill-rating-emoji-item.selected {
    background: rgba(255, 107, 53, 0.2);
    border-color: #ff6b35;
}

.motchill-rating-emoji {
    font-size: 28px;
    display: block;
    margin-bottom: 8px;
}

.motchill-rating-emoji-label {
    font-size: 12px;
    color: #ccc;
    font-weight: 500;
}

.motchill-rating-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.motchill-rating-submit {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: #fff;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.motchill-rating-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 53, 0.4);
}

.motchill-rating-cancel {
    background: rgba(255, 255, 255, 0.1);
    color: #ccc;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.motchill-rating-cancel:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.motchill-rating-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.7;
}

.motchill-rating-close:hover {
    opacity: 1;
}

/* Responsive Rating Modal */
@media (max-width: 480px) {
    .motchill-rating-modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .motchill-rating-body {
        padding: 20px;
    }
    
    .motchill-rating-emoji-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    
    .motchill-rating-emoji-item {
        padding: 15px 10px;
    }
    
    .motchill-rating-emoji {
        font-size: 24px;
    }
    
    .motchill-rating-buttons {
        flex-direction: column;
    }
}
