/* Advanced Custom Video Player Styles */

.custom-player {
    width: 100%;
    background: #0B0E14;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

/* Video wrapper */
.player-video-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
}

.player-video {
    width: 100%;
    height: 100%;
    display: block;
}

.player-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.player-video-wrapper:hover .player-overlay,
.player-video:paused + .player-overlay {
    opacity: 1;
    pointer-events: all;
}

.player-play-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(56, 189, 248, 0.9);
    border: none;
    color: #0B0E14;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(56, 189, 248, 0.4);
}

.player-play-btn:hover {
    background: rgba(56, 189, 248, 1);
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(56, 189, 248, 0.6);
}

.player-play-btn:active {
    transform: scale(0.95);
}

/* Controls */
.player-controls {
    background: linear-gradient(180deg, #0F172A 0%, #1E293B 100%);
    padding: 16px;
}

/* Timeline */
.player-timeline-wrapper {
    margin-bottom: 16px;
}

.player-timeline-track {
    position: relative;
    height: 8px;
    background: rgba(148, 163, 184, 0.2);
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 8px;
}

.player-timeline-track:hover {
    height: 12px;
    margin-top: -2px;
}

.player-timeline-buffered {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(148, 163, 184, 0.3);
    border-radius: 4px;
    pointer-events: none;
}

.player-timeline-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #38BDF8 0%, #22D3EE 100%);
    border-radius: 4px;
    pointer-events: none;
    transition: width 0.1s linear;
}

.player-timeline-handle {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    background: #F8FAFC;
    border: 3px solid #38BDF8;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(56, 189, 248, 0.4);
    cursor: grab;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.player-timeline-track:hover .player-timeline-handle {
    opacity: 1;
}

.player-timeline-handle:active {
    cursor: grabbing;
}

/* Markers */
.player-markers-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.player-marker {
    position: absolute;
    top: -4px;
    width: 2px;
    height: calc(100% + 8px);
    pointer-events: all;
    cursor: pointer;
}

.marker-line {
    width: 2px;
    height: 100%;
    background: #F97316;
    box-shadow: 0 0 4px rgba(249, 115, 22, 0.6);
}

.marker-handle {
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    background: #F97316;
    border: 2px solid #F8FAFC;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.marker-delete {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    background: rgba(239, 68, 68, 0.9);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.player-marker:hover .marker-delete {
    opacity: 1;
}

/* Segments */
.player-segments-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.player-segment {
    position: absolute;
    top: -2px;
    height: calc(100% + 4px);
    background: rgba(249, 115, 22, 0.4);
    border-left: 2px solid #F97316;
    border-right: 2px solid #F97316;
    box-shadow: 0 0 6px rgba(249, 115, 22, 0.5);
    pointer-events: all;
    cursor: pointer;
    transition: background 0.2s ease;
}

.player-segment:hover {
    background: rgba(249, 115, 22, 0.6);
}

.segment-delete {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    background: rgba(239, 68, 68, 0.9);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.player-segment:hover .segment-delete {
    opacity: 1;
}

/* Time labels */
.player-timeline-time-labels {
    position: relative;
    height: 16px;
}

.timeline-label {
    position: absolute;
    font-size: 11px;
    color: #94A3B8;
    transform: translateX(-50%);
}

/* Control bar */
.player-control-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
}

.player-control-left,
.player-control-right {
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    gap: 8px;
    flex: 1 1 0;
}

.player-control-left > *,
.player-control-right > * {
    flex: 1 1 0;
}

.player-control-left .player-time-display,
.player-control-right .player-volume-control,
.player-control-right .player-speed-control {
    flex-grow: 1.5;
}

/* Buttons */
.player-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    color: #F8FAFC;
    cursor: pointer;
    transition: all 0.2s ease;
}

.player-btn:hover {
    background: rgba(56, 189, 248, 0.2);
    border-color: #38BDF8;
    transform: translateY(-1px);
}

.player-btn:active {
    transform: translateY(0);
}

.player-btn svg {
    flex-shrink: 0;
}

.skip-label,
.btn-label,
.speed-label {
    font-size: 12px;
    font-weight: 600;
}

/* Time display */
.player-time-display {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 500;
    color: #F8FAFC;
    font-variant-numeric: tabular-nums;
    min-width: 120px;
}

.player-time-sep {
    color: #94A3B8;
}

/* Speed control */
.player-speed-control {
    position: relative;
}

.player-speed-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    background: #1E293B;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    z-index: 100;
}

.player-speed-menu button {
    display: block;
    width: 80px;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: #F8FAFC;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease;
}

.player-speed-menu button:hover {
    background: rgba(56, 189, 248, 0.2);
}

.player-speed-menu button.active {
    background: rgba(56, 189, 248, 0.3);
    color: #38BDF8;
    font-weight: 600;
}

/* Volume control */
.player-volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.player-volume-slider {
    width: 80px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(148, 163, 184, 0.2);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.player-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: #38BDF8;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.player-volume-slider::-webkit-slider-thumb:hover {
    background: #22D3EE;
    transform: scale(1.2);
}

.player-volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: #38BDF8;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.player-volume-slider::-moz-range-thumb:hover {
    background: #22D3EE;
    transform: scale(1.2);
}

/* Fullscreen mode */
.custom-player:fullscreen {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
}

.custom-player:fullscreen .player-video-wrapper {
    height: calc(100vh - 100px);
}

/* Responsive */
@media (max-width: 768px) {
    .player-controls {
        padding: 12px;
    }
    
    .player-control-bar {
        display: grid;
        grid-template-columns: 1fr;
        align-items: stretch;
        gap: 10px;
    }
    
    .player-control-left,
    .player-control-right {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(42px, 1fr));
        width: 100%;
        gap: 6px;
        align-items: center;
    }
    
    .player-control-left > *,
    .player-control-right > * {
        width: 100%;
        min-width: 0;
        flex: none;
    }

    .player-time-display {
        justify-content: center;
        min-width: 0;
        white-space: nowrap;
    }

    .player-volume-control {
        width: 100%;
        min-width: 0;
        order: initial;
        justify-content: center;
        gap: 4px;
    }

    .player-volume-slider {
        width: 100%;
        max-width: 56px;
    }
    
    .player-btn {
        min-width: 36px;
        height: 36px;
        padding: 0 8px;
    }
    
    .player-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .player-volume-slider {
        width: 60px;
    }
    
    .skip-label,
    .btn-label {
        display: none;
    }
    
    .player-volume-control {
        order: 10;
        width: 100%;
        justify-content: center;
    }
    
    .player-btn-fullscreen {
        order: 5;
    }
}
