/* ===========================================
   MontageFacile - Styles de la Timeline
   Gestion visuelle de la timeline de montage
   =========================================== */

/* -----------------------------------------
   Section Timeline (Zone 4)
   ----------------------------------------- */
.section-timeline {
    margin-top: var(--space-md);
}

.timeline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.timeline-stats {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.875rem;
    color: var(--text-secondary);
    padding: var(--space-xs) var(--space-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.timeline-stats .separator {
    color: var(--border-color);
}

#clips-count {
    font-weight: 700;
    color: var(--color-primary);
}

#total-duration {
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

/* -----------------------------------------
   Conteneur de la Timeline
   ----------------------------------------- */
.timeline-container {
    min-height: 140px;
    background: var(--bg-tertiary);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    transition: all var(--transition-normal);
}

.timeline-container.has-clips {
    border-style: solid;
    border-color: var(--border-color);
}

.timeline-container.drag-over {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

/* -----------------------------------------
   État vide de la Timeline
   ----------------------------------------- */
.timeline-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
    text-align: center;
    color: var(--text-muted);
}

.timeline-empty svg {
    opacity: 0.3;
    margin-bottom: var(--space-md);
}

.timeline-empty p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
}

.timeline-hint {
    font-size: 0.875rem !important;
    color: var(--text-muted) !important;
}

/* -----------------------------------------
   Liste des Clips
   ----------------------------------------- */
.timeline-clips {
    display: flex;
    gap: var(--space-sm);
    overflow-x: auto;
    padding: var(--space-xs);
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.timeline-clips::-webkit-scrollbar {
    height: 8px;
}

.timeline-clips::-webkit-scrollbar-track {
    background: transparent;
}

.timeline-clips::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.timeline-clips::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* -----------------------------------------
   Clip individuel
   ----------------------------------------- */
.timeline-clip {
    position: relative;
    flex-shrink: 0;
    width: 160px;
    height: 100px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: grab;
    transition: all var(--transition-fast);
    user-select: none;
}

.timeline-clip:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.timeline-clip.selected {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.timeline-clip.dragging {
    opacity: 0.5;
    cursor: grabbing;
    transform: scale(0.95);
}

.timeline-clip.drag-placeholder {
    border: 2px dashed var(--color-primary);
    background: var(--color-primary-light);
}

/* Miniature du clip */
.clip-thumbnail {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

/* Superposition d'informations du clip */
.clip-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: var(--space-sm);
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.4) 0%,
        transparent 30%,
        transparent 70%,
        rgba(0, 0, 0, 0.6) 100%
    );
    pointer-events: none;
}

/* Numéro du clip */
.clip-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--color-primary);
    color: var(--text-inverse);
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
}

/* Informations du clip */
.clip-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.clip-duration {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-inverse);
    background: rgba(0, 0, 0, 0.5);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

/* Bouton de suppression */
.clip-delete {
    position: absolute;
    top: var(--space-xs);
    right: var(--space-xs);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(239, 68, 68, 0.9);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-inverse);
    cursor: pointer;
    opacity: 0;
    transform: scale(0.8);
    transition: all var(--transition-fast);
    pointer-events: auto;
}

.timeline-clip:hover .clip-delete {
    opacity: 1;
    transform: scale(1);
}

.clip-delete:hover {
    background: var(--color-error);
    transform: scale(1.1);
}

/* Indicateur de position pendant le drag */
.drop-indicator {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--color-primary);
    border-radius: 2px;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 10;
}

.drop-indicator::before,
.drop-indicator::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
}

.drop-indicator::before {
    top: 0;
    border-top: 6px solid var(--color-primary);
}

.drop-indicator::after {
    bottom: 0;
    border-bottom: 6px solid var(--color-primary);
}

/* -----------------------------------------
   Barre de lecture de la Timeline
   ----------------------------------------- */
.timeline-playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--color-error);
    pointer-events: none;
    z-index: 5;
}

.timeline-playhead::before {
    content: '';
    position: absolute;
    top: -4px;
    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);
}

/* -----------------------------------------
   Section Export (Zone 5)
   ----------------------------------------- */
.section-export {
    display: flex;
    justify-content: center;
    margin-top: var(--space-md);
    padding: var(--space-lg);
}

.btn-export {
    padding: var(--space-md) var(--space-2xl);
    font-size: 1.125rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-primary), #8b5cf6);
    border: none;
    color: var(--text-inverse);
}

.btn-export:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.btn-export:disabled {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

/* -----------------------------------------
   Animation de génération de miniature
   ----------------------------------------- */
.clip-generating {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
}

.clip-generating::after {
    content: '';
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* -----------------------------------------
   Message de limite atteinte
   ----------------------------------------- */
.timeline-limit-warning {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: var(--color-warning-light);
    border: 1px solid var(--color-warning);
    border-radius: var(--radius-md);
    margin-top: var(--space-md);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.timeline-limit-warning svg {
    color: var(--color-warning);
    flex-shrink: 0;
}

/* -----------------------------------------
   Responsive
   ----------------------------------------- */
@media (max-width: 768px) {
    .timeline-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .timeline-stats {
        width: 100%;
        justify-content: center;
    }
    
    .timeline-clip {
        width: 120px;
        height: 75px;
    }
    
    .clip-number {
        width: 20px;
        height: 20px;
        font-size: 0.625rem;
    }
    
    .clip-duration {
        font-size: 0.625rem;
    }
    
    .btn-export {
        width: 100%;
        padding: var(--space-md) var(--space-lg);
    }
}

/* -----------------------------------------
   Animations spécifiques Timeline
   ----------------------------------------- */
@keyframes clipAdded {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.timeline-clip.just-added {
    animation: clipAdded 0.3s ease;
}

@keyframes clipRemoved {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(0.8);
        opacity: 0;
    }
}

.timeline-clip.removing {
    animation: clipRemoved 0.2s ease forwards;
}

/* Animation de réorganisation */
@keyframes reorder {
    0% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(-5px);
    }
    100% {
        transform: translateX(0);
    }
}

.timeline-clip.reordering {
    animation: reorder 0.2s ease;
}
