:root {
    --bg-main: #06070a;
    --bg-panel: #18191e;
    --bg-panel-dark: #121316;
    --bg-hover: #26272e;
    --bg-active: #32333b;
    --bg-clip-text: #b65a44;
    --bg-clip-video: #2a2d32;
    --bg-clip-video-selected: #3a4048;

    --text-main: #e2e4e9;
    --text-muted: #85878d;
    --text-dark: #5c5d64;

    --accent: #20e9da;
    --accent-hover: #1cc5b8;

    --border-color: #2a2b33;
    --border-radius-sm: 4px;
    --border-radius-md: 6px;
    --border-radius-lg: 8px;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    font-size: 13px;
    user-select: none;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #3b3c45;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4d4e5a;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 48px;
    padding: 0 16px;
    background-color: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
}

.nav-left,
.nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    height: 24px;
    border-radius: 4px;
    margin-right: 8px;
}

.workspace-btn {
    display: flex;
    align-items: center;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--border-radius-sm);
    transition: background 0.2s;
}

.workspace-btn:hover {
    background: var(--bg-hover);
}

.workspace-btn i {
    font-size: 10px;
    margin-left: 6px;
    color: var(--text-muted);
}

.autosave {
    color: var(--text-muted);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.autosave i {
    color: var(--accent);
}

.app-version {
    color: var(--text-dark);
    font-size: 11px;
    font-weight: 500;
    margin-left: 8px;
    padding: 2px 6px;
    background: var(--bg-panel-dark);
    border-radius: 4px;
}

.project-name {
    font-weight: 600;
    font-size: 14px;
}

.btn {
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn:hover {
    background: var(--bg-hover);
}

.btn-icon {
    color: var(--text-muted);
}

.btn-pro {
    background: #2f2f36;
    color: #f4d38f;
    border: 1px solid #4a4a52;
    font-weight: 500;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #614d33;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.btn-secondary {
    background: var(--bg-hover);
    font-weight: 500;
}

.btn-primary {
    background: var(--accent);
    color: #000;
    font-weight: 600;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

/* Workspace */
.workspace {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 0;
    /* Remove gap so resizers can be precise */
    background: var(--bg-main);
}

/* Resizers */
.resizer {
    background-color: transparent;
    position: relative;
    z-index: 10;
    transition: background-color 0.2s;
}

.resizer:hover,
.resizer.dragging {
    background-color: var(--accent);
}

.resizer-x {
    width: 6px;
    cursor: col-resize;
    height: 100%;
    margin: 0 -3px;
    /* visual overlay over the panels */
}

.resizer-y {
    height: 6px;
    cursor: row-resize;
    width: 100%;
    margin: -3px 0;
}

.panel {
    background: var(--bg-panel);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: var(--border-radius-md);
    margin: 4px 2px;
}

.panel:first-child {
    margin-left: 4px;
}

.panel:last-child {
    margin-right: 4px;
}

/* Left Panel */
.left-panel {
    width: 380px;
    flex-direction: row;
    flex-shrink: 0;
}

.tool-tabs {
    width: 64px;
    background: var(--bg-panel-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 12px;
    gap: 4px;
}

.tool-tabs .tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-dark);
    font-size: 10px;
    padding: 10px 0;
    width: 100%;
    cursor: pointer;
    transition: color 0.2s;
}

.tool-tabs .tab.active,
.tool-tabs .tab:hover {
    color: var(--accent);
}

.tool-tabs .tab i {
    font-size: 18px;
    margin-bottom: 2px;
    color: inherit;
}

.media-content {
    flex: 1;
    display: flex;
}

.sidebar-sub {
    width: 100px;
    border-right: 1px solid var(--border-color);
    padding: 12px 0;
}

.sub-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sub-nav li {
    padding: 8px 16px;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.2s;
    font-size: 12px;
}

.sub-nav li.active {
    color: var(--accent);
    background: var(--bg-active);
    border-right: 2px solid var(--accent);
}

.sub-nav li:hover:not(.section-title) {
    background: var(--bg-hover);
}

.sub-nav li.section-title {
    font-size: 11px;
    text-transform: uppercase;
    margin-top: 12px;
    padding-bottom: 4px;
    pointer-events: none;
    color: var(--text-dark);
}

.items-grid-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 12px;
}

.search-bar {
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    transition: border-color 0.2s;
}

.search-bar:focus-within {
    border-color: #555;
}

.search-bar i {
    color: #a0a0a0;
    font-size: 16px;
}

.search-bar input {
    background: transparent;
    border: none;
    color: #eee;
    outline: none;
    width: 100%;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
}

.actions-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 12px;
}

