/* tools/video-trimmer-gif-exporter/style.css */

body {
    padding: 1rem;
}

.container {
    max-width: 900px;
}

/* ── Engine Loading Banner ──────────────────────────────────────────── */
.engine-banner {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    padding: 0.85rem 1.25rem;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.engine-banner.hidden { display: none; }

.engine-banner-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1d4ed8;
}

.engine-progress-bar {
    height: 5px;
    background: #dbeafe;
    border-radius: 3px;
    overflow: hidden;
}

.engine-progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
}

/* ── Workspace ──────────────────────────────────────────────────────── */
.workspace {
    display: none;
    flex-direction: column;
    gap: 1rem;
}
.workspace.visible { display: flex; }

/* ── Video Section ──────────────────────────────────────────────────── */
.video-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.video-meta {
    padding: 0.55rem 1rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 500;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.video-wrapper {
    background: #000;
    display: flex;
    justify-content: center;
}

#videoEl {
    max-height: 360px;
    max-width: 100%;
    display: block;
}

/* ── Timeline Section ───────────────────────────────────────────────── */
.timeline-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.section-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.6rem;
}

.timeline-canvas-wrapper {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

#timelineCanvas {
    display: block;
    width: 100%;
    height: 72px;
    cursor: col-resize;
    border-radius: 8px;
    background: #1e293b;
}

.trim-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.6rem;
    font-size: 0.875rem;
}

.trim-start { color: var(--primary); font-weight: 600; }
.trim-end { color: #7c3aed; font-weight: 600; }
.trim-duration { color: var(--text-light); font-size: 0.78rem; }

/* ── Export Section ─────────────────────────────────────────────────── */
.export-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.export-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.export-row > .row-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    min-width: 70px;
}

/* ── Format Picker ──────────────────────────────────────────────────── */
.format-picker {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.format-picker input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.format-picker label {
    padding: 7px 18px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    background: var(--surface);
    color: var(--text-light);
    transition: background 0.15s, color 0.15s;
    border-right: 1px solid var(--border);
    white-space: nowrap;
}

.format-picker label:last-of-type { border-right: none; }

.format-picker input[type="radio"]:checked + label {
    background: var(--primary);
    color: white;
}

/* ── Settings ───────────────────────────────────────────────────────── */
.setting-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.setting-group .setting-label {
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 600;
    white-space: nowrap;
}

.setting-group input[type="range"] {
    width: 90px;
    accent-color: var(--primary);
    cursor: pointer;
}

.setting-value {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text);
    min-width: 48px;
}

/* ── Process Row ────────────────────────────────────────────────────── */
.process-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.progress-container {
    flex: 1;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.progress-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    width: 0%;
    transition: width 0.25s ease;
}

.progress-fill.indeterminate {
    width: 40% !important;
    animation: progress-slide 1.4s ease-in-out infinite;
}

@keyframes progress-slide {
    0%   { transform: translateX(-250%); }
    100% { transform: translateX(350%); }
}

.progress-label {
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 500;
    min-height: 1.2em;
}

/* ── Download Section ───────────────────────────────────────────────── */
.download-section {
    display: none;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.download-section.visible { display: flex; }

.download-info {
    flex: 1;
    font-size: 0.875rem;
    color: #166534;
    font-weight: 500;
}

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .export-row { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .process-row { flex-direction: column; align-items: stretch; }
    .btn { justify-content: center; }
    .trim-labels { flex-direction: column; align-items: flex-start; gap: 0.2rem; }
    .download-section { flex-direction: column; align-items: stretch; }
    .download-section .btn { justify-content: center; }
}
