/* 
  EditCaT — Design System & Responsive Layout (Desktop & Mobile First)
*/

:root {
    --bg-base: #08090d;
    --bg-panel: #0e1118;
    --bg-card: #151a24;
    --bg-card-hover: #1c2331;
    --border-subtle: #232b3b;
    --border-focus: #3b82f6;

    --brand-cyan: #00e5ff;
    --brand-cyan-glow: rgba(0, 229, 255, 0.28);
    --brand-purple: #8b5cf6;
    --brand-yellow: #facc15;
    --brand-green: #10b981;
    --brand-danger: #ef4444;

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-full: 9999px;

    --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-heading: 'Space Grotesk', system-ui, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    overflow: hidden;
    line-height: 1.45;
}

/* Contenedor general */
.app-shell {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* -------------------------------------------------------------
   BARRA SUPERIOR (DESKTOP / MOBILE)
   ------------------------------------------------------------- */
.app-topbar {
    height: 54px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    gap: 12px;
    flex-shrink: 0;
    z-index: 50;
}

.brand-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--brand-cyan), var(--brand-purple));
    color: #040810;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 16px var(--brand-cyan-glow);
}

.brand-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-name {
    font-family: var(--font-heading);
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.3px;
    background: linear-gradient(135deg, #ffffff 40%, var(--brand-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-tag {
    font-size: 10px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: var(--radius-full);
    background: rgba(0, 229, 255, 0.12);
    border: 1px solid rgba(0, 229, 255, 0.35);
    color: var(--brand-cyan);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.brand-sub {
    font-size: 11px;
    color: var(--text-tertiary);
}

/* Telemetría */
.topbar-stats {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-pill {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 3px 9px;
    display: flex;
    flex-direction: column;
    min-width: 80px;
}

.stat-pill.accent-pill {
    border-color: rgba(0, 229, 255, 0.4);
    background: rgba(0, 229, 255, 0.06);
}

.stat-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
    font-weight: 600;
}

.stat-value {
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}

.topbar-actions {
    display: flex;
    align-items: center;
}

.btn-topbar-load {
    background: rgba(0, 229, 255, 0.12);
    border: 1px solid var(--brand-cyan);
    color: var(--brand-cyan);
    border-radius: var(--radius-sm);
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.18s ease;
}

.btn-topbar-load:hover {
    background: var(--brand-cyan);
    color: #040810;
}

/* Barra de pestañas móvil (oculta en desktop) */
.mobile-tabs-nav {
    display: none;
    height: 44px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-subtle);
    grid-template-columns: 1fr 1fr;
    flex-shrink: 0;
    z-index: 40;
}

.tab-btn {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tab-btn.active {
    color: var(--brand-cyan);
    border-bottom-color: var(--brand-cyan);
    background: rgba(0, 229, 255, 0.05);
}

/* -------------------------------------------------------------
   ÁREA DE TRABAJO PRINCIPAL (GRID 2 COLUMNAS)
   ------------------------------------------------------------- */
.app-workspace {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 395px 1fr;
    gap: 12px;
    padding: 10px 14px;
    overflow: hidden;
}

/* -------------------------------------------------------------
   PANEL LATERAL: CONTROLES Y PILA LIFO
   ------------------------------------------------------------- */
.sidebar-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.panel-section {
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 11px 13px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.workflow-card {
    flex-shrink: 0;
}

.action-buttons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.btn-action {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 12px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: left;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn-upload {
    background: linear-gradient(135deg, #0284c7, #00e5ff);
    color: #030812;
    box-shadow: 0 4px 14px rgba(0, 229, 255, 0.22);
}

.btn-upload:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 229, 255, 0.35);
}

.btn-translate {
    background: linear-gradient(135deg, #eab308, #f59e0b);
    color: #0f0b02;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.22);
}

.btn-translate:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(245, 158, 11, 0.35);
}

.btn-translate:disabled {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-tertiary);
    cursor: not-allowed;
    box-shadow: none;
}

.btn-icon-circle {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-translate:disabled .btn-icon-circle {
    background: rgba(255, 255, 255, 0.05);
}

.btn-text-block {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.btn-main-label {
    font-size: 12.5px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-sub-label {
    font-size: 10px;
    opacity: 0.85;
}

/* Metadata del video */
.video-meta-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 2px;
}

.status-indicator-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10.5px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    white-space: nowrap;
}

.status-indicator-badge.extracting {
    background: rgba(0, 229, 255, 0.12);
    border-color: rgba(0, 229, 255, 0.4);
    color: var(--brand-cyan);
}

.status-indicator-badge.ready {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.4);
    color: var(--brand-green);
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.meta-filename {
    font-size: 11.5px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: right;
    flex: 1;
}

.video-metrics-bar {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-secondary);
}

.dot-sep {
    color: var(--text-tertiary);
}

/* Tareas y barras de progreso */
.task-progress-box {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 3px;
}

.task-progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-secondary);
}