.grid-source-title {
    width: 100%;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
}

.grid-source-title span:first-child {
    color: #dfdfdf;
}

.grid-source-title span:last-child {
    color: #4da6ff;
}

.btn-import {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(32, 233, 218, 0.1);
    color: var(--accent);
    border: 1px dashed var(--accent);
    padding: 4px 12px;
    border-radius: var(--border-radius-md);
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-import:hover {
    background: rgba(32, 233, 218, 0.2);
}

.sort-actions {
    display: flex;
    gap: 12px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
}

.sort-actions span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.sort-actions span:hover {
    color: white;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    overflow-y: auto;
    padding-bottom: 20px;
    padding-right: 6px;
}

/* Custom Scrollbar */
.media-grid::-webkit-scrollbar {
    width: 8px;
}

.media-grid::-webkit-scrollbar-track {
    background: #1c1c1c;
    border-radius: 4px;
}

.media-grid::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

.media-grid::-webkit-scrollbar-thumb:hover {
    background: #777;
}

.media-item {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    background: transparent;
    cursor: grab;
    display: flex;
    flex-direction: column;
    transition: transform 0.1s, box-shadow 0.1s;
    aspect-ratio: 16/9;
}

.media-item:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.media-item-thumb {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg-active);
    border-radius: 6px;
}

.media-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 1;
    transition: filter 0.2s;
    display: block;
}

.media-item:hover .media-item-thumb img {
    filter: brightness(1.1);
}

.media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.media-item:hover img {
    opacity: 1;
    filter: brightness(1.2);
}

.media-item .duration {
    position: absolute;
    top: 6px;
    right: 6px;
    bottom: auto;
    font-size: 10px;
    background: rgba(0, 0, 0, 0.55);
    padding: 2px 6px;
    border-radius: 12px;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    pointer-events: none;
}

.media-item .item-name {
    display: none;
}

/* Center Panel */
.center-panel {
    flex: 1;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    min-width: 400px;
}

.player-header {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    margin-bottom: 12px;
    font-size: 12px;
}

.player-preview {
    flex: 1;
    background: #000;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    margin-bottom: 12px;
    min-height: 0;
    min-width: 0;
}

.player-viewport {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: 16 / 9;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

.viewport-content {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.viewport-content .preview-img,
.viewport-content #canvas-2d-fallback,
.viewport-content #webgpu-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Prevent stretching, keep 16:9 ratio */
    pointer-events: none;
}

.preview-controls-overlay {
    position: absolute;
    bottom: 12px;
    display: flex;
    justify-content: center;
    width: 100%;
}

.refresh-icon {
    background: rgba(0, 0, 0, 0.5);
    padding: 6px;
    border-radius: 50%;
    cursor: pointer;
}

.refresh-icon:hover {
    background: rgba(0, 0, 0, 0.8);
    color: white;
}

/* Crop lines mockup */
.crop-lines {
    position: absolute;
    top: 10%;
    bottom: 10%;
    left: 5%;
    right: 5%;
    border: 1px dashed rgba(255, 255, 255, 0.4);
    pointer-events: none;
}

.corner {
    position: absolute;
    width: 8px;
    height: 8px;
    border: 2px solid white;
    background: transparent;
}

.top-left {
    top: -2px;
    left: -2px;
    border-right: none;
    border-bottom: none;
}

.top-right {
    top: -2px;
    right: -2px;
    border-left: none;
    border-bottom: none;
}

.bottom-left {
    bottom: -2px;
    left: -2px;
    border-right: none;
    border-top: none;
}

.bottom-right {
    bottom: -2px;
    right: -2px;
    border-left: none;
    border-top: none;
}


.player-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    color: var(--text-muted);
}

.time-display {
    display: flex;
    gap: 8px;
    font-family: monospace;
    font-size: 12px;
}

.time-display .current {
    color: var(--accent);
}

.play-actions {
    font-size: 18px;
    color: var(--text-main);
    cursor: pointer;
    transition: transform 0.2s;
}

.play-actions:hover {
    transform: scale(1.1);
    color: white;
}

.view-actions {
    display: flex;
    gap: 16px;
    align-items: center;
    cursor: pointer;
}

