/* ═══════════════════════════════════════════════════════════
   Editor de Vídeo — SVDown · dark studio (mesmo sistema do /video-gen)
   ═══════════════════════════════════════════════════════════ */

:root {
    --ev-bg: #070d18;
    --ev-bg-2: #0a1424;
    --ev-panel: rgba(255, 255, 255, 0.03);
    --ev-card: rgba(255, 255, 255, 0.04);
    --ev-card-alt: rgba(255, 255, 255, 0.07);
    --ev-border: rgba(148, 163, 184, 0.14);
    --ev-border-strong: rgba(87, 208, 255, 0.5);
    --ev-text: #edf4ff;
    --ev-text-soft: #a8b8cc;
    --ev-muted: #7186a0;
    --ev-accent: #57d0ff;
    --ev-accent-strong: #8fe0ff;
    --ev-accent-dim: rgba(87, 208, 255, 0.12);
    --ev-danger: #ff8080;
}

body {
    margin: 0;
    padding: 0;
    display: block;
    min-height: 100vh;
    background:
        radial-gradient(900px 480px at 75% -10%, rgba(87, 208, 255, 0.08), transparent 60%),
        linear-gradient(180deg, var(--ev-bg-2), var(--ev-bg) 35%);
    color: var(--ev-text);
    font-family: Inter, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }

[hidden] { display: none !important; }

/* Fontes de mídia cruas: mantidas totalmente fora da visualização */
#ev-video, #ev-track, .ev-hidden, video.ev-hidden, audio.ev-hidden {
    display: none !important;
    position: absolute !important;
    width: 0 !important;
    height: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

/* ── Header ─────────────────────────────────────────────── */
.ev-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(7, 13, 24, 0.82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--ev-border);
}

.ev-header-inner {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.ev-back {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--ev-text-soft);
    text-decoration: none;
    transition: color 0.15s;
}
.ev-back:hover { color: var(--ev-text); }

.ev-badge {
    background: var(--ev-accent-dim);
    border: 1px solid var(--ev-border-strong);
    color: var(--ev-accent-strong);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    padding: 0.28rem 0.6rem;
    border-radius: 6px;
}

/* ── Layout ─────────────────────────────────────────────── */
.ev-main {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 1.75rem 0 5rem;
}

.ev-head { margin-bottom: 1.5rem; }
.ev-head h1 {
    margin: 0;
    font-size: clamp(1.5rem, 2.6vw, 1.9rem);
    letter-spacing: -0.03em;
    font-weight: 800;
}
.ev-sub { color: var(--ev-text-soft); font-size: 0.92rem; margin: 0.4rem 0 0; }

/* ── Dropzone ───────────────────────────────────────────── */
.ev-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 4rem 1.5rem;
    border: 1.5px dashed rgba(148, 163, 184, 0.3);
    border-radius: 18px;
    background: var(--ev-panel);
    cursor: pointer;
    text-align: center;
    transition: border-color 0.15s, background 0.15s;
}
.ev-drop:hover { border-color: var(--ev-border-strong); background: var(--ev-accent-dim); }
.ev-drop-icon { font-size: 2.4rem; }
.ev-drop-title { font-weight: 800; font-size: 1.05rem; margin: 0; }
.ev-drop-sub { color: var(--ev-muted); font-size: 0.8rem; margin: 0; }

/* ── Grid do editor ─────────────────────────────────────── */
.ev-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 1.25rem;
    align-items: start;
}

.ev-stage-col { min-width: 0; }

.ev-stage-wrap {
    position: relative;
    background: #020617;
    border: 1px solid var(--ev-border);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 320px;
    max-height: 560px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.45);
}
.ev-canvas {
    max-width: 100%;
    max-height: 520px;
    width: auto;
    height: auto;
    display: block;
    border-radius: 6px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
}

