/* VIDEO PLAYER - Optimierte Implementierung */

/* ===== CSS VARIABLEN ===== */
:root {
    /* Farben */
    --video-primary: #6366f1;
    --video-white: #fff;
    
    /* Transparenzen */
    --video-glass-light: rgba(255, 255, 255, 0.1);
    --video-glass-strong: rgba(255, 255, 255, 0.3);
    
    /* Abstände */
    --video-spacing-xs: 4px;
    --video-spacing-sm: 8px;
    --video-spacing-md: 12px;
    --video-spacing-lg: 16px;
    --video-spacing-xl: 20px;
    
    /* Border Radius */
    --video-radius-sm: 2px;
    --video-radius-md: 8px;
    --video-radius-lg: 12px;
    --video-radius-round: 50%;
    
    /* Transitions */
    --video-transition-fast: 0.1s;
    --video-transition-normal: 0.2s;
    --video-transition-slow: 0.3s;
}

.video-panel {
    width: 100%;
    margin: var(--video-spacing-xl) auto;
    container-type: inline-size;
    container-name: video-panel;
}

/* ===== WRAPPER & VIDEO ELEMENT ===== */
.video-wrapper {
    position: relative;
    background: #000;
    border-radius: var(--video-radius-lg);
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.video-element {
    width: 100%;
    height: auto;
    aspect-ratio: 16/9;
    cursor: pointer;
    display: block;
}

/* ===== OVERLAY PLAY/PAUSE BUTTON ===== */
.overlay-play-btn {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    pointer-events: none;
    transition: opacity var(--video-transition-slow) ease;
    z-index: 15;
    cursor: pointer;
}

.overlay-play-btn.overlay-hidden {
    opacity: 0;
}

.overlay-play-btn:not(.playing) {
    opacity: 1;
}

.play-icon-wrapper {
    width: 70px;
    height: 70px;
    border-radius: var(--video-radius-round);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px black;
    border: 3px solid var(--video-glass-strong);
    transition: transform var(--video-transition-normal) ease;
    pointer-events: all;
    will-change: transform;
}

.play-icon-wrapper:hover {
    transform: scale(1.1);
}

.play-icon {
    width: 40px;
    height: 40px;
    color: var(--video-white);
    fill: currentColor;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

#center-icon-play {
    transform: translateX(4px);
}

/* ===== SKIP BUTTONS ===== */
.skip-btn {
    position: absolute;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.75);
    border: 2px solid var(--video-glass-strong);
    border-radius: var(--video-radius-lg);
    width: 100px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--video-spacing-sm);
    color: var(--video-white);
    cursor: pointer;
    transition: all var(--video-transition-slow) ease;
    opacity: 1;
    pointer-events: all;
    z-index: 15;
    will-change: transform, opacity;
}

.skip-btn.skip-hidden {
    opacity: 0;
    pointer-events: none;
}

.skip-btn:hover {
    background: rgba(99, 102, 241, 0.9);
    border-color: rgba(255, 255, 255, 0.5);
}

.skip-10 {
    top: 35%;
}

.skip-30 {
    top: 60%;
}

.skip-left, .skip-left-30 {
    left: 60px;
}

.skip-right, .skip-right-30 {
    right: 60px;
}


/* ===== CHAPTERS OVERLAY ===== */
.chapters-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--video-spacing-xl);
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.chapters-overlay-content {
    background: linear-gradient(145deg, rgba(40, 40, 50, 0.98), rgba(30, 30, 40, 0.98));
    border: 2px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--video-radius-lg);
    max-width: 600px;
    width: 100%;
    max-height: 80%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.chapters-overlay-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 15px;
    border-bottom: 2px solid rgba(99, 102, 241, 0.4);
    background: rgba(50, 50, 60, 0.5);
}

.chapters-overlay-header h3 {
    margin: 0;
    color: var(--video-white);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.chapters-close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--video-white);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--video-radius-md);
    transition: all var(--video-transition-normal);
}

.chapters-close-btn svg {
    width: 20px;
    height: 20px;
}

.chapters-close-btn:hover {
    background: rgba(239, 68, 68, 0.8);
    border-color: rgba(239, 68, 68, 1);
    transform: scale(1.1);
}

.chapters-overlay-list {
    overflow-y: auto;
    padding: var(--video-spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--video-spacing-sm);
}

.chapter-item {
    display: flex;
    align-items: center;
    gap: var(--video-spacing-md);
    padding: 5px 15px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.1));
    border: 2px solid rgba(99, 102, 241, 0.4);
    border-radius: var(--video-radius-md);
    color: var(--video-white);
    cursor: pointer;
    transition: all var(--video-transition-normal);
    text-align: left;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.chapter-item:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.4), rgba(139, 92, 246, 0.3));
    border-color: rgba(99, 102, 241, 0.8);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.5);
}

.chapter-time {
    color: #a5b4fc;
    min-width: 55px;
    font-size: 13px;
    background: rgba(99, 102, 241, 0.2);
    padding: 3px 6px;
    border-radius: 4px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.chapter-name {
    font-size: 14px;
    flex: 1;
    color: #f3f4f6;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* ===== CONTROLS BAR ===== */
.controls-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.6), transparent);
    padding: var(--video-spacing-lg);
    padding-top: 48px;
    transition: opacity var(--video-transition-slow);
    z-index: 20;
}

.controls-bar.controls-hidden {
    opacity: 0;
    pointer-events: none;
}