.ratio-btn {
    border: 1px solid var(--border-color);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
}

.ratio-btn:hover {
    border-color: var(--text-muted);
    color: white;
}

/* Right Panel */
.right-panel {
    width: 340px;
    flex-shrink: 0;
}

.properties-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.properties-tabs .tab {
    flex: 1;
    text-align: center;
    padding: 11px 4px;
    color: var(--text-muted);
    cursor: pointer;
    font-weight: 500;
    font-size: 11px;
    position: relative;
    transition: color 0.18s;
    white-space: nowrap;
}

.properties-tabs .tab:hover:not(.tab-disabled) {
    color: var(--text-main);
}

.properties-tabs .tab.active {
    color: var(--accent);
}

.properties-tabs .tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 20%;
    right: 20%;
    height: 2px;
    background: var(--accent);
    border-radius: 2px 2px 0 0;
}

/* Disabled tab - Transizioni when only 1 track */
.properties-tabs .tab.tab-disabled {
    color: var(--text-dark) !important;
    cursor: not-allowed;
    opacity: 0.45;
}

.properties-tabs .tab.tab-disabled.active {
    color: var(--text-dark) !important;
}

.properties-tabs .tab.tab-disabled.active::after {
    display: none;
}

/* Right panel layout: tabs + scrollable content */
.right-panel {
    display: flex !important;
    flex-direction: column;
    overflow: hidden;
}

.tab-content {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.tab-content.active {
    display: flex;
}


.properties-subtabs {
    display: flex;
    padding: 12px 16px;
    gap: 8px;
}

.subtab {
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.subtab.active {
    background: #32333b;
    color: white;
}

.subtab.disabled {
    color: var(--text-dark);
    pointer-events: none;
}

.properties-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px;
}

.accordion-section {
    border-top: 1px solid var(--border-color);
    padding: 16px 0;
}

.accordion-section:first-child {
    border-top: none;
    padding-top: 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    cursor: pointer;
    font-size: 13px;
}

.section-header>div {
    display: flex;
    gap: 12px;
    align-items: center;
    color: var(--text-muted);
}

.reset-icon {
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s;
}

.section-header:hover .reset-icon {
    opacity: 1;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-main) !important;
}

