:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg: #f8fafc;
    --sidebar-bg: #1e293b;
    --sidebar-text: #f1f5f9;
    --text: #334155;
    --border: #e2e8f0;
    --success: #10b981;
    --error: #ef4444;
}

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

body {
    font-family: system-ui, -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--text);
}

.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 2rem 0;
    flex-shrink: 0;
}

.sidebar h2 {
    padding: 0 1.5rem;
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
}

.nav-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    color: #cbd5e1;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.nav-btn:hover, .nav-btn.active {
    background-color: #334155;
    color: white;
    border-left: 4px solid var(--primary);
}

.content {
    flex-grow: 1;
    padding: 2rem;
    max-width: 1000px;
    margin: 0 auto;
}

.tool-section {
    display: none;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.tool-section.active {
    display: block;
}

.tool-section h2 {
    margin-bottom: 1.5rem;
    color: #0f172a;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group input[type="number"],
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 1rem;
}

.primary-btn, .secondary-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
    display: inline-block;
    text-decoration: none;
}

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

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

.secondary-btn {
    background-color: #e2e8f0;
    color: #475569;
}

.secondary-btn:hover {
    background-color: #cbd5e1;
}

.result-area {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: monospace;
    margin-bottom: 1rem;
    resize: vertical;
}

.preview-container {
    margin: 1.5rem 0;
    max-width: 100%;
    overflow: auto;
    border: 1px dashed var(--border);
    padding: 1rem;
    text-align: center;
}

canvas {
    max-width: 100%;
    height: auto;
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.progress-area {
    margin-top: 1.5rem;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: #e2e8f0;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #6366f1);
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 5px;
}

.status-text {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #64748b;
}

/* ─── FFmpeg / Library Notice ──────────────────────────────────── */
.ffmpeg-notice {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, #eff6ff, #f0fdf4);
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 0.875rem 1.25rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    color: #1e40af;
}

.notice-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* ─── File Drop Zone ───────────────────────────────────────────── */
.file-drop-zone {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    transition: all 0.2s;
    background: #fafbfc;
}

.file-drop-zone:hover,
.file-drop-zone.drag-over {
    border-color: var(--primary);
    background: #eff6ff;
}

.file-drop-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}

.file-drop-text {
    color: #94a3b8;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.file-info {
    color: var(--primary);
    font-weight: 500;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    min-height: 1.25rem;
}

/* ─── Download Button ──────────────────────────────────────────── */
.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 2rem;
    font-size: 1.05rem;
    background: linear-gradient(135deg, var(--primary), #6366f1);
    border-radius: 8px;
    color: white;
    text-decoration: none;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.download-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
}

/* ─── Document Preview ─────────────────────────────────────────── */
.doc-preview {
    margin-top: 1.5rem;
}

.doc-preview h4 {
    margin-bottom: 0.75rem;
    color: #0f172a;
}

/* ─── Slideshow Preview ────────────────────────────────────────── */
.slideshow-preview-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 8px;
}

.slideshow-preview-wrapper img {
    width: 100%;
    display: none;
}
.slideshow-preview-wrapper img.active {
    display: block;
}

/* ─── Responsive ───────────────────────────────────────────────── */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        padding: 1rem 0;
    }
    .sidebar h2 {
        padding: 0 1rem;
    }
    .nav-btn {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    .content {
        padding: 1rem;
    }
    .tool-section {
        padding: 1.25rem;
    }
    .controls-grid {
        grid-template-columns: 1fr;
    }
}
