/* Same core styles */
:root {
    --bg-dark: #0f172a;
    --sidebar-bg: #1e293b;
    --panel-bg: #334155;
    --accent: #8b5cf6;
    --accent-hover: #7c3aed;
    --input-bg: #475569;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border: #334155;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    user-select: none;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100%;
}

.preview-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
    position: relative;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.logo {
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--accent);
}

.action-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.action-btn:hover {
    background: var(--accent-hover);
}

/* Stage */
.stage-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    border-radius: 12px;
    border: 2px dashed var(--border);
    transition: border-color 0.3s;
    overflow: hidden;
}

.stage-container.drag-over {
    border-color: var(--accent);
    background: rgba(139, 92, 246, 0.1);
}

.video-wrapper {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    /* Allow full filling of stage */
    display: none;
    transition: transform 0.1s linear;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

video {
    display: block;
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    /* Critical for aspect ratio */
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
}

/* Vignette Overlay */
.vignette-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 4;
    background: radial-gradient(circle, transparent 50%, black 150%);
    opacity: 0;
    /* border-radius inherited from wrapper if needed, but wrapper fits video usually */
}

.placeholder-message {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.upload-box {
    text-align: center;
    color: var(--text-secondary);
    position: relative;
    cursor: pointer;
}

.upload-box i {
    font-size: 3rem;
    margin-bottom: 15px;
}

.file-input-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* Transport */
.transport-controls {
    display: none;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
}

.icon-btn {
    background: var(--panel-bg);
    border: none;
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: var(--input-bg);
    color: white;
}

.time-display {
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Sidebar */
.sidebar {
    width: 350px;
    background: var(--sidebar-bg);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.tabs-nav {
    display: flex;
    background: var(--bg-dark);
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 15px 10px;
    font-size: 0.85rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.tab-btn i {
    font-size: 1rem;
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    background: rgba(255, 255, 255, 0.02);
}

.tab-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.2s;
}

.tab-pane.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Controls */
.control-group {
    margin-bottom: 20px;
}

.flex-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.flex-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.control-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Reset Buttons */
.reset-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 4px;
    border-radius: 4px;
}

.reset-icon:hover {
    color: white;
    background: var(--panel-bg);
}

.reset-all-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: #ef4444;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
}

.reset-all-btn:hover {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

.small-group {
    margin-bottom: 10px;
    margin-left: 10px;
    border-left: 2px solid var(--input-bg);
    padding-left: 10px;
}

select,
input[type="text"] {
    width: 100%;
    background: var(--input-bg);
    border: none;
    padding: 10px;
    border-radius: 6px;
    color: white;
    outline: none;
}

input[type="range"] {
    width: 100%;
    background: transparent;

}

input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    background: var(--input-bg);
    border-radius: 2px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: white;
    margin-top: -6px;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.position-selector {
    display: flex;
    background: var(--input-bg);
    border-radius: 6px;
    padding: 2px;
}

.pos-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px;
    cursor: pointer;
    border-radius: 4px;
}

.pos-btn.active {
    background: var(--accent);
    color: white;
}

.labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: -5px;
}

/* Colors */
.color-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.color-item {
    display: flex;
    align-items: center;
    background: var(--input-bg);
    padding: 4px;
    border-radius: 4px;
    gap: 4px;
}

.color-item input[type="color"] {
    width: 24px;
    height: 24px;
    border: none;
    padding: 0;
    cursor: pointer;
    background: none;
}

.remove-color-btn {
    background: transparent;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 1rem;
    padding: 0 4px;
}

.secondary-btn {
    background: var(--input-bg);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    width: 100%;
}

.secondary-btn:hover {
    background: #56677f;
}

/* Presets */
.preset-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.preset-btn {
    background: var(--input-bg);
    color: var(--text-secondary);
    border: none;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
}

.preset-btn:hover {
    background: var(--accent);
    color: white;
}

/* Effects */
.effect-card {
    background: var(--panel-bg);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.effect-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    margin-bottom: 5px;
    flex-wrap: nowrap;
    gap: 10px;
}

.effect-header div {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 8px;
}

.desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--input-bg);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--accent);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.hidden {
    display: none;
}

.custom-file-upload {
    background: var(--input-bg);
    padding: 10px;
    border-radius: 6px;
    text-align: center;
    cursor: pointer;
    display: block;
}

.custom-file-upload input {
    display: none;
}