/* ==========================================
   Design System & Styling variables
   ========================================== */
:root {
    --bg-main: #090a0f;
    --bg-header: #0f111a;
    --bg-sidebar: rgba(15, 17, 26, 0.75);
    --bg-timeline: #0d0f17;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(99, 102, 241, 0.25);
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.4);
    
    --secondary: #1e293b;
    --secondary-hover: #334155;
    
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.3);
    
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --danger-glow: rgba(239, 68, 68, 0.3);
    
    --txt-primary: #f8fafc;
    --txt-secondary: #94a3b8;
    --txt-muted: #64748b;
    
    --font-stack: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ==========================================
   Global Reset & Base Layout
   ========================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-main);
    color: var(--txt-primary);
    font-family: var(--font-stack);
    -webkit-font-smoothing: antialiased;
}

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

/* ==========================================
   Header Component
   ========================================== */
.app-header {
    height: 60px;
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 10;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 1.5rem;
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary-glow);
}

.logo-text {
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: 1.5px;
    color: var(--txt-primary);
}

.logo-sub {
    color: var(--primary);
    font-weight: 300;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.file-loader {
    display: flex;
    gap: 10px;
}

/* ==========================================
   Workspace Components
   ========================================== */
.workspace {
    flex: 1;
    display: flex;
    height: calc(100vh - 180px); /* Adjust based on header and timeline heights */
    overflow: hidden;
}

/* Left & Right Sidebars */
.sidebar-left, .sidebar-right {
    width: 260px;
    background: var(--bg-sidebar);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    z-index: 5;
}

.sidebar-right {
    border-right: none;
    border-left: 1px solid var(--border-color);
}

.toolbar-section, .sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--txt-muted);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 6px;
}

/* Button & Tool Grid Layouts */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.tool-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 70px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--txt-secondary);
    cursor: pointer;
    font-family: var(--font-stack);
    font-size: 0.75rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.tool-btn i {
    font-size: 1.25rem;
}

.tool-btn:hover {
    background: rgba(255, 255, 255, 0.07);
    color: var(--txt-primary);
}

.tool-btn.active {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--primary);
    color: var(--txt-primary);
    box-shadow: 0 0 10px var(--border-glow);
}

/* Custom Standard Controls */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-stack);
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
    text-align: center;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 0 10px var(--primary-glow);
}

.btn-secondary {
    background-color: var(--secondary);
    border-color: var(--border-color);
    color: var(--txt-primary);
}
.btn-secondary:hover {
    background-color: var(--secondary-hover);
}

.btn-success {
    background-color: var(--success);
    color: white;
}
.btn-success:hover {
    background-color: #059669;
    box-shadow: 0 0 10px var(--success-glow);
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}
.btn-danger:hover {
    background-color: var(--danger-hover);
    box-shadow: 0 0 10px var(--danger-glow);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-sm {
    padding: 8px 12px;
    font-size: 0.8rem;
}

.btn-xs {
    padding: 5px 8px;
    font-size: 0.75rem;
}

.form-control {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--txt-primary);
    padding: 8px 12px;
    font-family: var(--font-stack);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: var(--primary);
}

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

.control-group label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--txt-secondary);
}

/* Radio & Checkbox Buttons */
.radio-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 0;
}

.radio-label input[type="radio"] {
    accent-color: var(--primary);
}

.radio-text {
    font-size: 0.85rem;
    color: var(--txt-secondary);
}

/* Brush slider */
.brush-size-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.brush-size-container label {
    font-size: 0.8rem;
    color: var(--txt-secondary);
}

.slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--secondary);
    outline: none;
    accent-color: var(--primary);
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 0 8px var(--primary-glow);
}

.track-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

/* Status Badge Component */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.75rem;
}

.badge-dot {
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
}

.pulse {
    box-shadow: 0 0 0 0 var(--success-glow);
    animation: pulse-animation 2s infinite;
}

@keyframes pulse-animation {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* ==========================================
   Center Canvas Viewport
   ========================================== */
.canvas-viewport {
    flex: 1;
    background: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.canvas-container {
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    background: #000;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    overflow: hidden;
    transform-origin: center center;
    will-change: transform;
}

.canvas-container img {
    max-width: 100%;
    max-height: calc(100vh - 220px);
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

.canvas-container canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

/* Floating Zoom Control Overlay */
.zoom-controls-overlay {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 50;
    pointer-events: none;
}

.zoom-hint {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.75rem;
    color: var(--txt-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    transition: all 0.2s ease;
    user-select: none;
}

.zoom-hint.active-zoom {
    color: #a5b4fc;
    border-color: rgba(99, 102, 241, 0.6);
    background: rgba(30, 27, 75, 0.9);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
}

.zoom-btn-group {
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: 3px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    pointer-events: auto;
}

.btn-zoom {
    background: transparent;
    border: none;
    color: var(--txt-secondary);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.15s ease;
}

.btn-zoom:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.btn-zoom-label {
    width: auto;
    padding: 0 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--txt-primary);
}

/* Viewport States (Placeholder & Loaders) */
.viewport-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 60px;
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--txt-secondary);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.viewport-placeholder:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.02);
    color: var(--txt-primary);
}