/* ===== PROGRESS BAR ===== */
.progress-container {
    position: relative;
    width: 100%;
    height: 4px;
    margin-bottom: var(--video-spacing-md);
}

.seek-slider {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
    width: 100%;
    height: 4px;
    margin: 0;
    padding: 0;
    opacity: 0;
    cursor: pointer;
    appearance: none;
    background: transparent;
}

.seek-slider::-webkit-slider-thumb {
    appearance: none;
    height: 12px;
    width: 12px;
    border-radius: var(--video-radius-round);
    background: var(--video-white);
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    transition: transform var(--video-transition-fast);
}

.seek-slider:hover::-webkit-slider-thumb {
    transform: scale(1.2);
}

.seek-slider::-moz-range-thumb {
    height: 12px;
    width: 12px;
    border-radius: var(--video-radius-round);
    background: var(--video-white);
    cursor: pointer;
    border: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    transition: transform var(--video-transition-fast);
}

.seek-slider:hover::-moz-range-thumb {
    transform: scale(1.2);
}

.progress-track {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--video-glass-strong);
    border-radius: var(--video-radius-sm);
    overflow: hidden;
    pointer-events: none;
}

.progress-fill {
    height: 100%;
    background: var(--video-primary);
    width: 0;
    transition: width var(--video-transition-fast) linear;
    will-change: width;
}

/* ===== CONTROL BUTTONS ===== */
.controls-buttons {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--video-white);
    user-select: none;
}

.controls-left,
.controls-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-btn {
    background: none;
    border: none;
    color: var(--video-white);
    cursor: pointer;
    padding: var(--video-spacing-xs);
    transition: color var(--video-transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover:not(:disabled) {
    color: #a5b4fc;
}

.control-btn:disabled {
    cursor: not-allowed;
}

.chapter-nav-btn {
    padding: var(--video-spacing-xs) var(--video-spacing-sm);
    background: var(--video-glass-light);
    border-radius: var(--video-radius-md);
}

.icon-size {
    width: var(--video-spacing-xl);
    height: var(--video-spacing-xl);
}

/* ===== CHAPTER TITLE BUTTON ===== */
.chapter-title-btn {
    cursor: pointer;
    max-width: 250px;
    background:none;
    border:none;
}

.chapter-title-text {
    color: #d1d5db;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== SPEED CONTROLS ===== */
.speed-controls {
    display: flex;
    align-items: center;
    gap: var(--video-spacing-sm);
    margin-right: var(--video-spacing-sm);
}

.speed-btn {
    background: transparent;
    border: none;
    padding: var(--video-spacing-xs) var(--video-spacing-xs);
    border-radius: 6px;
    color: #d1d5db;
    cursor: pointer;
    transition: all var(--video-transition-normal);
    min-width: 50px;
}

.speed-btn:hover {
    background: var(--video-glass-light);
}

.speed-btn.active {
    background: var(--video-primary);
    color: var(--video-white);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* ===== FULLSCREEN ===== */
.video-wrapper:fullscreen {
    max-width: 100vw;
    border-radius: 0;
}

.video-wrapper:fullscreen .video-element {
    height: 100vh;
    object-fit: contain;
}

/* Container Query überschreiben - Fullscreen immer große Buttons */
.video-wrapper:fullscreen .skip-btn {
    width: 120px !important;
    height: 70px !important;
}

.video-wrapper:fullscreen .skip-text {
    font-size: 16px;
}

/* Elemente die in der Container Query ausgeblendet wurden im Fullscreen wieder zeigen */
.video-wrapper:fullscreen .speed-controls {
    display: flex;
}

.video-wrapper:fullscreen .chapter-title-btn {
    display: flex;
}

.time-display {
    cursor: pointer;
    white-space: nowrap;
    color: #d1d5db;
}

/* ===== RESPONSIVE - MOBILE ===== */
@container video-panel (max-width: 600px) {
    /* Zeitanzeige anzeigen auf Mobile */
    .time-display {
        display: block;
    }

    /* Chapter Navigation Buttons anzeigen auf Mobile */
    .chapter-nav-btn {
        display: flex;
    }
    
    /* Chapter Title Button ausblenden auf Mobile */
    .chapter-title-btn {
        display: none;
    }
    
    /* Chapters Overlay */
    .chapters-overlay {
        padding: var(--video-spacing-md);
    }
    
    .chapters-overlay-content {
        max-height: 90%;
    }
    
    .chapters-overlay-header h3 {
        font-size: 13px;
    }
    
    .chapter-item {
        gap: var(--video-spacing-sm);
    }
    
    .chapter-time {
        font-size: 11px;
        min-width: 45px;
        padding: 2px 5px;
    }
    
    .chapter-name {
        font-size: 12px;
    }

    .speed-controls {
        display: none;
    }
    
    /* Control Gaps */
    .controls-left,
    .controls-right {
        gap: var(--video-spacing-sm);
    }
    
    
    /* Play Button */
    .play-icon-wrapper {
        width: 60px;
        height: 60px;
    }
    
    .play-icon {
        width: 30px;
        height: 30px;
    }
    
    /* Controls Bar */
    .controls-bar {
        padding: var(--video-spacing-md);
    }

    .skip-btn {
        width: 60px!important;
        height: 30px!important;
    }

    .skip-10 {
        top: 30%;
    }
    
    .skip-30 {
        top: 60%;
    }
    
    .overlay-play-btn {
        padding-bottom: 20px;
    }
}

/* Desktop - Chapter Title anzeigen */
@container video-panel (min-width: 601px) {
    .chapter-title-btn {
        display: flex;
    }
}