.pct-bold {
    font-weight: 700;
    color: var(--text-primary);
}

.task-progress-track {
    width: 100%;
    height: 6px;
    background: #06090e;
    border-radius: var(--radius-full);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
}

.task-progress-bar {
    height: 100%;
    transition: width 0.25s ease;
}

.fill-audio {
    background: linear-gradient(90deg, var(--brand-cyan), var(--brand-green));
}

.fill-ai {
    background: linear-gradient(90deg, var(--brand-yellow), #f97316);
}

.fill-export {
    background: linear-gradient(90deg, var(--brand-purple), var(--brand-cyan));
}

/* Reproductor compacto */
.audio-playback-preview {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.audio-playback-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10.5px;
    font-weight: 700;
    color: var(--brand-green);
    white-space: nowrap;
}

.audio-playback-preview audio {
    height: 22px;
    flex: 1;
    min-width: 0;
}

/* -------------------------------------------------------------
   SECCIÓN DE PILA DE SUBTÍTULOS (LIFO)
   ------------------------------------------------------------- */
.stack-editor-section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.stack-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.section-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.step-badge {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 229, 255, 0.15);
    border: 1px solid var(--brand-cyan);
    color: var(--brand-cyan);
    font-size: 11px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-title-wrap h2 {
    font-size: 13.5px;
    font-weight: 700;
}

.save-state-pill {
    font-size: 10.5px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-tertiary);
}

.save-state-pill.unsaved {
    background: rgba(245, 158, 11, 0.16);
    border-color: rgba(245, 158, 11, 0.5);
    color: var(--brand-yellow);
}

.save-state-pill.saved {
    background: rgba(16, 185, 129, 0.16);
    border-color: rgba(16, 185, 129, 0.4);
    color: var(--brand-green);
}

.section-hint {
    font-size: 11px;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

/* Lista scrollable de subtítulos */
.subtitles-scroll-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 4px;
}

.empty-state-message {
    text-align: center;
    padding: 24px 12px;
    border: 1px dashed var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 28px;
    margin-bottom: 6px;
}

.empty-state-message h3 {
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.empty-state-message p {
    font-size: 11.5px;
    color: var(--text-tertiary);
}

.stack-item {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 7px 9px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.15s, background 0.15s;
}

.stack-item:hover {
    background: var(--bg-card-hover);
    border-color: #3b4764;
}

.stack-item.active-frame {
    border-color: var(--brand-yellow);
    background: rgba(250, 204, 21, 0.08);
}

.stack-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10.5px;
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
}

.stack-badge-lifo {
    color: var(--brand-cyan);
    font-weight: 700;
}

.stack-frames-tag {
    background: #090d14;
    padding: 1px 6px;
    border-radius: 4px;
    color: #cbd5e1;
}

.stack-edit-row {
    display: flex;
    gap: 4px;
    align-items: center;
}

.stack-item-input {
    flex: 1;
    min-width: 0;
    background: #0a0d14;
    border: 1px solid #232b3c;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    padding: 5px 8px;
}

.stack-item-input:focus {
    outline: none;
    border-color: var(--brand-cyan);
}

.btn-mini-scale {
    background: #111624;
    border: 1px solid #28334b;
    color: #cbd5e1;
    border-radius: var(--radius-sm);
    padding: 4px 6px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
}

.btn-mini-scale:hover {
    border-color: var(--brand-cyan);
    color: var(--brand-cyan);
}

.btn-inline-save {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.45);
    color: #34d399;
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
}

.btn-inline-save:hover {
    background: var(--brand-green);
    color: #041008;
}

/* Pie Fijo de Acciones */
.sidebar-sticky-footer {
    flex-shrink: 0;
    padding-top: 8px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.footer-action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.btn-footer-save,
.btn-footer-export {
    border: none;
    border-radius: var(--radius-md);
    padding: 9px 12px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s ease;
}

.btn-footer-save {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    box-shadow: 0 3px 12px rgba(16, 185, 129, 0.25);
}

.btn-footer-save.has-unsaved {
    background: linear-gradient(135deg, #f59e0b, #ea580c);
    animation: pulse-border 1.5s infinite;
}

@keyframes pulse-border {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
}

.btn-footer-save:disabled,
.btn-footer-export:disabled {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-tertiary);
    cursor: not-allowed;
    box-shadow: none;
    animation: none;
}

.btn-footer-export {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: #ffffff;
    box-shadow: 0 3px 12px rgba(139, 92, 246, 0.25);
}

.btn-download-ready {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    background: rgba(16, 185, 129, 0.16);
    border: 1px solid var(--brand-green);
    color: #34d399;
    font-weight: 700;
    font-size: 12px;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    margin-top: 2px;
}

/* -------------------------------------------------------------
   PANEL DERECHO: VISTA PREVIA Y TIMELINE
   ------------------------------------------------------------- */
.stage-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.preview-container-card {
    flex: 1;
    min-height: 0;
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: hidden;
}

.preview-top-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.preview-mode-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 700;
}