.placeholder-icon {
    font-size: 3.5rem;
    color: var(--txt-muted);
    transition: transform 0.3s;
}

.viewport-placeholder:hover .placeholder-icon {
    transform: translateY(-5px);
    color: var(--primary);
}

.viewport-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    z-index: 8;
}

.loader-icon {
    font-size: 2.5rem;
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary-glow);
}

/* Metadata Panel styles */
.metadata-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(0,0,0,0.25);
    padding: 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.meta-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
}

.meta-label {
    color: var(--txt-muted);
}

.meta-val {
    color: var(--txt-primary);
    font-weight: 500;
}

/* Export Progress Panel */
.export-progress-panel {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
}

.progress-bar-container {
    height: 6px;
    background: var(--secondary);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    width: 0%;
    height: 100%;
    background-color: var(--success);
    border-radius: 3px;
    box-shadow: 0 0 8px var(--success-glow);
    transition: width 0.2s ease;
}

/* Batch queue visual elements */
.batch-queue-container {
    max-height: 150px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.queue-empty {
    font-size: 0.8rem;
    color: var(--txt-muted);
    text-align: center;
    padding: 10px;
}

/* ==========================================
   Bottom Timeline Editor
   ========================================== */
.app-timeline {
    height: 120px;
    background-color: var(--bg-timeline);
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 10px 20px;
    z-index: 10;
}

.timeline-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 40px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    padding-bottom: 5px;
}

.control-buttons {
    display: flex;
    align-items: center;
    gap: 15px;
}

.timeline-btn {
    background: none;
    border: none;
    color: var(--txt-secondary);
    cursor: pointer;
    font-size: 1rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s;
}

.timeline-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--txt-primary);
}

.timeline-btn#btn-play-pause {
    background-color: var(--primary);
    color: white;
}

.timeline-btn#btn-play-pause:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 0 10px var(--primary-glow);
}

.timeline-timecode {
    font-family: monospace;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--txt-primary);
}

.timecode-divider {
    color: var(--txt-muted);
}

.frame-counter {
    font-size: 0.75rem;
    color: var(--txt-muted);
}

.timeline-options {
    display: flex;
    align-items: center;
}

/* Scrub Container & Playhead */
.scrub-container {
    position: relative;
    flex: 1;
    margin-top: 5px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    user-select: none;
}

.timeline-ruler {
    height: 15px;
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.ruler-tick {
    position: absolute;
    width: 1px;
    height: 6px;
    background: var(--txt-muted);
    opacity: 0.3;
    bottom: 0;
}

.ruler-tick.major {
    height: 10px;
    opacity: 0.6;
}

.ruler-label {
    position: absolute;
    bottom: 8px;
    font-size: 9px;
    color: var(--txt-muted);
    font-family: monospace;
    transform: translateX(-50%);
}

.timeline-track {
    height: 24px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    overflow: visible;
}

.playhead {
    position: absolute;
    top: -15px;
    width: 2px;
    height: 40px;
    background: #f43f5e;
    z-index: 12;
    pointer-events: none;
}

.playhead::before {
    content: '';
    position: absolute;
    top: 0;
    left: -5px;
    width: 12px;
    height: 12px;
    background: #f43f5e;
    border-radius: 50% 50% 0 50%;
    transform: rotate(45deg);
    box-shadow: 0 2px 6px rgba(244, 63, 94, 0.4);
}

/* Keyframe markers */
.keyframe-markers-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.keyframe-marker {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border: 1px solid var(--txt-primary);
    transform: translate(-50%, 7px) rotate(45deg);
    border-radius: 1px;
    box-shadow: 0 0 6px var(--primary-glow);
}

/* ==========================================
   Modals & Popups
   ========================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-card {
    background: var(--bg-header);
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 25px var(--border-glow);
    width: 500px;
    max-width: 90vw;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-weight: 600;
    font-size: 1.1rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--txt-secondary);
    font-size: 1.2rem;
    cursor: pointer;
}
.modal-close:hover {
    color: var(--txt-primary);
}

.modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.modal-body p {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--txt-secondary);
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Scrollbars styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Timeline Preview Switch & Custom Inputs */
.switch-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 0;
}

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

.switch-text {
    font-size: 0.85rem;
    color: var(--txt-secondary);
}

/* Platform Master Preset Pills */
.platform-pill {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 6px;
    color: #cbd5e1;
    font-size: 0.72rem;
    font-weight: 500;
    padding: 6px 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.15s ease;
    text-align: left;
}

.platform-pill:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.4);
    color: #fff;
    transform: translateY(-1px);
}

.platform-pill.active {
    background: rgba(99, 102, 241, 0.25);
    border-color: #6366f1;
    color: #fff;
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.35);
}

.platform-pill i {
    font-size: 0.8rem;
    color: #818cf8;
}

.platform-pill-sm {
    flex: 1;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    color: #94a3b8;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 4px 0;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.platform-pill-sm:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.4);
    color: #fff;
}

