/* ============================================
   video.bd2051.ru - Video & Audio Editor
   Dark Theme (based on audio.bd2051.ru)
   ============================================ */

:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-tertiary: #0f3460;
    --bg-card: #1e2a4a;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0b0;
    --text-muted: #6c6c80;
    --accent: #e94560;
    --accent-hover: #ff6b81;
    --accent-secondary: #0f3460;
    --success: #4caf50;
    --warning: #ff9800;
    --error: #f44336;
    --border: #2a2a4a;
    --shadow: rgba(0, 0, 0, 0.3);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* Header */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header h1 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
}

.header h1 span {
    color: var(--accent);
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Sections */
.section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.section-title .badge {
    background: var(--accent);
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--bg-card);
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--accent);
    background: rgba(233, 69, 96, 0.05);
}

.upload-zone .icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.6;
}

.upload-zone p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.upload-zone .sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 8px;
}

/* File List */
.file-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.file-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    transition: all var(--transition);
}

.file-item:hover {
    border-color: var(--accent-secondary);
}

.file-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.file-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 300px;
}

.file-info {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.file-remove {
    background: none;
    border: none;
    color: var(--error);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all var(--transition);
}

.file-remove:hover {
    background: rgba(244, 67, 54, 0.1);
}

/* Trim Controls */
.trim-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 0;
}

.trim-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.trim-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    min-width: 40px;
}

.trim-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    outline: none;
}

.trim-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    transition: all var(--transition);
}

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

.trim-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
}

.trim-time {
    font-size: 0.8rem;
    color: var(--text-muted);
    min-width: 60px;
    text-align: right;
    font-family: 'Courier New', monospace;
}

/* Preview */
.preview-container {
    margin-top: 12px;
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
    max-height: 200px;
}

.preview-container video,
.preview-container audio {
    width: 100%;
    height: auto;
    max-height: 200px;
    display: block;
}

/* Timeline */
.timeline {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-top: 16px;
    min-height: 100px;
}

.timeline-track {
    position: relative;
    height: 60px;
    background: var(--bg-primary);
    border-radius: 4px;
    margin-bottom: 8px;
    overflow: hidden;
}

.timeline-track:last-child {
    margin-bottom: 0;
}

.timeline-block {
    position: absolute;
    height: 100%;
    background: rgba(233, 69, 96, 0.3);
    border: 2px solid var(--accent);
    border-radius: 4px;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: white;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 8px;
    min-width: 40px;
}

.timeline-block .handle {
    position: absolute;
    top: 0;
    width: 8px;
    height: 100%;
    background: var(--accent);
    cursor: ew-resize;
    z-index: 2;
}

.timeline-block .handle-left {
    left: 0;
    border-radius: 3px 0 0 3px;
}

.timeline-block .handle-right {
    right: 0;
    border-radius: 0 3px 3px 0;
}

.timeline-ruler {
    display: flex;
    height: 20px;
    margin-bottom: 8px;
    position: relative;
}

.timeline-ruler .tick {
    position: absolute;
    top: 0;
    width: 1px;
    height: 8px;
    background: var(--text-muted);
}

.timeline-ruler .tick-label {
    position: absolute;
    top: 10px;
    font-size: 0.65rem;
    color: var(--text-muted);
    transform: translateX(-50%);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(233, 69, 96, 0.3);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-card);
    border-color: var(--accent-secondary);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #45a049;
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover {
    background: #d32f2f;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

/* Progress */
.progress-container {
    display: none;
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.progress-container.active {
    display: block;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Status Messages */
.status {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-top: 12px;
    font-size: 0.9rem;
    display: none;
}

.status.active {
    display: block;
}

.status.success {
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid var(--success);
    color: var(--success);
}

.status.error {
    background: rgba(244, 67, 54, 0.1);
    border: 1px solid var(--error);
    color: var(--error);
}

.status.info {
    background: rgba(33, 150, 243, 0.1);
    border: 1px solid #2196f3;
    color: #2196f3;
}

/* Audio Section */
.audio-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.audio-waveform {
    height: 100px;
    background: var(--bg-primary);
    border-radius: var(--radius);
    margin-top: 8px;
    position: relative;
    overflow: hidden;
}

.audio-waveform canvas {
    width: 100%;
    height: 100%;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }
    
    .header h1 {
        font-size: 1.1rem;
    }
    
    .file-item-header {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .file-name {
        max-width: 180px;
    }
    
    .trim-row {
        flex-wrap: wrap;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

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

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

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Tooltip */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
    border: 1px solid var(--border);
}

.tooltip:hover::after {
    opacity: 1;
}

/* Grid layout for main content */
.editor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 1024px) {
    .editor-grid {
        grid-template-columns: 1fr;
    }
}

/* Output section */
.output-section {
    text-align: center;
}

.output-section .btn {
    margin: 8px;
}

/* Format selector */
.format-selector {
    display: flex;
    gap: 8px;
    margin: 12px 0;
    justify-content: center;
}

.format-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 0.85rem;
}

.format-btn:hover {
    border-color: var(--accent-secondary);
    color: var(--text-primary);
}

.format-btn.active {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(233, 69, 96, 0.1);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: 12px;
}
