/* Player Styles - For Cartoons video/audio player */

.video-player {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    min-width: 0;
    /* Prevent the container from forcing a width based on unshrunk children */
}

#videoPlayer {
    width: 100%;
    height: 100%;
    max-height: 500px;
    border-radius: 8px;
    background: #000;
    margin-bottom: 20px;
}

#audioPlayer {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 20px;
}

.video-wrapper {
    position: relative;
    width: 100%;
    max-height: 500px;
}

.audio-subtitle {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    font-size: 16px;
    text-align: center;
    background: rgba(0, 0, 0, 0.6);
    color: #ff8ba7;
    border-radius: 4px;
    display: none;
    z-index: 5;
    max-width: 90%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    z-index: 10;
}

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

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.video-info {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.video-info h2 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1.5rem;
}

.video-info p {
    line-height: 1.6;
}

.video-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
    flex-wrap: nowrap;
}

.subtitle-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    font-weight: 500;
    color: #495057;
    white-space: nowrap;
}

.subtitle-toggle:hover {
    border-color: #ff8ba7;
    background: #f8f9fa;
}

.subtitle-toggle.active {
    background: linear-gradient(135deg, #ff8ba7 0%, #ffb3c1 100%);
    color: white;
    border-color: #ff6b8a;
}

.subtitle-toggle .icon {
    font-weight: bold;
    font-size: 0.75rem;
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 4px;
    border-radius: 3px;
}

.subtitle-toggle.active .icon {
    background: rgba(255, 255, 255, 0.2);
}

.playmode-control {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.custom-select {
    position: relative;
    min-width: 120px;
}

.media-mode-control {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.media-mode-toggle {
    display: flex;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
}

.media-mode-toggle:hover {
    border-color: #ff8ba7;
}

.media-option {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    font-size: 0.85rem;
    color: #495057;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.media-option:hover {
    background: #f8f9fa;
    color: #ff8ba7;
}

.media-option.active {
    background: linear-gradient(135deg, #ff8ba7 0%, #ffb3c1 100%);
    color: white;
    color: white;
}

.media-option .icon {
    font-size: 0.9rem;
}

.media-option .text {
    font-weight: 500;
}

.select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    background: white;
    color: #333;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.select-trigger:hover {
    border-color: #ff8ba7;
}

.select-arrow {
    font-size: 0.7rem;
    transition: transform 0.2s ease;
    color: #666;
}

.custom-select.active .select-arrow {
    transform: rotate(180deg);
}

@media (hover: hover) {
    .custom-select:hover .select-arrow {
        transform: rotate(180deg);
    }
}

.select-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #ff8ba7;
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.custom-select.active .select-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

@media (hover: hover) {
    .custom-select:hover .select-options {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
}

.select-option {
    padding: 8px 10px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.select-option:last-child {
    border-bottom: none;
}

.select-option:hover {
    background: #f8f9fa;
    color: #ff8ba7;
}

.select-option.active {
    background: linear-gradient(135deg, #ff8ba7 0%, #ffb3c1 100%);
    color: white;
    font-weight: 500;
}

.autoplay-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.autoplay-control label {
    font-weight: 500;
    color: #495057;
    font-size: 0.9rem;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s ease;
}

.autoplay-control input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
    appearance: none;
    background: white;
    border: 2px solid #ced4da;
    border-radius: 4px;
    position: relative;
    transition: all 0.2s ease;
}

.autoplay-control input[type="checkbox"]:checked {
    background: linear-gradient(135deg, #ff8ba7 0%, #ffb3c1 100%);
    border-color: #ff6b8a;
}

.autoplay-control input[type="checkbox"]:checked::before {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.autoplay-control input[type="checkbox"]:hover {
    border-color: #007bff;
}

.autoplay-control input[type="checkbox"]:checked:hover {
    border-color: #ff6b8a;
}

.list-header {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.season-info {
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
}

.video-list {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.video-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow-y: auto;
    max-height: 500px;
    padding-right: 5px;
}

/* Scrollbar Styling */
.video-grid::-webkit-scrollbar {
    width: 6px;
}

.video-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.video-grid::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.video-grid::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.video-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 2px 8px;
    background: white;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #eee;
}

.video-index {
    font-size: 0.8rem;
    font-weight: 700;
    color: #ff8ba7;
    background: #fff0f3;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.video-item:hover {
    background: #f8f9fa;
    border-color: #ffccd5;
    transform: translateX(5px);
}

.video-item.active {
    background: linear-gradient(135deg, #ff8ba7 0%, #ffb3c1 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(255, 139, 167, 0.2);
}

.video-item.active .video-index {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

.video-item.unavailable {
    opacity: 0.6;
}

.video-details {
    flex: 1;
    min-width: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.video-title {
    font-weight: 500;
    font-size: 0.95rem;
    line-height: 1.4;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-status {
    font-size: 1.2rem;
    opacity: 0.6;
    margin-left: 10px;
}

.video-item.active .video-status {
    opacity: 1;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

.error {
    text-align: center;
    padding: 40px;
    color: #dc3545;
    background: #f8d7da;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
}

video::cue {
    color: white;
    background: rgba(0, 0, 0, 0.5);
}

/* Responsive Design */
@media (max-width: 968px) {
    .video-player {
        grid-template-columns: 1fr;
    }

    .video-list {
        order: 1;
    }
}

@media (max-width: 768px) {
    .video-grid {
        display: flex;
        flex-direction: column;
        gap: 0;
        padding-bottom: 80px;
    }

    .video-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .playmode-control,
    .media-mode-control {
        width: 100%;
        justify-content: space-between;
    }

    .media-mode-toggle,
    .custom-select {
        flex: 1;
    }

    .subtitle-toggle {
        width: 100%;
    }

    .media-option {
        flex: 1;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .video-player {
        padding: 20px;
        gap: 20px;
        min-width: 0;
    }

    .list-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}