.custom-checkbox {
    accent-color: var(--accent);
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.pro-badge {
    background: #2f2f36;
    color: #f4d38f;
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 2px;
    font-weight: 600;
    margin-left: auto;
    border: 1px solid #4a4a52;
    transform: scale(0.9);
}

.section-body {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    display: none;
}

.expanded .section-body {
    display: flex;
}

.prop-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.prop-row label {
    color: var(--text-muted);
    width: 80px;
    font-size: 11px;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.slider {
    flex: 1;
    accent-color: var(--accent);
    height: 4px;
    background: var(--text-dark);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    border-radius: 2px;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
}

.value-box {
    background: var(--bg-active);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    min-width: 54px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid transparent;
    font-family: monospace;
}

.value-box i {
    color: var(--text-dark);
    font-size: 10px;
}

.value-box.small {
    min-width: 40px;
    justify-content: center;
}

.toggle-row {
    justify-content: flex-start;
    gap: 12px;
}

.toggle {
    width: 32px;
    height: 18px;
    border-radius: 9px;
    background: var(--text-dark);
    position: relative;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle::after {
    content: '';
    position: absolute;
    left: 2px;
    top: 2px;
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    transition: left 0.3s;
}

.toggle.active {
    background: var(--accent);
}

.toggle.active::after {
    left: 16px;
}

.split-row {
    gap: 8px;
}

.input-group {
    display: flex;
    align-items: center;
    background: var(--bg-active);
    border-radius: 4px;
    padding: 4px 8px;
    flex: 1;
    border: 1px solid transparent;
}

.input-group:focus-within {
    border-color: var(--text-dark);
}

.input-group .label {
    color: var(--text-muted);
    margin-right: 8px;
    font-size: 11px;
}

.input-group input {
    background: transparent;
    border: none;
    color: white;
    width: 100%;
    outline: none;
    font-size: 12px;
    font-family: monospace;
}

.chain-icon {
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
}

.chain-icon:hover {
    color: white;
}

.knob-container {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    justify-content: flex-end;
}

.knob {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--text-dark);
    position: relative;
    cursor: pointer;
    transition: border-color 0.2s;
}

.knob:hover {
    border-color: var(--text-muted);
}

.knob-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50%;
    height: 2px;
    background: var(--text-muted);
    transform-origin: center left;
    transform: translateY(-50%) rotate(0deg);
}


.align-tools {
    display: flex;
    gap: 12px;
    justify-content: flex-start;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    margin-top: 8px;
    padding: 8px;
    background: var(--bg-main);
    border-radius: 4px;
    width: fit-content;
}

.align-tools i {
    padding: 4px;
    border-radius: 2px;
    transition: all 0.2s;
}

.align-tools i:hover {
    color: white;
    background: var(--bg-active);
}

/* Timeline Area */
.timeline-area {
    height: 300px;
    background: var(--bg-panel);
    margin: 0 4px 4px 4px;
    border-radius: var(--border-radius-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.timeline-toolbar {
    display: flex;
    justify-content: space-between;
    padding: 10px 16px;
    color: var(--text-muted);
    align-items: center;
}

.tools-left,
.tools-right {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-right: 40px;
}

.tools-left i,
.tools-right i {
    cursor: pointer;
    transition: color 0.2s;
    font-size: 14px;
}

.tools-left i:hover,
.tools-right i:hover {
    color: white;
}

.active-tool {
    color: var(--accent) !important;
}

.divider {
    width: 1px;
    height: 16px;
    background: var(--border-color);
    margin: 0 4px;
}

.zoom-slider {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 120px;
}

.timeline-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

.timeline-headers {
    width: 140px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding-top: 24px;
    background: var(--bg-panel);
    z-index: 10;
    flex-shrink: 0;
}

.track-header {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: 16px;
    color: var(--text-dark);
    font-size: 11px;
}

.track-controls {
    display: flex;
    gap: 12px;
}

.track-controls i:hover {
    color: var(--text-main);
    cursor: pointer;
}

.track-header-video {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    padding: 0 10px 0 12px;
    border-top: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
    gap: 6px;
    cursor: pointer;
    transition: background 0.2s, border-left 0.2s;
    border-left: 2px solid transparent;
}

.track-header-video:hover {
    background: rgba(255, 255, 255, 0.05);
}

.track-header-video.selected {
    background: rgba(32, 233, 218, 0.1);
    border-left: 2px solid var(--accent);
}


.track-label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 11px;
    white-space: nowrap;
    flex: 1;
    overflow: hidden;
}

.track-label i {
    font-size: 12px;
    color: var(--accent);
    flex-shrink: 0;
}

.track-delete-btn {
    color: var(--text-dark) !important;
    cursor: pointer;
    transition: color 0.2s;
    font-size: 11px !important;
}

.track-delete-btn:hover {
    color: #e05555 !important;
}

.add-track-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    margin: 6px 8px;
    border: 1px dashed var(--border-color);
    border-radius: var(--border-radius-md);
    color: var(--text-dark);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.add-track-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(32, 233, 218, 0.05);
}

.add-track-btn i {
    font-size: 10px;
}

.track.drag-over {
    background: rgba(32, 233, 218, 0.08) !important;
    outline: 1px dashed var(--accent);
}

.timeline-tracks {
    flex: 1;
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
    background: var(--bg-main);
    padding-top: 24px;
    display: flex;
    flex-direction: column;
}

.time-ruler {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    color: var(--text-muted);
    font-size: 10px;
    z-index: 5;
    background: var(--bg-main);
}

.time-ruler span {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    white-space: nowrap;
}

.track {
    height: 60px;
    position: relative;
    flex-shrink: 0;
}

.track.video-track {
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
}

.clip {
    position: absolute;
    height: 100%;
    cursor: pointer;
    display: flex;
    align-items: center;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    transition: filter 0.2s;
}

.clip:hover {
    filter: brightness(1.2);
}

.clip.selected {
    box-shadow: inset 0 0 0 1px white, 0 0 0 1px white;
    z-index: 5;
}

.text-clip {
    height: 20px;
    top: 20px;
    background: var(--bg-clip-text);
    color: white;
    font-size: 11px;
    padding: 0 8px;
    border-radius: 6px;
}

.video-clip {
    background: var(--bg-clip-video);
    top: 4px;
    bottom: 4px;
    height: auto;
    border-radius: 6px;
}

.video-clip img {
    height: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    opacity: 0.85;
    border-right: 1px solid rgba(0, 0, 0, 0.5);
}

.video-clip span {
    color: white;
    font-size: 10px;
    padding: 0 8px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    flex: 1;
}

.video-clip.selected {
    background: var(--bg-clip-video-selected);
}

.playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    z-index: 20;
    pointer-events: none;
}