.live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--brand-green);
    box-shadow: 0 0 8px var(--brand-green);
}

.preview-badges-cluster {
    display: flex;
    gap: 6px;
}

.badge-item {
    font-size: 10.5px;
    padding: 2px 7px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.sub-badge {
    background: rgba(250, 204, 21, 0.12);
    border: 1px solid rgba(250, 204, 21, 0.4);
    color: var(--brand-yellow);
}

.stack-badge {
    background: rgba(0, 229, 255, 0.1);
    border: 1px solid rgba(0, 229, 255, 0.3);
    color: var(--brand-cyan);
}

/* Escenario exterior */
.viewport-stage {
    flex: 1;
    min-height: 0;
    position: relative;
    background: #040508;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Placeholder inicial */
.viewport-placeholder {
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.placeholder-graphic {
    color: var(--brand-cyan);
    margin-bottom: 4px;
}

.viewport-placeholder h2 {
    font-size: 16px;
    color: var(--text-primary);
}

.viewport-placeholder p {
    font-size: 12px;
    color: var(--text-tertiary);
}

.btn-hero-load {
    margin-top: 6px;
    background: linear-gradient(135deg, #0284c7, #00e5ff);
    color: #030812;
    border: none;
    border-radius: var(--radius-md);
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 16px rgba(0, 229, 255, 0.25);
}

/* CONTENEDOR EXACTO DEL VIDEO SEGÚN SU RELACIÓN DE ASPECTO (9:16, 16:9, etc.) */
.video-viewport-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.85);
}

.video-native-element {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: fill;
}

/* SUBTÍTULOS ESTILO CANVA */
.subtitle-center-overlay {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 88%;
    max-width: 94%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    text-align: center;
    pointer-events: auto;
}

.subtitle-canva-box {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    padding: 3px;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    user-select: none;
}

.subtitle-canva-box:hover {
    border-color: rgba(0, 229, 255, 0.6);
}

.subtitle-canva-box.canva-selected {
    border-color: var(--brand-purple);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.35);
    cursor: move;
}

/* Tiradores de esquina y laterales */
.canva-handle {
    display: none;
    position: absolute;
    background: #ffffff;
    border: 2px solid var(--brand-purple);
    z-index: 30;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.subtitle-canva-box.canva-selected .canva-handle {
    display: block;
}

.handle-nw, .handle-ne, .handle-sw, .handle-se {
    width: 11px;
    height: 11px;
    border-radius: 50%;
}

.handle-nw { top: -6px; left: -6px; cursor: nwse-resize; }
.handle-ne { top: -6px; right: -6px; cursor: nesw-resize; }
.handle-sw { bottom: -6px; left: -6px; cursor: nesw-resize; }
.handle-se { bottom: -6px; right: -6px; cursor: nwse-resize; }

.handle-w, .handle-e {
    width: 6px;
    height: 20px;
    border-radius: 4px;
    top: 50%;
    transform: translateY(-50%);
    cursor: ew-resize;
}

.handle-w { left: -5px; }
.handle-e { right: -5px; }

.subtitle-center-box {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    column-gap: 0.32em;
    row-gap: 0.12em;
    padding: 0.35em 0.6em;
    border-radius: var(--radius-md);
    background: rgba(8, 10, 16, 0.65);
    backdrop-filter: blur(3px);
    font-family: 'Arial Black', 'Segoe UI Black', Impact, sans-serif;
    font-weight: 900;
    text-transform: uppercase;
    line-height: 1.15;
    letter-spacing: 0.3px;
    color: #ffffff;
    word-break: break-word;
    overflow-wrap: break-word;
    text-shadow:
        -1.5px -1.5px 0 #000,
         1.5px -1.5px 0 #000,
        -1.5px  1.5px 0 #000,
         1.5px  1.5px 0 #000,
         0px  3px 8px rgba(0, 0, 0, 0.85);
}

.capcut-word {
    display: inline-block;
    cursor: pointer;
    border-radius: 4px;
    padding: 0 2px;
    transition: transform 0.07s ease, color 0.07s ease, background 0.12s ease;
}

.capcut-word:hover {
    background: rgba(0, 229, 255, 0.25);
}

.capcut-word.active-word {
    color: var(--brand-yellow);
    transform: scale(1.08);
    text-shadow:
        -1.5px -1.5px 0 #000,
         1.5px -1.5px 0 #000,
        -1.5px  1.5px 0 #000,
         1.5px  1.5px 0 #000,
         0px  0px 12px rgba(250, 204, 21, 0.65);
}

/* Barra flotante estilo Canva */
.canva-floating-toolbar {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 94%;
    max-width: 360px;
    background: rgba(14, 17, 24, 0.96);
    border: 1px solid var(--brand-purple);
    border-radius: var(--radius-md);
    padding: 6px 8px;
    z-index: 40;
    display: flex;
    flex-direction: column;
    gap: 5px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8);
}

.canva-toolbar-primary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}

