* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    color: #e2e8f0;
    font-family: 'Vazirmatn', 'Noto Sans Arabic', Arial, sans-serif;
    padding: 10px;
    padding-top: 50px;
    padding-bottom: 20px;
    min-height: 100vh;
    direction: ltr;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* دکمه بازگشت */
.back-button-container {
    position: fixed;
    top: 10px;
    left: 10px;
    right: 10px;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.95);
    padding: 10px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(234, 179, 8, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.btn-secondary {
    background: linear-gradient(145deg, #1e293b, #334155);
    border: 1px solid rgba(234, 179, 8, 0.4);
    color: #f8fafc;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.btn-secondary:hover {
    background: linear-gradient(145deg, #334155, #475569);
    border-color: #eab308;
    color: #eab308;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(234, 179, 8, 0.3);
}

.main-content {
    margin-top: 80px;
}

/* Movie info */
.movie-info {
    background: linear-gradient(145deg, #1e293b, #334155);
    color: #f8fafc;
    padding: 24px;
    text-align: center;
    border-radius: 14px;
    margin-bottom: 25px;
    border: 1px solid rgba(234, 179, 8, 0.3);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
    font-family: 'Vazirmatn', sans-serif;
}

/* Layout container */
.video-transcript-container {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    margin-bottom: 25px;
}

.video-section {
    flex: 1;
    min-width: 0;
}

.transcript-section {
    flex: 0 0 350px;
    background: linear-gradient(145deg, #0f172a, #1e293b);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 400px;
    border: 1px solid rgba(234, 179, 8, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

/* Video player */
.custom-video-player {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(234, 179, 8, 0.2);
}

.video-element {
    width: 100%;
    height: auto;
    display: block;
    background: #000;
}

/* Loading overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #f8fafc;
    z-index: 10;
    font-family: 'Vazirmatn', sans-serif;
    text-align: center;
}

.spinner {
    border: 4px solid rgba(234, 179, 8, 0.3);
    border-top: 4px solid #eab308;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Video controls */
.video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.95));
    padding: 26px 20px 20px;
    transition: all 0.3s ease;
    z-index: 5;
    user-select: none;
}

.video-controls.hidden {
    opacity: 0;
    transform: translateY(10px);
}

/* Progress bar */
.progress-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    cursor: pointer;
    margin-bottom: 14px;
    overflow: hidden;
    position: relative;
}

.progress-container:hover {
    height: 8px;
    transition: height 0.2s ease;
}

.progress-filled {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, #eab308, #d97706);
    border-radius: 3px;
    box-shadow: 0 0 10px rgba(234, 179, 8, 0.5);
    transition: width 0.15s ease;
}

.progress-buffer {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    width: 0;
    transition: width 0.2s ease;
}

/* Controls layout */
.controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.controls-left,
.controls-center,
.controls-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.controls-center {
    flex: 1;
    justify-content: center;
}

/* Button styles */
.control-btn {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(234, 179, 8, 0.3);
    color: #eab308;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.control-btn:hover {
    background: rgba(234, 179, 8, 0.2);
    border-color: #eab308;
    color: #fbbf24;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(234, 179, 8, 0.4);
}

/* Volume controls */
.volume-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(15, 23, 42, 0.8);
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid rgba(234, 179, 8, 0.2);
}

.volume-slider {
    width: 80px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #eab308;
    border: 2px solid #000;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 6px rgba(234, 179, 8, 0.6);
}

/* Subtitle toggle */
.subtitle-toggle {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(234, 179, 8, 0.2);
    color: #94a3b8;
    padding: 8px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    text-align: center;
    min-width: 60px;
}

.subtitle-toggle.active {
    background: linear-gradient(145deg, #eab308, #d97706);
    color: #f8fafc;
    border-color: #eab308;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(234, 179, 8, 0.4);
}

.subtitle-toggle:hover {
    background: rgba(234, 179, 8, 0.3);
    color: #eab308;
}

/* Speed selector */
.speed-selector {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(234, 179, 8, 0.2);
    color: #eab308;
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    min-width: 60px;
    text-align: center;
}

/* Time display */
.time-display {
    color: #eab308;
    font-size: 14px;
    font-family: 'Courier New', monospace;
    min-width: 110px;
    text-align: center;
    background: rgba(15, 23, 42, 0.8);
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid rgba(234, 179, 8, 0.2);
}

/* Subtitle overlay */
.subtitle-overlay {
    position: absolute;
    bottom: 85px;
    left: 20px;
    right: 20px;
    z-index: 4;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.subtitle-box {
    padding: 12px 16px;
    border-radius: 8px;
    text-align: center;
    max-width: 90%;
    word-wrap: break-word;
    font-family: 'Vazirmatn', sans-serif;
    font-weight: 600;
    line-height: 1.4;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
}

#englishSubtitle {
    background: rgba(15, 23, 42, 0.95);
    color: #f8fafc;
    font-size: 18px;
    border: 1px solid rgba(234, 179, 8, 0.3);
    direction: ltr;
}

#persianSubtitle {
    background: rgba(55, 65, 81, 0.95);
    color: #fbbf24;
    font-size: 20px;
    border: 1px solid rgba(251, 191, 36, 0.4);
    direction: rtl;
    font-family: 'Vazirmatn', 'Noto Sans Arabic', sans-serif;
}

/* Transcript section */
.transcript-header {
    background: linear-gradient(145deg, #1e293b, #334155);
    color: #eab308;
    padding: 16px;
    text-align: center;
    font-weight: bold;
    border-bottom: 2px solid #eab308;
    font-size: 16px;
}

.transcript-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    height: calc(100vh - 300px);
    max-height: 600px;
    min-height: 400px;
    background: linear-gradient(to bottom, #0f172a, #1e293b);
    direction: ltr;
    scrollbar-width: thin;
    scrollbar-color: #eab308 #1e293b;
    user-select: text;
}

.transcript-content::-webkit-scrollbar {
    width: 6px;
}

.transcript-content::-webkit-scrollbar-track {
    background: #1e293b;
}

.transcript-content::-webkit-scrollbar-thumb {
    background: #eab308;
    border-radius: 3px;
}

.transcript-item {
    margin-bottom: 16px;
    padding: 14px;
    border-radius: 10px;
    background: linear-gradient(145deg, #1e293b, #334155);
    border: 1px solid rgba(234, 179, 8, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.transcript-item:hover {
    background: linear-gradient(145deg, #334155, #475569);
    border-color: rgba(234, 179, 8, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(234, 179, 8, 0.2);
}

.transcript-item.current {
    background: linear-gradient(145deg, #eab308, #d97706);
    border-color: #eab308;
    color: #f8fafc;
    font-weight: 600;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(234, 179, 8, 0.5);
}

.transcript-item.current .transcript-text {
    color: #f8fafc;
}

.transcript-item.current .transcript-text.persian-text {
    color: #fde047;
}

.transcript-time {
    display: block;
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 8px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

.transcript-text {
    font-size: 16px;
    line-height: 1.7;
    color: #e2e8f0;
    text-align: left;
    font-family: 'Vazirmatn', sans-serif;
}

.transcript-text.english-text {
    direction: ltr;
    font-family: Arial, sans-serif;
    font-size: 15px;
    margin-bottom: 8px; /* For bilingual-item */
}

.transcript-text.persian-text {
    direction: rtl;
    text-align: right;
    font-family: 'Vazirmatn', 'Noto Sans Arabic', sans-serif;
    font-size: 17px;
    font-weight: 500;
    color: #fbbf24;
}

/* Word selection styles */
.transcript-word {
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 3px;
    padding: 1px 2px;
    user-select: text;
}

.transcript-word:hover {
    background-color: rgba(234, 179, 8, 0.2);
    text-decoration: underline;
    color: #fbbf24;
}

/* Modal styles */
#translationModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

#modalContent {
    background: linear-gradient(145deg, #1e293b, #334155);
    padding: 24px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 80%;
    overflow-y: auto;
    border: 1px solid rgba(234, 179, 8, 0.3);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8);
    color: #e2e8f0;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid rgba(234, 179, 8, 0.3);
    padding-bottom: 12px;
}

.modal-header h3 {
    color: #f8fafc;
    font-size: 20px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #94a3b8;
    padding: 5px;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.def-source {
    margin-bottom: 16px;
    padding: 12px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.7);
    border-left: 4px solid;
}

.def-source.db { border-left-color: #10b981; }
.def-source.movie { border-left-color: #f59e0b; }
.def-source.main { border-left-color: #8b5cf6; }
.def-source.api { border-left-color: #eab308; }
.def-source.example { border-left-color: #06b6d4; }

.def-source strong {
    color: #f8fafc;
    display: block;
    margin-bottom: 8px;
}

.def-source p {
    color: #e2e8f0;
    line-height: 1.6;
    margin: 0;
}

.flashcard-btn {
    background: linear-gradient(145deg, #eab308, #d97706);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.flashcard-btn:hover {
    background: linear-gradient(145deg, #d97706, #b45309);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(234, 179, 8, 0.4);
}

.flashcard-btn:disabled {
    background: linear-gradient(145deg, #10b981, #059669);
    cursor: not-allowed;
    transform: none;
}

.modal-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(234, 179, 8, 0.2);
    text-align: center;
}

.info-text {
    color: #94a3b8;
    font-style: italic;
    font-size: 14px;
}

/* Mobile Portrait & General Mobile Styles */
@media (max-width: 768px) {
    body {
        padding: 5px;
        padding-top: 60px;
        padding-bottom: 20px;
    }

    .main-content {
        margin-top: 70px;
    }

    .back-button-container {
        top: 5px;
        left: 5px;
        right: 5px;
        padding: 8px;
    }

    .btn-secondary {
        padding: 10px 16px;
        font-size: 12px;
    }

    .video-transcript-container {
        flex-direction: column;
        gap: 15px;
    }

    .transcript-section {
        width: 100%;
        height: 50vh;
        min-height: 300px;
    }

    .transcript-content {
        height: 100%;
        max-height: none;
        padding: 12px;
    }

    .subtitle-overlay {
        bottom: 70px;
        left: 10px;
        right: 10px;
        gap: 6px;
    }

    #englishSubtitle {
        font-size: 14px;
        padding: 8px 12px;
    }

    #persianSubtitle {
        font-size: 16px;
        padding: 8px 12px;
    }

    .video-controls {
        padding: 10px 8px;
    }

    .progress-container {
        height: 5px;
        margin-bottom: 8px;
    }

    .controls-row {
        gap: 4px;
        justify-content: space-between;
        flex-wrap: nowrap;
        align-items: center;
    }
    
    .controls-left,
    .controls-center,
    .controls-right {
        gap: 4px;
        flex-shrink: 0;
        display: flex;
        align-items: center;
    }
    
    .controls-center {
        flex: 0 0 auto;
    }
    
    .controls-left,
    .controls-right {
        flex: 1 1 auto;
    }

    .control-btn {
        min-width: 32px;
        min-height: 32px;
        max-width: 32px;
        max-height: 32px;
        padding: 6px;
        font-size: 12px;
        flex-shrink: 0;
    }

    .time-display {
        padding: 4px 6px;
        font-size: 10px;
        min-width: 70px;
        max-width: 70px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }
    
    .speed-selector {
        padding: 4px 6px;
        font-size: 10px;
        min-width: 42px;
        max-width: 42px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }
    
    .subtitle-toggle {
        padding: 4px 6px;
        font-size: 10px;
        min-width: 38px;
        max-width: 38px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .transcript-item {
        padding: 10px;
        margin-bottom: 10px;
    }
    
    .transcript-text { 
        font-size: 14px; 
    }
    
    .transcript-text.persian-text { 
        font-size: 16px; 
    }

    /* Hide less-used controls on mobile to save space */
    .volume-container,
    .control-btn[onclick="rewind()"],
    .control-btn[onclick="forward()"] {
        display: none !important;
    }
}

/* Very Small Mobile Screens */
@media (max-width: 480px) {
    body {
        padding-top: 55px;
    }

    .main-content {
        margin-top: 65px;
    }

    #englishSubtitle { 
        font-size: 11px; 
        padding: 5px 8px; 
    }
    
    #persianSubtitle { 
        font-size: 13px; 
        padding: 5px 8px; 
    }

    .video-controls {
        padding: 8px 6px;
    }

    .controls-row {
        gap: 3px;
    }
    
    .controls-left,
    .controls-center,
    .controls-right {
        gap: 3px;
    }

    .control-btn {
        min-width: 28px;
        min-height: 28px;
        max-width: 28px;
        max-height: 28px;
        padding: 5px;
        font-size: 11px;
    }

    .time-display {
        font-size: 9px;
        padding: 3px 5px;
        min-width: 65px;
        max-width: 65px;
        height: 28px;
    }
    
    .speed-selector {
        font-size: 9px;
        padding: 3px 5px;
        min-width: 38px;
        max-width: 38px;
        height: 28px;
    }
    
    .subtitle-toggle {
        font-size: 9px;
        padding: 3px 5px;
        min-width: 34px;
        max-width: 34px;
        height: 28px;
    }
}

/* Mobile Landscape Orientation */
@media (max-width: 900px) and (orientation: landscape) {
    .video-controls {
        padding: 6px 8px;
    }
    
    .progress-container {
        margin-bottom: 6px;
        height: 4px;
    }
    
    .controls-row {
        flex-wrap: nowrap;
        justify-content: space-between;
        gap: 4px;
        align-items: center;
    }
    
    .controls-left, 
    .controls-center, 
    .controls-right {
        gap: 4px;
        flex-shrink: 0;
        display: flex;
        align-items: center;
    }
    
    .controls-center {
        flex-grow: 0;
        flex: 0 0 auto;
    }
    
    .controls-left,
    .controls-right {
        flex: 1 1 auto;
    }
    
    .control-btn {
        min-width: 34px;
        min-height: 34px;
        max-width: 34px;
        max-height: 34px;
        padding: 7px;
        font-size: 12px;
        flex-shrink: 0;
    }
    
    .time-display {
        padding: 4px 7px;
        font-size: 10px;
        min-width: 75px;
        max-width: 75px;
        height: 34px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }
    
    .speed-selector {
        padding: 4px 7px;
        font-size: 10px;
        min-width: 44px;
        max-width: 44px;
        height: 34px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }
    
    .subtitle-toggle { 
        padding: 4px 7px;
        font-size: 10px;
        min-width: 40px;
        max-width: 40px;
        height: 34px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }
    
    .subtitle-overlay { 
        bottom: 50px; 
    }

    /* Hide volume slider in landscape to prevent overflow */
    .volume-container {
        display: none !important;
    }
}

/* Fullscreen Landscape Mobile - NEW STYLES */
@media (max-width: 900px) and (orientation: landscape) {
    .custom-video-player:fullscreen .video-controls,
    .custom-video-player:-webkit-full-screen .video-controls {
        padding: 10px 20px !important;
        background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.7) 70%, transparent 100%) !important;
    }
    
    .custom-video-player:fullscreen .progress-container,
    .custom-video-player:-webkit-full-screen .progress-container {
        height: 5px !important;
        margin-bottom: 10px !important;
    }
    
    .custom-video-player:fullscreen .controls-row,
    .custom-video-player:-webkit-full-screen .controls-row {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        gap: 15px !important;
        flex-wrap: nowrap !important;
    }
    
    /* Left Side - Play controls and time */
    .custom-video-player:fullscreen .controls-left,
    .custom-video-player:-webkit-full-screen .controls-left {
        display: flex !important;
        gap: 10px !important;
        align-items: center !important;
        justify-content: flex-start !important;
        flex: 0 0 auto !important;
    }
    
    /* Center - Speed and Subtitle controls */
    .custom-video-player:fullscreen .controls-center,
    .custom-video-player:-webkit-full-screen .controls-center {
        display: flex !important;
        gap: 10px !important;
        align-items: center !important;
        justify-content: center !important;
        flex: 1 1 auto !important;
    }
    
    /* Right Side - Volume and Fullscreen */
    .custom-video-player:fullscreen .controls-right,
    .custom-video-player:-webkit-full-screen .controls-right {
        display: flex !important;
        gap: 10px !important;
        align-items: center !important;
        justify-content: flex-end !important;
        flex: 0 0 auto !important;
    }
    
    .custom-video-player:fullscreen .control-btn,
    .custom-video-player:-webkit-full-screen .control-btn {
        min-width: 40px !important;
        max-width: 40px !important;
        min-height: 40px !important;
        max-height: 40px !important;
        padding: 9px !important;
        font-size: 15px !important;
        background: rgba(255,255,255,0.15) !important;
        border-radius: 50% !important;
        flex-shrink: 0 !important;
    }
    
    .custom-video-player:fullscreen .control-btn:active,
    .custom-video-player:-webkit-full-screen .control-btn:active {
        background: rgba(255,255,255,0.25) !important;
        transform: scale(0.95);
    }
    
    .custom-video-player:fullscreen .time-display,
    .custom-video-player:-webkit-full-screen .time-display {
        min-width: 90px !important;
        max-width: 90px !important;
        height: 40px !important;
        font-size: 13px !important;
        font-weight: 600 !important;
        background: rgba(255,255,255,0.1) !important;
        border-radius: 8px !important;
        padding: 5px 10px !important;
        flex-shrink: 0 !important;
    }
    
    .custom-video-player:fullscreen .speed-selector,
    .custom-video-player:-webkit-full-screen .speed-selector {
        display: flex !important;
        min-width: 50px !important;
        max-width: 50px !important;
        height: 40px !important;
        font-size: 13px !important;
        font-weight: 600 !important;
        background: rgba(255,255,255,0.1) !important;
        border-radius: 8px !important;
        padding: 5px 10px !important;
        flex-shrink: 0 !important;
    }
    
    .custom-video-player:fullscreen .subtitle-toggle,
    .custom-video-player:-webkit-full-screen .subtitle-toggle {
        min-width: 46px !important;
        max-width: 46px !important;
        height: 40px !important;
        font-size: 13px !important;
        font-weight: 600 !important;
        background: rgba(255,255,255,0.1) !important;
        border-radius: 8px !important;
        padding: 5px 10px !important;
        flex-shrink: 0 !important;
    }
    
    /* HIDE volume control in fullscreen landscape mobile */
    .custom-video-player:fullscreen .volume-container,
    .custom-video-player:-webkit-full-screen .volume-container {
        display: none !important;
    }
    
    .custom-video-player:fullscreen .subtitle-overlay,
    .custom-video-player:-webkit-full-screen .subtitle-overlay {
        bottom: 80px !important;
    }
}

/* Tablet Landscape - Extra Rules */
@media (min-width: 769px) and (max-width: 1024px) and (orientation: landscape) {
    .controls-row {
        gap: 5px;
    }
    
    .controls-left,
    .controls-center,
    .controls-right {
        gap: 5px;
    }
    
    .control-btn {
        min-width: 36px;
        min-height: 36px;
        max-width: 36px;
        max-height: 36px;
    }
    
    .time-display {
        min-width: 80px;
        max-width: 80px;
        height: 36px;
    }
    
    .speed-selector {
        min-width: 46px;
        max-width: 46px;
        height: 36px;
    }
    
    .subtitle-toggle {
        min-width: 42px;
        max-width: 42px;
        height: 36px;
    }
}

/* Fullscreen Styles (must be last to override) */
.custom-video-player:fullscreen,
.custom-video-player:-webkit-full-screen {
    background-color: #000 !important;
    width: 100% !important;
    height: 100% !important;
    display: flex;
    justify-content: center;
    align-items: center;
}

.custom-video-player:fullscreen .video-element,
.custom-video-player:-webkit-full-screen .video-element {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Fullscreen Controls - Mobile */
.custom-video-player:fullscreen .video-controls,
.custom-video-player:-webkit-full-screen .video-controls {
    padding: 8px 10px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.custom-video-player:fullscreen .controls-row,
.custom-video-player:-webkit-full-screen .controls-row {
    gap: 5px !important;
    flex-wrap: nowrap !important;
    justify-content: space-between !important;
    align-items: center !important;
}

.custom-video-player:fullscreen .controls-left,
.custom-video-player:fullscreen .controls-center,
.custom-video-player:fullscreen .controls-right,
.custom-video-player:-webkit-full-screen .controls-left,
.custom-video-player:-webkit-full-screen .controls-center,
.custom-video-player:-webkit-full-screen .controls-right {
    gap: 5px !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
}

.custom-video-player:fullscreen .controls-center,
.custom-video-player:-webkit-full-screen .controls-center {
    flex: 0 0 auto !important;
}

.custom-video-player:fullscreen .control-btn,
.custom-video-player:-webkit-full-screen .control-btn {
    min-width: 38px !important;
    min-height: 38px !important;
    max-width: 38px !important;
    max-height: 38px !important;
    padding: 8px !important;
    font-size: 14px !important;
    flex-shrink: 0 !important;
}

.custom-video-player:fullscreen .time-display,
.custom-video-player:-webkit-full-screen .time-display {
    padding: 5px 8px !important;
    font-size: 12px !important;
    min-width: 85px !important;
    max-width: 85px !important;
    height: 38px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}

.custom-video-player:fullscreen .speed-selector,
.custom-video-player:-webkit-full-screen .speed-selector {
    padding: 5px 8px !important;
    font-size: 12px !important;
    min-width: 48px !important;
    max-width: 48px !important;
    height: 38px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}

.custom-video-player:fullscreen .subtitle-toggle,
.custom-video-player:-webkit-full-screen .subtitle-toggle {
    padding: 5px 8px !important;
    font-size: 12px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    height: 38px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}

.custom-video-player:fullscreen .volume-container,
.custom-video-player:-webkit-full-screen .volume-container {
    max-width: 100px !important;
    flex-shrink: 1 !important;
}

/* Show hidden controls in fullscreen mode */
.custom-video-player:fullscreen .control-btn[onclick="rewind()"],
.custom-video-player:fullscreen .control-btn[onclick="forward()"],
.custom-video-player:fullscreen .volume-container,
.custom-video-player:-webkit-full-screen .control-btn[onclick="rewind()"],
.custom-video-player:-webkit-full-screen .control-btn[onclick="forward()"],
.custom-video-player:-webkit-full-screen .volume-container {
    display: flex !important;
}

/* Fullscreen Mobile Portrait */
@media (max-width: 768px) {
    .custom-video-player:fullscreen .video-controls,
    .custom-video-player:-webkit-full-screen .video-controls {
        padding: 12px 15px !important;
        background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.7) 70%, transparent 100%) !important;
    }
    
    .custom-video-player:fullscreen .progress-container,
    .custom-video-player:-webkit-full-screen .progress-container {
        height: 6px !important;
        margin-bottom: 12px !important;
    }
    
    .custom-video-player:fullscreen .controls-row,
    .custom-video-player:-webkit-full-screen .controls-row {
        gap: 8px !important;
    }
    
    .custom-video-player:fullscreen .controls-left,
    .custom-video-player:fullscreen .controls-center,
    .custom-video-player:fullscreen .controls-right,
    .custom-video-player:-webkit-full-screen .controls-left,
    .custom-video-player:-webkit-full-screen .controls-center,
    .custom-video-player:-webkit-full-screen .controls-right {
        gap: 8px !important;
    }
    
    .custom-video-player:fullscreen .control-btn,
    .custom-video-player:-webkit-full-screen .control-btn {
        min-width: 42px !important;
        max-width: 42px !important;
        min-height: 42px !important;
        max-height: 42px !important;
        padding: 10px !important;
        font-size: 16px !important;
        background: rgba(255,255,255,0.15) !important;
        border-radius: 50% !important;
    }
    
    .custom-video-player:fullscreen .control-btn:active,
    .custom-video-player:-webkit-full-screen .control-btn:active {
        background: rgba(255,255,255,0.25) !important;
        transform: scale(0.95);
    }
    
    .custom-video-player:fullscreen .time-display,
    .custom-video-player:-webkit-full-screen .time-display {
        min-width: 90px !important;
        max-width: 90px !important;
        height: 42px !important;
        font-size: 13px !important;
        font-weight: 600 !important;
        background: rgba(255,255,255,0.1) !important;
        border-radius: 8px !important;
    }
    
    .custom-video-player:fullscreen .subtitle-toggle,
    .custom-video-player:-webkit-full-screen .subtitle-toggle {
        min-width: 48px !important;
        max-width: 48px !important;
        height: 42px !important;
        font-size: 13px !important;
        font-weight: 600 !important;
        background: rgba(255,255,255,0.1) !important;
        border-radius: 8px !important;
    }
    
    /* Hide speed control and volume in fullscreen mobile */
    .custom-video-player:fullscreen .speed-selector,
    .custom-video-player:fullscreen .volume-container,
    .custom-video-player:-webkit-full-screen .speed-selector,
    .custom-video-player:-webkit-full-screen .volume-container {
        display: none !important;
    }
    
    /* Better subtitle positioning in fullscreen */
    .custom-video-player:fullscreen .subtitle-overlay,
    .custom-video-player:-webkit-full-screen .subtitle-overlay {
        bottom: 90px !important;
    }
}

/* Fullscreen Very Small Mobile */
@media (max-width: 480px) {
    .custom-video-player:fullscreen .video-controls,
    .custom-video-player:-webkit-full-screen .video-controls {
        padding: 10px 12px !important;
    }
    
    .custom-video-player:fullscreen .progress-container,
    .custom-video-player:-webkit-full-screen .progress-container {
        height: 5px !important;
        margin-bottom: 10px !important;
    }
    
    .custom-video-player:fullscreen .controls-row,
    .custom-video-player:-webkit-full-screen .controls-row {
        gap: 6px !important;
    }
    
    .custom-video-player:fullscreen .controls-left,
    .custom-video-player:fullscreen .controls-center,
    .custom-video-player:fullscreen .controls-right,
    .custom-video-player:-webkit-full-screen .controls-left,
    .custom-video-player:-webkit-full-screen .controls-center,
    .custom-video-player:-webkit-full-screen .controls-right {
        gap: 6px !important;
    }
    
    .custom-video-player:fullscreen .control-btn,
    .custom-video-player:-webkit-full-screen .control-btn {
        min-width: 38px !important;
        max-width: 38px !important;
        min-height: 38px !important;
        max-height: 38px !important;
        padding: 8px !important;
        font-size: 14px !important;
        background: rgba(255,255,255,0.15) !important;
        border-radius: 50% !important;
    }
    
    .custom-video-player:fullscreen .control-btn:active,
    .custom-video-player:-webkit-full-screen .control-btn:active {
        background: rgba(255,255,255,0.25) !important;
        transform: scale(0.95);
    }
    
    .custom-video-player:fullscreen .time-display,
    .custom-video-player:-webkit-full-screen .time-display {
        min-width: 80px !important;
        max-width: 80px !important;
        height: 38px !important;
        font-size: 12px !important;
        font-weight: 600 !important;
        background: rgba(255,255,255,0.1) !important;
        border-radius: 8px !important;
    }
    
    .custom-video-player:fullscreen .subtitle-toggle,
    .custom-video-player:-webkit-full-screen .subtitle-toggle {
        min-width: 44px !important;
        max-width: 44px !important;
        height: 38px !important;
        font-size: 12px !important;
        font-weight: 600 !important;
        background: rgba(255,255,255,0.1) !important;
        border-radius: 8px !important;
    }
    
    /* Hide speed control and volume in fullscreen mobile */
    .custom-video-player:fullscreen .speed-selector,
    .custom-video-player:fullscreen .volume-container,
    .custom-video-player:-webkit-full-screen .speed-selector,
    .custom-video-player:-webkit-full-screen .volume-container {
        display: none !important;
    }
    
    /* Better subtitle positioning in fullscreen */
    .custom-video-player:fullscreen .subtitle-overlay,
    .custom-video-player:-webkit-full-screen .subtitle-overlay {
        bottom: 80px !important;
    }
}