/* ===========================================
   MontageFacile - Styles des Contrôles
   Contrôles vidéo et outils de découpe
   =========================================== */

/* -----------------------------------------
   Contrôles vidéo personnalisés
   ----------------------------------------- */
.video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.video-container:hover .video-controls,
.video-controls:focus-within {
    opacity: 1;
}

/* Bouton lecture/pause */
#btn-play .icon-pause,
#btn-play.playing .icon-play {
    display: none;
}

#btn-play.playing .icon-pause {
    display: block;
}

/* Affichage du temps */
.time-display {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--text-inverse);
    min-width: 140px;
}

.time-separator {
    color: rgba(255, 255, 255, 0.5);
}

/* Barre de progression */
.seek-bar {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    cursor: pointer;
    transition: height var(--transition-fast);
}

.seek-bar:hover {
    height: 8px;
}

.seek-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--text-inverse);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: transform var(--transition-fast);
}

.seek-bar::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.seek-bar::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--text-inverse);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Bouton mute */
#btn-mute .icon-muted,
#btn-mute.muted .icon-volume {
    display: none;
}

#btn-mute.muted .icon-muted {
    display: block;
}

/* -----------------------------------------
   Outils de découpe (Zone 3)
   ----------------------------------------- */
.trim-tools {
    padding: var(--space-lg);
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

/* -----------------------------------------
   Timeline de découpe
   ----------------------------------------- */
.trim-range-container {
    margin-bottom: var(--space-lg);
}

.trim-timeline {
    position: relative;
    height: 60px;
    background: var(--bg-dark);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
}

/* Forme d'onde / représentation visuelle */
.trim-waveform {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    gap: 1px;
    padding: 0 8px;
}

.trim-waveform-bar {
    flex: 1;
    background: rgba(99, 102, 241, 0.4);
    border-radius: 1px;
    min-height: 4px;
    transition: height var(--transition-fast);
}

/* Zone de sélection */
.trim-selection {
    position: absolute;
    top: 0;
    bottom: 0;
    background: rgba(99, 102, 241, 0.3);
    border-left: 2px solid var(--color-primary);
    border-right: 2px solid var(--color-primary);
    pointer-events: none;
}

/* Poignées de découpe */
.trim-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 16px;
    background: var(--color-primary);
    cursor: ew-resize;
    z-index: 10;
    transition: background var(--transition-fast);
}

.trim-handle:hover {
    background: var(--color-primary-hover);
}

.trim-handle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 20px;
    background: repeating-linear-gradient(
        to bottom,
        var(--text-inverse) 0,
        var(--text-inverse) 2px,
        transparent 2px,
        transparent 4px
    );
    border-radius: 1px;
}

.trim-handle-start {
    left: 0;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.trim-handle-end {
    right: 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Tête de lecture */
.trim-playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--color-error);
    pointer-events: none;
    z-index: 5;
    transition: left 0.05s linear;
}

.trim-playhead::before {
    content: '';
    position: absolute;
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid var(--color-error);
}

/* -----------------------------------------
   Informations de découpe
   ----------------------------------------- */
.trim-info {
    display: flex;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.trim-time {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
}

.trim-time label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.time-value {
    font-family: var(--font-mono);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.time-value.highlight {
    color: var(--color-primary);
    background: var(--color-primary-light);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
}

/* -----------------------------------------
   Actions de découpe
   ----------------------------------------- */
.trim-actions {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.trim-actions .btn {
    flex: 1;
}

/* -----------------------------------------
   Raccourcis clavier
   ----------------------------------------- */
.trim-shortcuts {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-color);
}

.shortcut {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.shortcut kbd {
    font-size: 0.6875rem;
    min-width: 24px;
    height: 24px;
}

/* -----------------------------------------
   États interactifs des poignées
   ----------------------------------------- */
.trim-handle.active {
    background: var(--color-primary-hover);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.3);
}

.trim-timeline.dragging {
    cursor: ew-resize;
}

.trim-timeline.dragging .trim-handle {
    transition: none;
}

/* -----------------------------------------
   Marqueurs de temps sur la timeline
   ----------------------------------------- */
.trim-markers {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 16px;
    display: flex;
    justify-content: space-between;
    padding: 0 8px;
    background: rgba(0, 0, 0, 0.3);
}

.trim-marker {
    position: relative;
    font-family: var(--font-mono);
    font-size: 0.625rem;
    color: rgba(255, 255, 255, 0.6);
    padding-top: 2px;
}

.trim-marker::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
}

/* -----------------------------------------
   Prévisualisation de l'extrait
   ----------------------------------------- */
.preview-clip-indicator {
    position: absolute;
    top: var(--space-md);
    left: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-md);
    background: rgba(99, 102, 241, 0.9);
    color: var(--text-inverse);
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    z-index: 10;
}

.preview-clip-indicator svg {
    animation: pulse 1s ease infinite;
}

/* -----------------------------------------
   Responsive
   ----------------------------------------- */
@media (max-width: 768px) {
    .video-controls {
        gap: var(--space-sm);
        padding: var(--space-sm);
    }
    
    .time-display {
        font-size: 0.75rem;
        min-width: 100px;
    }
    
    .trim-info {
        flex-direction: column;
        gap: var(--space-sm);
    }
    
    .trim-time {
        flex-direction: row;
        justify-content: space-between;
        width: 100%;
    }
    
    .time-value {
        font-size: 1rem;
    }
    
    .trim-actions {
        flex-direction: column;
    }
    
    .trim-shortcuts {
        flex-direction: column;
        align-items: center;
        gap: var(--space-sm);
    }
    
    .trim-handle {
        width: 24px;
    }
}

/* -----------------------------------------
   Mode plein écran
   ----------------------------------------- */
.video-container:fullscreen {
    background: #000;
}

.video-container:fullscreen .video-controls {
    padding: var(--space-lg) var(--space-xl);
}

.video-container:fullscreen .preview-video {
    height: 100vh;
}

/* -----------------------------------------
   Animations spécifiques contrôles
   ----------------------------------------- */
@keyframes handlePulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(99, 102, 241, 0);
    }
}

.trim-handle.just-set {
    animation: handlePulse 0.5s ease;
}

/* Animation de la tête de lecture */
@keyframes playheadGlow {
    0%, 100% {
        box-shadow: 0 0 4px rgba(239, 68, 68, 0.5);
    }
    50% {
        box-shadow: 0 0 8px rgba(239, 68, 68, 0.8);
    }
}

.trim-playhead.playing {
    animation: playheadGlow 1s ease infinite;
}

/* -----------------------------------------
   Tooltip pour les contrôles
   ----------------------------------------- */
.control-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-dark);
    color: var(--text-inverse);
    font-size: 0.75rem;
    white-space: nowrap;
    border-radius: var(--radius-sm);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    pointer-events: none;
    margin-bottom: 4px;
}

.control-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: var(--bg-dark);
}

[data-tooltip]:hover .control-tooltip {
    opacity: 1;
    visibility: visible;
}

/* -----------------------------------------
   Indicateur de chargement vidéo
   ----------------------------------------- */
.video-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    z-index: 20;
}

.video-loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: var(--space-md);
}

.video-loading-text {
    color: var(--text-inverse);
    font-size: 0.875rem;
}
