:root {
    /* CapCut / Premiere Pro Dark Aesthetic */
    --bg-main: #0a0a0a;
    --bg-panel: #131313;
    --bg-header: #0e0e0e;
    --bg-hover: #1e1e1e;
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    
    --accent: #22d3ee;       /* Cyan */
    --accent-hover: #06b6d4;
    --accent-glow: rgba(34, 211, 238, 0.25);
    
    --danger: #ef4444;       /* Red for cuts */
    --danger-hover: #dc2626;
    
    --success: #10b981;
    
    --border: #262626;
    
    --radius-sm: 6px;
    --radius: 12px;
    --radius-lg: 16px;
    
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.4);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ─── TYPOGRAPHY & UTILS ─── */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }

/* ─── LAYOUT ─── */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* ─── HEADER ─── */
.navbar {
    height: 56px;
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 100;
}

.logo {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-main);
}
.logo i { color: var(--accent); font-size: 1.3rem; }

.nav-dashboard-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 1.05rem;
    font-weight: 600;
    transition: color 0.2s;
    margin-left: 20px;
}
.nav-dashboard-link:hover { color: var(--text-main); }

.user-menu-container {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
    margin-right: 20px;
}
.plan-badge {
    padding: 4px 12px; border-radius: 20px; font-size: 0.8rem; font-weight: 700; text-transform: uppercase;
    background: rgba(34,211,238,0.1); color: var(--accent); border: 1px solid rgba(34,211,238,0.3);
}
.user-usage { color: var(--text-muted); font-size: 0.95rem; font-variant-numeric: tabular-nums; font-weight: 500;}

/* Profile Dropdown from Index */
.profile-menu { position: relative; }
.profile-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    border: 2px solid rgba(34, 211, 238, 0.3);
    color: #000; font-weight: 700; font-size: 0.9rem;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.2s; font-family: inherit;
}
.profile-avatar:hover { transform: scale(1.05); box-shadow: 0 0 15px var(--accent-glow); }
.profile-dropdown {
    position: absolute; top: 45px; right: 0; min-width: 200px;
    background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 8px 0; box-shadow: var(--shadow-soft);
    opacity: 0; visibility: hidden; transform: translateY(-8px); transition: all 0.2s ease; z-index: 1000;
}
.profile-dropdown.show { opacity: 1; visibility: visible; transform: translateY(0); }
.profile-dropdown-header { padding: 10px 16px; font-size: 0.75rem; color: var(--text-muted); border-bottom: 1px solid var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-dropdown a { display: flex; align-items: center; gap: 8px; padding: 10px 16px; color: var(--text-main); text-decoration: none; font-size: 0.85rem; transition: background 0.15s; }
.profile-dropdown a:hover { background: var(--bg-hover); color: var(--accent); }
.profile-dropdown .logout-link { color: var(--danger); }
.profile-dropdown .logout-link:hover { background: rgba(239, 68, 68, 0.08); color: var(--danger); }
.profile-dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }


/* ─── WORKSPACE (3 Columns) ─── */
.workspace {
    display: grid;
    grid-template-columns: 1fr 340px 1fr;
    flex: 1;
    overflow: hidden;
    background: var(--bg-main);
}

.panel-left, .panel-right {
    display: flex;
    flex-direction: column;
    padding: 16px;
    background: var(--bg-main);
    overflow: hidden;
}

.panel-center {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg-panel);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    box-shadow: 0 0 30px rgba(0,0,0,0.5); /* depth */
    z-index: 10;
}