.ev-play-btn {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    background: rgba(237, 244, 255, 0.92);
    color: #0a1424;
    font-size: 1.35rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.15s ease, background-color 0.15s ease;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    display: grid;
    place-items: center;
    z-index: 10;
}
.ev-stage-wrap.is-paused .ev-play-btn { opacity: 0.92; }
.ev-stage-wrap:hover .ev-play-btn { opacity: 1; }
.ev-play-btn:hover { transform: scale(1.08); background: #ffffff; }

/* ── Transporte / timeline ──────────────────────────────── */
.ev-transport {
    margin-top: 0.8rem;
    padding: 0.8rem 0.95rem;
    background: var(--ev-panel);
    border: 1px solid var(--ev-border);
    border-radius: 14px;
}

.ev-timeline-row { display: flex; align-items: center; gap: 0.55rem; }
.ev-timeline-row input[type="range"] { flex: 1; }

.ev-mini {
    border: 1px solid var(--ev-border);
    background: var(--ev-card);
    color: var(--ev-text);
    border-radius: 8px;
    font-size: 0.8rem;
    padding: 0.35rem 0.6rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.ev-mini:hover { background: var(--ev-card-alt); border-color: rgba(148, 163, 184, 0.3); }

.ev-time {
    font-size: 0.74rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--ev-muted);
    white-space: nowrap;
}

.ev-timeline-bar {
    position: relative;
    height: 6px;
    background: rgba(148, 163, 184, 0.12);
    border-radius: 3px;
    margin-top: 0.6rem;
    overflow: hidden;
}
.ev-timeline-bar > div { position: absolute; top: 0; bottom: 0; }
#ev-timeline-fill { background: var(--ev-accent); opacity: 0.45; }
#ev-timeline-cursor { width: 2px; background: var(--ev-accent-strong); }

/* ── Coluna de ferramentas ──────────────────────────────── */
.ev-tools-col {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: sticky;
    top: 76px;
}

.ev-tabs {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.25rem;
    padding: 0.25rem;
    background: var(--ev-panel);
    border: 1px solid var(--ev-border);
    border-radius: 12px;
}
.ev-tab {
    border: 1px solid transparent;
    background: transparent;
    color: var(--ev-muted);
    font-size: 0.76rem;
    font-weight: 700;
    padding: 0.5rem 0.25rem;
    border-radius: 9px;
    cursor: pointer;
    transition: all 0.15s;
}
.ev-tab:hover { color: var(--ev-text); }
.ev-tab.active {
    background: var(--ev-accent-dim);
    border-color: var(--ev-border-strong);
    color: var(--ev-accent-strong);
}

.ev-panel {
    padding: 1.1rem 1.15rem;
    border: 1px solid var(--ev-border);
    border-radius: 14px;
    background: var(--ev-panel);
}

.ev-label {
    display: block;
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ev-muted);
    margin: 0.85rem 0 0.35rem;
}
.ev-label:first-child { margin-top: 0; }
.ev-label span { color: var(--ev-accent-strong); text-transform: none; }

.ev-mono { font-family: 'JetBrains Mono', monospace; font-weight: 800; }
.ev-accent-text { color: var(--ev-accent-strong); }
.ev-meta { font-size: 0.78rem; color: var(--ev-muted); margin: 0.6rem 0 0; }

.ev-row { display: flex; flex-wrap: wrap; gap: 0.9rem; align-items: flex-start; }
.ev-fade { display: flex; flex-direction: column; gap: 0.3rem; }
.ev-check {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: var(--ev-text-soft);
    cursor: pointer;
}
.ev-check input { accent-color: var(--ev-accent); }

.ev-track-row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }

/* ── Controles ──────────────────────────────────────────── */
.ev-select, .ev-num, .ev-input {
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--ev-border);
    border-radius: 9px;
    font-size: 0.85rem;
    background: rgba(0, 0, 0, 0.25);
    color: var(--ev-text);
}
.ev-select:focus, .ev-num:focus, .ev-input:focus {
    outline: none;
    border-color: var(--ev-border-strong);
}
.ev-input { width: 100%; box-sizing: border-box; }
.ev-num { width: 84px; }
.ev-color {
    width: 56px;
    height: 36px;
    border: 1px solid var(--ev-border);
    border-radius: 9px;
    padding: 2px;
    background: rgba(0, 0, 0, 0.25);
    cursor: pointer;
}
.ev-mt { margin-top: 0.85rem; }

/* Range sliders */
.ev-main input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 22px;
    background: transparent;
    cursor: pointer;
}
.ev-main input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 3px;
    background: rgba(148, 163, 184, 0.18);
}
.ev-main input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    margin-top: -5px;
    border-radius: 50%;
    background: var(--ev-accent);
    border: 2px solid #0a1424;
    box-shadow: 0 0 10px rgba(87, 208, 255, 0.4);
}
.ev-main input[type="range"]::-moz-range-track {
    height: 6px;
    border-radius: 3px;
    background: rgba(148, 163, 184, 0.18);
}
.ev-main input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--ev-accent);
    border: 2px solid #0a1424;
}

/* ── Lista de textos ────────────────────────────────────── */
.ev-text-list { list-style: none; padding: 0; margin: 0.85rem 0 0; }
.ev-text-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--ev-border);
    border-radius: 9px;
    background: var(--ev-card);
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
}

/* ── Presets / aspectos ─────────────────────────────────── */
.ev-presets, .ev-aspects { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.5rem; }

.ev-preset {
    border: 1px solid var(--ev-border);
    background: var(--ev-card);
    color: var(--ev-text-soft);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.38rem 0.75rem;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.15s;
}
.ev-preset:hover { border-color: var(--ev-border-strong); color: var(--ev-accent-strong); }