.canva-pill-btn {
    background: #19202f;
    border: 1px solid #334155;
    color: #f8fafc;
    border-radius: var(--radius-sm);
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.canva-pill-btn:hover {
    border-color: var(--brand-cyan);
    color: var(--brand-cyan);
}

.canva-accent-btn {
    background: rgba(139, 92, 246, 0.22);
    border-color: var(--brand-purple);
    color: #ddd6fe;
}

.canva-close-btn {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    font-size: 13px;
    cursor: pointer;
    padding: 0 4px;
}

.canva-scale-indicator {
    font-size: 11px;
    font-weight: 800;
    color: var(--brand-yellow);
    min-width: 38px;
    text-align: center;
}

.canva-toolbar-secondary {
    display: flex;
    gap: 5px;
}

.canva-quick-input {
    flex: 1;
    min-width: 0;
    background: #090c13;
    border: 1px solid #3b4764;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 11.5px;
    font-weight: 600;
    padding: 4px 7px;
}

.canva-quick-input:focus {
    outline: none;
    border-color: var(--brand-cyan);
}

.canva-quick-save {
    background: var(--brand-green);
    border: none;
    color: #04130c;
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

/* Controles de reproducción */
.playback-controls-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.btn-play-toggle {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-frame-step {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    padding: 6px 9px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

.btn-play-toggle:disabled,
.btn-frame-step:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-play-toggle:not(:disabled):hover,
.btn-frame-step:not(:disabled):hover {
    border-color: var(--brand-cyan);
    color: var(--brand-cyan);
}

.scrubber-track-wrap {
    flex: 1;
    display: flex;
    align-items: center;
}

.player-scrubber {
    width: 100%;
    accent-color: var(--brand-cyan);
    cursor: pointer;
}

.timecode-display {
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #cbd5e1;
    min-width: 135px;
    text-align: right;
}

.time-sep {
    color: var(--text-tertiary);
    margin: 0 2px;
}

/* -------------------------------------------------------------
   LÍNEA DE TIEMPO INFERIOR COMPACTA (125px)
   ------------------------------------------------------------- */
.timeline-visualizer-card {
    height: 120px;
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex-shrink: 0;
}

.timeline-meta-header {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.timeline-canvas-container {
    position: relative;
    flex: 1;
    min-height: 0;
    background: #090c13;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    padding: 2px 0;
    overflow: hidden;
    cursor: pointer;
}

.playhead-indicator {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--brand-yellow);
    z-index: 15;
    pointer-events: none;
    box-shadow: 0 0 8px var(--brand-yellow);
}

.timeline-track-row {
    display: flex;
    align-items: center;
    height: 36px;
    padding: 0 8px;
}

.track-info-tag {
    width: 82px;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.track-canvas-area {
    position: relative;
    flex: 1;
    height: 100%;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 4px;
    overflow: hidden;
}

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

.subtitles-track {
    position: relative;
}

.timeline-sub-block {
    position: absolute;
    top: 4px;
    bottom: 4px;
    background: rgba(250, 204, 21, 0.22);
    border: 1px solid rgba(250, 204, 21, 0.7);
    border-radius: 4px;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 4px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
}

.timeline-sub-block.active-block {
    background: rgba(0, 229, 255, 0.35);
    border-color: var(--brand-cyan);
}

.hidden {
    display: none !important;
}

/* -------------------------------------------------------------
   RESPONSIVE DESIGN (MODO MOBILE Y TABLET)
   ------------------------------------------------------------- */
@media (max-width: 900px) {
    .topbar-stats {
        display: none;
    }

    .brand-sub {
        display: none;
    }

    .mobile-tabs-nav {
        display: grid;
    }

    .app-workspace {
        grid-template-columns: 1fr;
        padding: 8px;
        gap: 8px;
    }

    /* En mobile, solo una pestaña visible a la vez */
    .sidebar-panel,
    .stage-panel {
        display: none;
        height: 100%;
    }

    .sidebar-panel.tab-active,
    .stage-panel.tab-active {
        display: flex;
    }

    .timeline-visualizer-card {
        height: 100px;
    }

    .timecode-display {
        font-size: 11px;
        min-width: 110px;
    }

    .btn-frame-step {
        display: none; /* Ocultar micro-pasos en pantallas angostas */
    }
}