/* ─── BUTTONS ─── */
button { font-family: 'Inter', sans-serif; cursor: pointer; border: none; border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: all 0.2s ease; }
button:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background-color: var(--accent); color: #000; padding: 10px 16px; }
.btn-primary:not(:disabled):hover { background-color: var(--accent-hover); box-shadow: 0 0 15px var(--accent-glow); transform: translateY(-1px); }
.btn-secondary { background-color: var(--bg-hover); color: var(--text-main); border: 1px solid var(--border); padding: 10px 16px; width: 100%; }
.btn-secondary:not(:disabled):hover { background-color: #2a2a2a; border-color: #444; }
.btn-micro-primary { background: rgba(34, 211, 238, 0.1); color: var(--accent); border: 1px solid rgba(34, 211, 238, 0.3); padding: 4px 8px; font-size: 0.7rem; border-radius: 4px; }
.btn-micro-primary:hover { background: rgba(34, 211, 238, 0.2); }
.btn-auto-calc { background: rgba(34, 211, 238, 0.1); color: var(--accent); border: 1px solid rgba(34, 211, 238, 0.3); padding: 6px 14px; font-size: 0.75rem; font-weight: 600; border-radius: 6px; width: 100px; text-align: center; }
.btn-auto-calc:not(:disabled):hover { background: rgba(34, 211, 238, 0.2); box-shadow: 0 0 10px var(--accent-glow); }
.btn-export-large { background-color: var(--accent); color: #000; padding: 8px 24px; font-size: 0.95rem; font-weight: 700; border-radius: 8px; margin-left: 0; }
.btn-export-large:not(:disabled):hover { background-color: var(--accent-hover); box-shadow: 0 0 20px var(--accent-glow); transform: translateY(-1px); }

/* Export Hint Arrow */
.export-hint {
    background: linear-gradient(135deg, var(--accent), #0284c7);
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    animation: bounceRight 1.5s infinite;
    box-shadow: 0 4px 15px rgba(34, 211, 238, 0.4);
}
@keyframes bounceRight {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-6px); }
}

/* Breathing Animation for buttons/elements */
@keyframes breather {
    0%   { transform: scale(1); box-shadow: 0 0 0px transparent; }
    50%  { transform: scale(1.03); box-shadow: 0 0 20px var(--accent-glow); }
    100% { transform: scale(1); box-shadow: 0 0 0px transparent; }
}
.breathing {
    animation: breather 2s ease-in-out infinite !important;
}

/* ─── VIDEO PANELS (Left & Right) ─── */
.panel-header { display: flex; align-items: center; margin-bottom: 12px; gap: 12px; }
.panel-center .panel-header { padding: 16px 20px 0; margin-bottom: 16px; justify-content: center; }
.panel-header h3 { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; display: flex; align-items: center; gap: 6px; }

.video-wrapper {
    flex: 1;
    position: relative;
    background: #000;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
}
video { width: 100%; height: 100%; object-fit: contain; outline: none; }

.upload-overlay { position: absolute; inset: 0; background-color: rgba(0,0,0,0.6); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 10; }
.upload-box { border: 1px dashed var(--border); background: rgba(19,19,19,0.8); border-radius: var(--radius-lg); padding: 40px; text-align: center; cursor: pointer; transition: all 0.2s; width: 80%; max-width: 300px; }
.upload-box:hover { border-color: var(--accent); background: rgba(30,30,30,0.9); transform: translateY(-2px); }
.upload-box i { font-size: 2.5rem; color: var(--accent); margin-bottom: 12px; display: block; }
.upload-box h2 { font-size: 1rem; margin-bottom: 6px; font-weight: 600; color: var(--text-main); }
.upload-box p { color: var(--text-muted); font-size: 0.8rem; }

.video-badge { background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(4px); padding: 4px 10px; border-radius: var(--radius-sm); font-size: 0.75rem; font-weight: 600; z-index: 5; border: 1px solid var(--border); }
.video-badge.highlight { color: var(--accent); border-color: rgba(34, 211, 238, 0.3); }

.empty-player { display: flex; flex-direction: column; align-items: center; color: var(--border); }
.empty-player i { font-size: 2.5rem; margin-bottom: 10px; opacity: 0.5; }

.processing-loader { position: absolute; inset: 0; background-color: rgba(0,0,0,0.85); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 10; backdrop-filter: blur(5px); }
.processing-loader i.spin { font-size: 3rem; color: var(--accent); animation: pulseSpin 1.5s ease-in-out infinite; margin-bottom: 12px; }
@keyframes pulseSpin { 0% { transform: scale(1) rotate(0deg); } 50% { transform: scale(1.1) rotate(180deg); } 100% { transform: scale(1) rotate(360deg); } }

/* Stats Mini-Boxes */
.stats-row { display: flex; gap: 12px; }
.stat-box-compact { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 14px; font-size: 0.9rem; color: var(--text-muted); display: flex; align-items: center; }
.stat-box-compact b { color: var(--text-main); font-variant-numeric: tabular-nums; margin-left: 6px; font-size: 1.15rem; }
.highlight-stat { background: rgba(34, 211, 238, 0.05); border-color: rgba(34, 211, 238, 0.2); }
.highlight-stat b, .highlight-stat i { color: var(--accent); }

/* ─── CENTER PANEL SETTINGS ─── */
.settings-scroll { flex: 1 1 0; overflow-y: auto; padding: 0 20px 20px; min-height: 0; }
.settings-scroll::-webkit-scrollbar { width: 6px; }
.settings-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

.workflow-steps { display: flex; background: var(--bg-hover); border-radius: var(--radius); padding: 6px; margin-bottom: 24px; border: 1px solid var(--border); }
.wf-step { flex: 1; text-align: center; padding: 6px 0; border-radius: var(--radius-sm); font-size: 0.7rem; font-weight: 600; color: var(--text-muted); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.wf-step.active { background: rgba(34, 211, 238, 0.1); color: var(--accent); }
.wf-arrow { display: flex; align-items: center; color: var(--border); font-size: 1rem; }

.settings-group { margin-bottom: 20px; }
.settings-group label { display: flex; justify-content: space-between; font-size: 0.8rem; font-weight: 500; margin-bottom: 8px; color: var(--text-main); }
.val-display { color: var(--accent); font-weight: 600; font-variant-numeric: tabular-nums; }
.help-text { font-size: 0.7rem; color: var(--text-muted); margin-top: 6px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.panel-divider { height: 1px; background: var(--border); margin: 24px 0; }
.premium-box { background: rgba(0,0,0,0.2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 20px; }

/* 2x2 Audio Settings Grid */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.settings-grid .settings-group { margin-bottom: 0; }
.settings-grid label span { font-size: 0.75rem; white-space: nowrap;}

/* CapCut Style Sliders */
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; background: transparent; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; height: 14px; width: 14px; border-radius: 50%; background: var(--text-main); cursor: pointer; margin-top: -5px; box-shadow: 0 0 8px rgba(255,255,255,0.4); border: 2px solid var(--accent); }
input[type=range]::-webkit-slider-runnable-track { width: 100%; height: 4px; cursor: pointer; background: var(--border); border-radius: var(--radius-sm); }
input[type=range]:focus::-webkit-slider-thumb { background: var(--accent); box-shadow: 0 0 10px var(--accent-glow); }

/* Audio Toggle */
.switch { position: relative; display: inline-block; width: 36px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--border); transition: .3s; border-radius: 20px; }
.slider:before { position: absolute; content: ""; height: 14px; width: 14px; left: 3px; bottom: 3px; background-color: white; transition: .3s; border-radius: 50%; }
input:checked + .slider { background-color: var(--accent); }
input:checked + .slider:before { transform: translateX(16px); }

.action-footer { padding: 20px; background: var(--bg-hover); border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }

/* ─── Login Gate ─── */
.login-gate { position: fixed; inset: 0; background: rgba(10,10,10,0.9); backdrop-filter: blur(10px); z-index: 1000; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 20px; }
.login-gate h2 { color: var(--text-main); font-weight: 600; }
.login-gate a { text-decoration: none; }


/* ─── TIMELINE (Bottom Footer) ─── */
.timeline-container { height: 180px; background-color: var(--bg-panel); border-top: 1px solid var(--border); display: flex; flex-direction: column; z-index: 20; }
.timeline-header { padding: 8px 20px; border-bottom: 1px solid var(--border); font-size: 0.8rem; font-weight: 600; color: var(--text-main); display: flex; align-items: center; gap: 10px; background: var(--bg-header); }
.timeline-instructions { font-size: 0.75rem; color: var(--accent); font-weight: 500; display: flex; align-items: center; gap: 4px; margin-left: 20px; }
.timeline-status { margin-left: auto; font-weight: 400; color: var(--text-muted); font-size: 0.75rem; }

.timeline-track-container { flex: 1; position: relative; overflow: hidden; background-color: #0b0b0b; padding: 10px 20px; display: flex; align-items: center;}
.timeline-placeholder { position: absolute; top: 50%; left: 0; transform: translateY(-50%); width: 100%; text-align: center; color: var(--text-muted); font-size: 0.85rem; z-index: 5; pointer-events: none;}
.timeline-inner-wrapper { position: relative; width: 100%; height: 120px; display: flex; flex-direction: column; gap: 4px; }

#waveform-container { position: relative; height: 90px; width: 100%; z-index: 1; border-radius: var(--radius-sm); overflow: hidden; }

.timeline-track { position: relative; height: 26px; width: 100%; z-index: 2; border-radius: var(--radius-sm); pointer-events: none; overflow: hidden; background: #1a1a1a; }
.tl-segment { position: absolute; height: 100%; top: 0; border-right: 1px solid rgba(0,0,0,0.3); border-left: 1px solid rgba(255,255,255,0.1); transition: width 0.1s; }
.tl-speech { background: linear-gradient(180deg, rgba(16, 185, 129, 0.4) 0%, rgba(5, 150, 105, 0.6) 100%); border-left: 1px solid #10b981; border-right: 1px solid #10b981; }
.tl-silence { background: repeating-linear-gradient(45deg, #ef4444, #ef4444 10px, #dc2626 10px, #dc2626 20px); opacity: 0.8; }

/* Custom WaveSurfer Region Styling */
wavesurfer-region {
    background-color: rgba(239, 68, 68, 0.4) !important; /* var(--danger) */
    border-left: 2px solid var(--danger) !important;
    border-right: 2px solid var(--danger) !important;
    box-shadow: inset 0 0 10px rgba(239, 68, 68, 0.2);
    transition: background-color 0.2s;
}
wavesurfer-region:hover {
    background-color: rgba(239, 68, 68, 0.6) !important;
}
