/* Modal Player */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.95);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    width: 95%;
    height: 95%;
    position: relative;
}

/* Video Layout with Episode Panel */
.video-layout {
    display: flex;
    gap: 20px;
    height: 100%;
    width: 100%;
}

.video-container {
    flex: 1;
    height: 100%;
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

/* Episode Panel */
.episode-panel {
    width: 280px;
    background: #1a1a1a;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    border: 2px solid #333;
}

.episode-panel-title {
    font-size: 20px;
    font-weight: bold;
    color: #e50914;
    margin-bottom: 15px;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #333;
}

.episode-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scrollbar-width: thin;
    scrollbar-color: #e50914 #333;
}

.episode-list::-webkit-scrollbar {
    width: 8px;
}

.episode-list::-webkit-scrollbar-track {
    background: #333;
    border-radius: 4px;
}

.episode-list::-webkit-scrollbar-thumb {
    background: #e50914;
    border-radius: 4px;
}

.episode-item {
    background: #2a2a2a;
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 12px 16px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.episode-item:hover {
    background: #3a3a3a;
}

.episode-item:focus {
    background: #e50914;
    border-color: #fff;
    transform: scale(1.02);
    box-shadow: 0 0 15px rgba(229, 9, 20, 0.5);
}

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

.episode-item.active::before {
    content: '▶ ';
    font-size: 14px;
}

.episode-number {
    font-weight: bold;
    font-size: 16px;
    min-width: 50px;
}

.episode-name {
    font-size: 14px;
    color: #ccc;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.episode-item:focus .episode-name,
.episode-item.active .episode-name {
    color: #fff;
}

.episode-progress {
    font-size: 12px;
    color: #888;
    margin-left: auto;
}

.episode-item:focus .episode-progress,
.episode-item.active .episode-progress {
    color: #fff;
}

.modal-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: #e50914;
    color: #fff;
    border: none;
    padding: 12px 24px;
    font-size: 18px;
    border-radius: 4px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
}

.modal-close:focus {
    transform: scale(1.2);
    box-shadow: 0 0 0 5px #e50914, 0 0 25px rgba(229, 9, 20, 0.6);
    background: #e50914;
}

/* Custom Video Player for TV Box */
.video-container {
    width: 100%;
    height: 100%;
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

.video-player {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.video-player:focus {
    outline: none;
}

.video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, transparent 100%);
    padding: 30px;
    opacity: 1;
    transition: opacity 0.3s;
}

.control-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
}

.control-btn {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 2px solid transparent;
    padding: 12px 24px;
    font-size: 18px;
    border-radius: 8px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
    min-width: 100px;
}

.control-btn:focus {
    background: #e50914;
    border-color: #fff;
    transform: scale(1.15);
    box-shadow: 0 0 0 4px #fff, 0 0 20px rgba(255,255,255,0.5);
}

.time-display {
    font-size: 20px;
    color: #fff;
    font-weight: bold;
    min-width: 150px;
    text-align: center;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 15px;
}

.progress-bar {
    height: 100%;
    background: #e50914;
    border-radius: 4px;
    width: 0%;
    transition: width 0.1s linear;
}

.control-hint {
    font-size: 16px;
    color: rgba(255,255,255,0.7);
    text-align: center;
}

.volume-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 20px 40px;
    border-radius: 12px;
    font-size: 24px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 100;
}

.volume-indicator.show {
    opacity: 1;
}

/* Video Loading Indicator */
.video-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 50;
    color: #fff;
    font-size: 18px;
}

.video-loading .loading-spinner {
    width: 60px;
    height: 60px;
    border-width: 6px;
    margin-bottom: 15px;
}

/* Video Title Overlay */
.video-title-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 20px;
    font-weight: bold;
    z-index: 50;
    max-width: 70%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border-left: 4px solid #e50914;
}

/* Video Error Display */
.video-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #fff;
    z-index: 60;
    background: rgba(0, 0, 0, 0.9);
    padding: 40px;
    border-radius: 16px;
    border: 2px solid #e50914;
}

.error-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

.error-text {
    font-size: 22px;
    margin-bottom: 20px;
    color: #e50914;
}

.error-retry-btn {
    background: #e50914;
    color: #fff;
    border: none;
    padding: 15px 40px;
    font-size: 18px;
    border-radius: 8px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
}

.error-retry-btn:focus {
    transform: scale(1.1);
    box-shadow: 0 0 0 4px #fff, 0 0 20px rgba(255,255,255,0.5);
}

/* Toast Notification */
.toast-container {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: rgba(229, 9, 20, 0.95);
    color: #fff;
    padding: 16px 32px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    animation: toastSlideIn 0.3s ease-out, toastFadeOut 0.3s ease-out 2.7s;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast-icon {
    font-size: 24px;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastFadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* Episode Search */
.episode-search {
    margin-bottom: 15px;
}

.episode-search input {
    width: 100%;
    background: #2a2a2a;
    border: 2px solid #444;
    color: #fff;
    padding: 10px 14px;
    font-size: 14px;
    border-radius: 6px;
    outline: none;
    transition: all 0.2s;
}

.episode-search input:focus {
    border-color: #e50914;
    background: #333;
}

.episode-search input::placeholder {
    color: #888;
}

/* Resume notification */
.resume-notification {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(229, 9, 20, 0.95);
    color: #fff;
    padding: 20px 40px;
    border-radius: 12px;
    font-size: 22px;
    font-weight: bold;
    z-index: 200;
    animation: fadeInOut 5s ease-in-out;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.resume-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    10% { opacity: 1; transform: translateX(-50%) translateY(0); }
    90% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

/* Two-row control bar layout */
.control-bar-top {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.control-bar-top .time-display {
    font-size: 18px;
    font-weight: bold;
    padding: 8px 15px;
    background: rgba(0,0,0,0.5);
    border-radius: 6px;
    min-width: 140px;
    text-align: center;
}

/* Skip buttons */
.skip-btn {
    background: rgba(255,255,255,0.15) !important;
    padding: 8px 12px !important;
    font-size: 14px !important;
}

.skip-btn:hover {
    background: rgba(255,255,255,0.3) !important;
}

/* Speed button */
.speed-btn {
    background: #e50914 !important;
    font-weight: bold;
    min-width: 60px;
}

.speed-btn:hover {
    background: #ff1a25 !important;
}

/* Autoplay countdown */
.autoplay-countdown {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(229, 9, 20, 0.95);
    color: #fff;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.02); }
}

.autoplay-countdown button {
    background: #fff !important;
    color: #e50914 !important;
    padding: 8px 16px;
}
