/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Timeline Clip Styles */
.timeline-clip {
    position: absolute;
    height: 100%;
    top: 0;
    background-color: rgba(124, 155, 255, 0.2);
    border: 1px solid rgba(124, 155, 255, 0.5);
    border-radius: 4px;
    cursor: grab;
    overflow: hidden;
    user-select: none;
    display: flex;
    align-items: center;
    padding: 0 8px;
    transition: box-shadow 0.2s, border-color 0.2s;
    touch-action: none;
}

.timeline-clip:hover {
    border-color: #7c9bff;
    z-index: 10;
}

.timeline-clip.selected {
    border-color: #6ce0ff;
    box-shadow: 0 0 0 2px rgba(108, 224, 255, 0.2);
    z-index: 20;
}

.timeline-clip:active {
    cursor: grabbing;
}

.timeline-clip .clip-name {
    font-size: 10px;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

/* Audio Clip Specifics */
.timeline-clip.audio-clip {
    background-color: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.5);
}

.timeline-clip.audio-clip.selected {
    border-color: #34d399;
}

/* Text Clip Specifics */
.timeline-clip.text-clip {
    background-color: rgba(245, 158, 11, 0.2);
    border-color: rgba(245, 158, 11, 0.5);
}

.timeline-clip.text-clip.selected {
    border-color: #fbbf24;
}

/* Drag Handles */
.resize-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 6px;
    cursor: col-resize;
    z-index: 30;
    background: transparent;
}

.resize-handle:hover {
    background: rgba(255, 255, 255, 0.2);
}

.resize-handle.left {
    left: 0;
}

.resize-handle.right {
    right: 0;
}

/* Asset Card Styles */
.asset-card {
    position: relative;
    aspect-ratio: 16/9;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.asset-card:hover {
    border-color: rgba(124, 155, 255, 0.5);
    transform: translateY(-2px);
}

.asset-card img,
.asset-card video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.asset-card .duration {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.7);
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 10px;
    color: white;
}

.asset-card.loading::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Progress Bar Animation */
@keyframes progress {
    from {
        width: 0%;
    }

    to {
        width: 100%;
    }
}

/* Mobile-specific styles */
@media (max-width: 1024px) {
    /* Improve touch targets */
    .timeline-clip {
        min-height: 48px;
    }

    /* Better mobile scrolling */
    #timeline-scroll-area {
        -webkit-overflow-scrolling: touch;
    }

    /* Mobile panels */
    #mobile-assets-panel,
    #mobile-properties-panel {
        -webkit-tap-highlight-color: transparent;
    }

    /* Asset cards on mobile - always show add button */
    .asset-card {
        touch-action: manipulation;
    }

    .asset-card:active {
        transform: scale(0.95);
    }

    /* Always show the overlay and button on mobile */
    .asset-card > div {
        opacity: 1 !important;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    }

    .asset-card button {
        transform: scale(1) !important;
        position: absolute;
        bottom: 8px;
        right: 8px;
    }
}

/* Touch action for timeline */
#timeline-scroll-area {
    touch-action: pan-x pan-y;
}

#timeline-content {
    touch-action: none;
}

#time-ruler {
    touch-action: none;
}

/* Performance optimization - Enable GPU acceleration */
.timeline-clip,
#playhead {
    will-change: transform;
}

video {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Waveform canvas */
.waveform-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.6;
    mix-blend-mode: screen;
}