.ev-aspect-btn {
    border: 1px solid var(--ev-border);
    background: var(--ev-card);
    color: var(--ev-text-soft);
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.42rem 0.85rem;
    border-radius: 9px;
    cursor: pointer;
    transition: all 0.15s;
}
.ev-aspect-btn:hover { border-color: rgba(148, 163, 184, 0.35); color: var(--ev-text); }
.ev-aspect-btn.active {
    border-color: var(--ev-border-strong);
    background: var(--ev-accent-dim);
    color: var(--ev-accent-strong);
}

/* ── Botões (escopo da página) ──────────────────────────── */
.ev-main .btn {
    padding: 0.62rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--ev-border);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    background: var(--ev-card);
    color: var(--ev-text);
    text-decoration: none;
    transition: all 0.15s;
}
.ev-main .btn:hover { background: var(--ev-card-alt); }
.ev-main .btn.primary {
    background: linear-gradient(180deg, #6fd8ff, #3ec2f7);
    color: #04283c;
    border: none;
    box-shadow: 0 6px 20px rgba(62, 194, 247, 0.22);
}
.ev-main .btn.primary:hover { filter: brightness(1.08); }
.ev-main .btn.secondary { background: var(--ev-card); }
.ev-main .btn.danger {
    background: rgba(255, 128, 128, 0.08);
    color: var(--ev-danger);
    border-color: rgba(255, 128, 128, 0.3);
}
.ev-main .btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Export ─────────────────────────────────────────────── */
.ev-export-row { display: flex; gap: 0.6rem; }
.ev-export-btn { flex: 1; padding: 0.85rem !important; font-size: 0.95rem !important; }

.ev-export-status {
    text-align: center;
    padding: 1.4rem 1rem;
    border: 1px solid var(--ev-border);
    border-radius: 14px;
    background: var(--ev-panel);
    color: var(--ev-text-soft);
    font-size: 0.88rem;
}
.ugi-spinner {
    width: 38px;
    height: 38px;
    margin: 0 auto 0.75rem;
    border-radius: 50%;
    border: 4px solid rgba(148, 163, 184, 0.15);
    border-top-color: var(--ev-accent);
    animation: evspin 0.9s linear infinite;
}
@keyframes evspin { to { transform: rotate(360deg); } }
.ev-progress-track {
    height: 7px;
    background: rgba(148, 163, 184, 0.12);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.75rem;
}
#ev-export-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--ev-accent), #a5ecff);
    width: 0%;
    transition: width 0.2s;
}

.ev-export-result {
    text-align: center;
    padding: 1.4rem 1rem;
    border: 1px solid rgba(94, 234, 164, 0.35);
    background: rgba(94, 234, 164, 0.07);
    border-radius: 14px;
}
.ev-done { font-weight: 800; color: #5eeaa4; margin: 0 0 0.85rem; }
.ev-result-actions { display: flex; gap: 0.55rem; justify-content: center; flex-wrap: wrap; }

/* ── Responsivo ─────────────────────────────────────────── */
@media (max-width: 980px) {
    .ev-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .ev-tools-col {
        position: static;
    }
    .ev-stage-wrap {
        min-height: 240px;
        max-height: 380px;
    }
    .ev-canvas {
        max-height: 360px;
    }
}

@media (max-width: 560px) {
    .ev-main {
        width: calc(100% - 20px);
        padding-top: 1rem;
        padding-bottom: 3rem;
    }
    .ev-head {
        margin-bottom: 0.85rem;
    }
    .ev-head h1 {
        font-size: 1.35rem;
    }
    .ev-sub {
        font-size: 0.8rem;
    }
    .ev-stage-wrap {
        min-height: 200px;
        max-height: 320px;
        border-radius: 14px;
    }
    .ev-canvas {
        max-height: 300px;
    }
    .ev-play-btn {
        width: 54px;
        height: 54px;
        font-size: 1.15rem;
    }
    .ev-transport {
        padding: 0.6rem 0.75rem;
        border-radius: 12px;
        margin-top: 0.6rem;
    }
    .ev-timeline-row {
        gap: 0.4rem;
    }
    .ev-mini {
        padding: 0.3rem 0.5rem;
        font-size: 0.75rem;
    }
    .ev-time {
        display: inline-block;
        font-size: 0.68rem;
    }
    .ev-tabs {
        gap: 0.2rem;
        padding: 0.2rem;
        border-radius: 10px;
    }
    .ev-tab {
        font-size: 0.72rem;
        padding: 0.45rem 0.15rem;
        border-radius: 8px;
    }
    .ev-panel {
        padding: 0.9rem 0.95rem;
        border-radius: 12px;
    }
    .ev-drop {
        padding: 2.5rem 1rem;
        border-radius: 14px;
    }
}