.playhead-top {
    position: absolute;
    top: 0;
    left: -6px;
    width: 13px;
    height: 16px;
    color: white;
    cursor: grab;
    pointer-events: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
}

.playhead-line {
    position: absolute;
    top: 12px;
    left: 0;
    bottom: 0;
    width: 1px;
    background: white;
}

.lag-preview {
    position: absolute;
    top: 24px;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    pointer-events: none;
    z-index: 1;
}

.tooltip {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: var(--text-muted);
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

/* --- FX TOOLBAR BUTTONS --- */
.fx-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: var(--border-radius-sm);
    transition: all 0.2s;
    white-space: nowrap;
}

.fx-btn:hover {
    color: var(--accent);
    background: rgba(32, 233, 218, 0.08);
}

.fx-btn i {
    font-size: 12px;
}

/* --- CLIP INTERIOR --- */
.clip-thumbs {
    position: absolute;
    inset: 0;
    display: flex;
    overflow: hidden;
    border-radius: 5px;
}

.clip-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 4px;
}

.clip-label i {
    font-size: 9px;
    color: var(--accent);
}

/* --- EFFECTS PANEL --- */
.fx-panel {
    position: absolute;
    bottom: 100%;
    left: 150px;
    z-index: 100;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 0;
    width: 320px;
    flex-direction: column;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    margin-bottom: 4px;
}

.fx-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg-panel-dark);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
}

.fx-panel-header i:first-child {
    color: var(--accent);
}

.fx-close {
    margin-left: auto;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s;
}

.fx-close:hover {
    color: white;
}

.fx-no-clip-msg {
    padding: 16px 14px;
    color: var(--text-muted);
    font-size: 12px;
    font-style: italic;
}

.fx-controls {
    flex-direction: column;
    gap: 0;
    padding: 8px 0;
}

.fx-section {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
}

.fx-section:last-child {
    border-bottom: none;
}

.fx-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 10px;
}

.fx-toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.fx-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.fx-row:last-child {
    margin-bottom: 0;
}

.fx-row label {
    color: var(--text-muted);
    font-size: 11px;
    width: 50px;
    flex-shrink: 0;
}

.fx-row input[type="range"] {
    flex: 1;
    accent-color: var(--accent);
    height: 4px;
    background: var(--text-dark);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    border-radius: 2px;
}

.fx-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
}

.fx-row select {
    flex: 1;
    background: var(--bg-active);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: var(--border-radius-sm);
    padding: 4px 8px;
    font-size: 11px;
    outline: none;
    cursor: pointer;
}

.fx-row select:focus {
    border-color: var(--accent);
}

.fx-val {
    font-size: 11px;
    color: var(--accent);
    font-family: monospace;
    width: 40px;
    text-align: right;
    flex-shrink: 0;
}

/* --- TAB CONTENT SYSTEM --- */
.tab-content {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.tab-content.active {
    display: flex;
}

/* Right panel tabs - only 3 tabs, adjusted */
.properties-tabs .tab {
    flex: 1;
}

/* --- EFFECTS TAB (right panel) --- */
#tab-effects {
    flex-direction: column;
    overflow-y: auto;
}

.efx-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
}

.efx-header i {
    color: var(--accent);
    font-size: 14px;
}

.efx-back-btn {
    cursor: pointer;
    padding: 4px 8px;
    margin-left: -8px;
    color: var(--text-muted);
    transition: color 0.2s;
}

.efx-back-btn:hover {
    color: var(--accent);
}

.efx-no-clip {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
    flex: 1;
}

.efx-no-clip i {
    font-size: 28px;
    color: var(--text-dark);
}

.efx-applied-title {
    padding: 12px 16px 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dark);
    font-weight: 600;
}

.efx-list {
    padding: 0 8px 12px;
}

.efx-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: background 0.18s;
    margin-bottom: 4px;
}

.efx-item:hover {
    background: var(--bg-hover);
}

.efx-item.efx-active {
    background: rgba(32, 233, 218, 0.08);
}

.efx-item-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--bg-active);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
    color: var(--accent);
}

.efx-active .efx-item-icon {
    background: rgba(32, 233, 218, 0.15);
}

.efx-item-info {
    flex: 1;
}

