@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Color Palette */
    --primary-hue: 260;
    --primary-sat: 85%;
    --primary-light: 60%;
    
    --bg-dark: hsl(220, 20%, 8%);
    --bg-darker: hsl(220, 20%, 5%);
    --bg-card: hsl(220, 18%, 12%);
    --bg-card-hover: hsl(220, 18%, 15%);
    
    --primary: hsl(var(--primary-hue), var(--primary-sat), var(--primary-light));
    --primary-dark: hsl(var(--primary-hue), var(--primary-sat), 50%);
    --primary-light: hsl(var(--primary-hue), var(--primary-sat), 70%);
    
    --accent: hsl(180, 80%, 55%);
    --accent-dark: hsl(180, 80%, 45%);
    
    --text-primary: hsl(0, 0%, 95%);
    --text-secondary: hsl(0, 0%, 70%);
    --text-muted: hsl(0, 0%, 50%);
    
    --border: hsl(220, 15%, 20%);
    --border-light: hsl(220, 15%, 25%);
    
    --success: hsl(140, 70%, 50%);
    --warning: hsl(40, 90%, 60%);
    --danger: hsl(0, 70%, 60%);
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(var(--primary-hue), var(--primary-sat), var(--primary-light), 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-dark) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--spacing-lg);
}

/* Header */
header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
    padding: var(--spacing-lg);
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
    position: relative;
    z-index: 1;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    position: relative;
    z-index: 1;
}

/* Sections */
section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

section:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-lg);
}

section h2 {
    font-size: 1.5rem;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.05) 0%, rgba(0, 206, 209, 0.05) 100%);
}

.upload-zone:hover {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.1) 0%, rgba(0, 206, 209, 0.1) 100%);
    transform: translateY(-2px);
}

.upload-zone.drag-over {
    border-color: var(--accent);
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.15) 0%, rgba(0, 206, 209, 0.15) 100%);
    transform: scale(1.02);
}

.upload-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--spacing-md);
    color: var(--primary);
    stroke-width: 1.5;
}

.upload-content h2 {
    font-size: 1.3rem;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

.upload-content p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Video Library */
.video-library {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--spacing-md);
    min-height: 150px;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-muted);
}

.library-item {
    background: var(--bg-darker);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: grab;
    transition: all 0.3s ease;
    border: 2px solid var(--border);
    position: relative;
}

.library-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.library-item:active {
    cursor: grabbing;
}

.library-item video {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.library-item-info {
    padding: var(--spacing-sm);
}

.library-item-name {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.library-item-duration {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.library-item-remove {
    position: absolute;
    top: var(--spacing-xs);
    right: var(--spacing-xs);
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: var(--danger);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.library-item:hover .library-item-remove {
    opacity: 1;
}

.library-item-remove:hover {
    background: var(--danger);
    color: white;
}

/* Timeline */
.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.timeline-controls {
    display: flex;
    gap: var(--spacing-sm);
}

.timeline-container {
    background: var(--bg-darker);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    min-height: 180px;
    border: 2px dashed var(--border);
    position: relative;
}

.timeline {
    display: flex;
    gap: var(--spacing-sm);
    overflow-x: auto;
    padding: var(--spacing-sm);
    min-height: 140px;
    align-items: center;
}

.timeline::-webkit-scrollbar {
    height: 8px;
}

.timeline::-webkit-scrollbar-track {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
}

.timeline::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: var(--radius-sm);
}

.timeline-empty {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-muted);
    pointer-events: none;
}

.timeline-clip {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm);
    min-width: 150px;
    cursor: grab;
    transition: all 0.3s ease;
    border: 2px solid var(--primary-light);
    position: relative;
    flex-shrink: 0;
}

.timeline-clip:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.timeline-clip:active {
    cursor: grabbing;
}

.timeline-clip.dragging {
    opacity: 0.5;
}

.timeline-clip-preview {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-xs);
}

.timeline-clip-info {
    font-size: 0.85rem;
}

.timeline-clip-name {
    font-weight: 500;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeline-clip-duration {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.8rem;
}

.timeline-clip-actions {
    display: flex;
    gap: var(--spacing-xs);
    margin-top: var(--spacing-xs);
}

.clip-btn {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s ease;
    flex: 1;
}

.clip-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.timeline-info {
    margin-top: var(--spacing-md);
    text-align: center;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Preview */
.preview-container {
    position: relative;
    background: var(--bg-darker);
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 16 / 9;
}

#previewVideo {
    width: 100%;
    height: 100%;
    display: none;
}

#previewVideo.active {
    display: block;
}

.preview-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.preview-placeholder svg {
    width: 80px;
    height: 80px;
    margin-bottom: var(--spacing-md);
    stroke-width: 1.5;
}

.preview-placeholder.hidden {
    display: none;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-family: inherit;
}

.btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--bg-darker);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
}

/* Export Section */
.export-section {
    text-align: center;
}

.export-progress {
    margin-top: var(--spacing-md);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-darker);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: var(--spacing-sm);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
    width: 0%;
    transition: width 0.3s ease;
}

#exportStatus {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1.3rem;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--bg-darker);
}

.modal-body {
    padding: var(--spacing-lg);
}

#modalVideo {
    width: 100%;
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
}

.trim-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.trim-input-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.trim-input-group label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.trim-input-group input {
    padding: 0.75rem;
    background: var(--bg-darker);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
}

.trim-input-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.modal-actions {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: flex-end;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: var(--spacing-sm);
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .video-library {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .trim-controls {
        grid-template-columns: 1fr;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.library-item,
.timeline-clip {
    animation: fadeIn 0.3s ease;
}