.efx-item-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-main);
}

.efx-item-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.efx-item-status {
    color: var(--text-dark);
    font-size: 11px;
}

.efx-badge-on {
    background: rgba(32, 233, 218, 0.18);
    color: var(--accent);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
}

/* --- EFFECT DETAIL VIEW --- */
.efx-detail-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-panel-dark);
}

.efx-back-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: var(--border-radius-sm);
    transition: background 0.2s;
}

.efx-back-btn:hover {
    background: rgba(32, 233, 218, 0.1);
}

.efx-back-btn i {
    font-size: 11px;
}

.efx-detail-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
}

.efx-detail-title i {
    color: var(--accent);
}

.efx-detail-body {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
    flex: 1;
}

.efx-enable-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg-main);
    border-radius: var(--border-radius-md);
}

.efx-toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-main);
}

.efx-toggle-label input[type="checkbox"] {
    accent-color: var(--accent);
    width: 15px;
    height: 15px;
    cursor: pointer;
}

.efx-preview-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    color: var(--accent);
    opacity: 0.7;
}

.efx-param-section {
    background: var(--bg-main);
    border-radius: var(--border-radius-md);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.efx-param-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.efx-param-row label {
    font-size: 11px;
    color: var(--text-muted);
    width: 55px;
    flex-shrink: 0;
}

.efx-param-row input[type="range"] {
    flex: 1;
    accent-color: var(--accent);
    height: 4px;
    appearance: none;
    -webkit-appearance: none;
    background: var(--text-dark);
    border-radius: 2px;
    outline: none;
}

.efx-param-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
}

.efx-param-row select {
    flex: 1;
    background: var(--bg-active);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: var(--border-radius-sm);
    padding: 4px 8px;
    font-size: 11px;
    outline: none;
    cursor: pointer;
}

.efx-param-row select:focus {
    border-color: var(--accent);
}

.efx-val-display {
    font-size: 11px;
    color: var(--accent);
    font-family: monospace;
    width: 38px;
    text-align: right;
    flex-shrink: 0;
}

.efx-curve-preview {
    background: var(--bg-main);
    border-radius: var(--border-radius-md);
    padding: 10px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.efx-curve-preview svg {
    width: 100%;
    height: 100%;
}

.efx-remove-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(224, 85, 85, 0.1);
    border: 1px solid rgba(224, 85, 85, 0.25);
    color: #e05555;
    border-radius: var(--border-radius-md);
    padding: 8px 16px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 4px;
}

.efx-remove-btn:hover {
    background: rgba(224, 85, 85, 0.2);
    border-color: #e05555;
}

/* Transitions tab: type selector */
.tr-type-selector {
    display: flex;
    gap: 8px;
}

.tr-type-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    background: var(--bg-workspace);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: var(--border-radius-md);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
}

.tr-type-btn:hover {
    border-color: var(--accent);
    color: var(--text-main);
}

.tr-type-btn.active {
    background: rgba(32, 233, 218, 0.12);
    border-color: var(--accent);
    color: var(--accent);
}

/* Mask import button */
.tr-mask-import-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background: rgba(32, 233, 218, 0.08);
    border: 1px dashed var(--accent);
    color: var(--accent);
    border-radius: var(--border-radius-md);
    padding: 10px 16px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
}

.tr-mask-import-btn:hover {
    background: rgba(32, 233, 218, 0.18);
}

/* Transitions List */
.trans-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
}

.trans-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-workspace);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.trans-item:hover {
    border-color: var(--accent);
    background: rgba(32, 233, 218, 0.05);
}

.trans-item i {
    font-size: 16px;
    color: var(--accent);
    width: 24px;
    text-align: center;
}

.trans-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.trans-item-info strong {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-main);
}

.trans-item-info span {
    font-size: 10px;
    color: var(--text-muted);
}


/* Color Wheels (DaVinci/Professional Style) */
.cw-pro-header {
    background: #18191c;
    border-bottom: 1px solid #000;
}

.cw-pro-header .cw-reset-all {
    margin-left: auto;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 14px;
}

.cw-pro-header .cw-reset-all:hover {
    color: var(--accent);
}

.cw-pro-body {
    background: #1e1f22;
    padding: 0 !important;
}

.cw-top-bar,
.cw-bottom-bar {
    display: flex;
    justify-content: space-around;
    padding: 8px 12px;
    background: #18191c;
    border-bottom: 1px solid #000;
}

.cw-bottom-bar {
    border-top: 1px solid #000;
    border-bottom: none;
}

.cw-top-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.cw-top-item span {
    font-size: 10px;
    color: var(--text-muted);
}

.cw-top-item input {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 12px;
    width: 45px;
    text-align: center;
    font-weight: 500;
    outline: none;
}

.cw-underline {
    width: 20px;
    height: 2px;
    border-radius: 1px;
    margin-top: 2px;
}

.cw-underline.blue-orange {
    background: linear-gradient(to right, #4a9eff, #ff9e4a);
}

.cw-underline.green-magenta {
    background: linear-gradient(to right, #4aff9e, #ff4aff);
}

.cw-underline.grey {
    background: #444;
}

.cw-underline.rainbow {
    background: linear-gradient(to right, red, yellow, green, cyan, blue, magenta, red);
}

.cw-wheels-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    background: #000;
    /* For grid lines */
}

.cw-wheel-box {
    display: flex;
    flex-direction: column;
    background: #1e1f22;
    padding: 12px 10px;
}

.cw-wheel-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.cw-wheel-title {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: center;
}

.cw-reset {
    cursor: pointer;
    font-size: 10px;
    opacity: 0.5;
}

.cw-reset:hover {
    opacity: 1;
    color: var(--accent);
}

.cw-circle-outer {
    flex: 1;
    aspect-ratio: 1 / 1;
    background: #000;
    border-radius: 50%;
    padding: 6px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
    min-width: 120px;
}

.cw-circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(#ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000);
    position: relative;
    cursor: crosshair;
    overflow: hidden;
}

.cw-circle::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(30, 31, 34, 0) 0%, rgba(30, 31, 34, 1) 85%);
    pointer-events: none;
}

.cw-crosshair-v,
.cw-crosshair-h {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    pointer-events: none;
}

.cw-crosshair-v {
    width: 1px;
    height: 100%;
    left: 50%;
    top: 0;
}

.cw-crosshair-h {
    height: 1px;
    width: 100%;
    top: 50%;
    left: 0;
}

.cw-thumb {
    width: 6px;
    height: 6px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    transform: translate(-50%, -50%);
    z-index: 5;
    box-shadow: 0 0 5px #fff;
}

.cw-wheel-values {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    width: 50px;
}

.cw-val-input {
    background: #18191c;
    border-radius: 2px;
    font-size: 10px;
    padding: 4px 0px;
    text-align: center;
    color: #ccc;
    position: relative;
    overflow: hidden;
}

.cw-u-line {
    position: absolute;
    bottom: 0;
    left: 20%;
    width: 60%;
    height: 1px;
}

.cw-u-line.white {
    background: #fff;
}

.cw-u-line.red {
    background: #ff4a4a;
}

.cw-u-line.green {
    background: #4aff4a;
}

.cw-u-line.blue {
    background: #4a4aff;
}

.cw-bottom-slider {
    width: 100%;
    height: 14px;
    background: #18191c;
    border-radius: 7px;
    padding: 4px;
    position: relative;
}

.cw-slider-track {
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, #000, #333, #000);
    border-radius: 4px;
}

/* HSL Qualifiers */
.hsl-section {
    background: var(--bg-nav);
    padding: 12px;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
}

.hsl-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: var(--bg-nav);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    width: 400px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 12px;
    color: var(--text-muted);
}

.form-group select {
    background: var(--bg-workspace);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px;
    border-radius: var(--border-radius-sm);
    outline: none;
    font-family: 'Inter', sans-serif;
}

.track-header-audio {
    border-left: 4px solid #f2cf66;
    /* Gold/Yellow for audio */
    background: rgba(242, 207, 102, 0.03);
}

.track-header-audio .track-label i {
    color: #f2cf66;
}

.audio-clip {
    background: #f2cf66;
    border: 1px solid rgba(0, 0, 0, 0.2);
    color: #000;
}

.audio-clip.selected {
    outline: 2px solid white !important;
    z-index: 10;
}

.audio-track-row {
    background: rgba(242, 207, 102, 0.02) !important;
}

.audio-clip .clip-label {
    font-weight: 600;
    color: #222;
}

/* Dragging tracks CSS */
.track-controls {
    cursor: grab;
}

.track-controls:active {
    cursor: grabbing;
}

.dragging-track {
    opacity: 0.5;
    background: rgba(32, 233, 218, 0.1) !important;
}