/* ── GLOBAL STYLE INITIALIZATION ───────────────────────────────────── */
:root {
    --bg-main: #08080a;
    --bg-card: #121215;
    --bg-panel: #16161a;
    --border-color: #212125;
    --accent: #e53935;
    --accent-hover: #d32f2f;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a5;
    --text-muted: #585860;
    
    --header-height: 56px;
    --timeline-height: 280px;
    --sidebar-width: 280px;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    overflow: hidden;
    height: 100vh;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: #303036;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #44444a;
}

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

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

.logo-area {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    color: var(--accent);
    font-size: 24px;
}

.logo-area h1 {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.logo-area h1 span {
    color: var(--accent);
}

.logo-area .badge {
    background: rgba(229, 57, 53, 0.15);
    color: var(--accent);
    border: 1px solid rgba(229, 57, 53, 0.3);
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 800;
    border-radius: 4px;
    text-transform: uppercase;
}

/* Main workspace split */
.main-workspace {
    flex: 1;
    display: flex;
    height: calc(100vh - var(--header-height) - var(--timeline-height));
    overflow: hidden;
}

/* ── LEFT SIDEBAR ────────────────────────────────────────────────────── */
.left-sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

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

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 12px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.tab-btn.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent);
    background: rgba(255, 255, 255, 0.02);
}

.tab-panels {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* Upload zone */
.upload-zone {
    border: 2px dashed #303036;
    border-radius: 12px;
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-zone:hover {
    border-color: var(--accent);
    background: rgba(229, 57, 53, 0.02);
}

.upload-icon {
    font-size: 40px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.upload-zone p {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
}

.upload-zone span {
    font-size: 10px;
    color: var(--text-muted);
}

/* Assets List */
.assets-list {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.asset-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    padding: 8px;
    border-radius: 8px;
    font-size: 12px;
    cursor: grab;
}

.asset-thumbnail {
    width: 48px;
    height: 36px;
    background: #000;
    border-radius: 4px;
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
}

.asset-info {
    flex: 1;
    overflow: hidden;
}

.asset-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.asset-duration {
    font-size: 10px;
    color: var(--text-secondary);
}

/* Stickers grid */
.stickers-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.sticker-item {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    cursor: grab;
    transition: all 0.2s;
}

.sticker-item:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

/* ── VIEWPORT PLAYER ─────────────────────────────────────────────────── */
.player-section {
    flex: 1;
    background-color: var(--bg-main);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow: hidden;
}

.player-wrapper {
    flex: 1;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.canvas-container {
    position: relative;
    background: #000;
    box-shadow: 0 12px 36px rgba(0,0,0,0.5);
    border-radius: 8px;
    overflow: hidden;
    max-width: 100%;
    max-height: 100%;
}

#preview-canvas {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Selection overlay on canvas */
.canvas-overlay {
    position: absolute;
    border: 1.5px solid var(--accent);
    box-shadow: 0 0 12px rgba(229,57,53,0.3);
    pointer-events: none;
}

.resize-handle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #fff;
    border: 1.5px solid var(--accent);
    border-radius: 50%;
    pointer-events: auto;
}

.resize-handle.top-left { top: -4px; left: -4px; cursor: nwse-resize; }
.resize-handle.top-right { top: -4px; right: -4px; cursor: nesw-resize; }
.resize-handle.bottom-left { bottom: -4px; left: -4px; cursor: nesw-resize; }
.resize-handle.bottom-right { bottom: -4px; right: -4px; cursor: nwse-resize; }

.player-controls {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-top: 16px;
    background: var(--bg-card);
    padding: 10px 24px;
    border-radius: 30px;
    border: 1px solid var(--border-color);
}

.time-display {
    font-size: 13px;
    font-weight: 700;
    font-family: 'Courier New', Courier, monospace;
}

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

.control-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.control-btn:hover {
    background: rgba(255,255,255,0.06);
}

.play-pause-btn {
    background: var(--accent);
    width: 44px;
    height: 44px;
}

.play-pause-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

.play-pause-btn span {
    font-size: 24px;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── RIGHT SIDEBAR PROPERTIES ────────────────────────────────────────── */
.right-sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-card);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.panel-title {
    font-size: 14px;
    font-weight: 800;
    text-transform: uppercase;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    letter-spacing: 0.5px;
}

/* Accordion Section */
.accordion-header {
    width: 100%;
    background: none;
    border: none;
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    font-weight: 700;
    font-size: 13.5px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.accordion-header:hover {
    background: rgba(255,255,255,0.01);
}

.accordion-header .arrow {
    transition: transform 0.2s;
}

.accordion-section.active .accordion-header .arrow {
    transform: rotate(180deg);
}

.accordion-content {
    display: none;
    padding: 16px;
    background: rgba(0,0,0,0.1);
    border-bottom: 1px solid var(--border-color);
}

.accordion-section.active .accordion-content {
    display: block;
}

/* Form layouts */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 6px;
}

.form-group textarea {
    width: 100%;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    height: 70px;
    resize: none;
    outline: none;
}

.form-group textarea:focus {
    border-color: var(--accent);
}

.form-group select {
    width: 100%;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    outline: none;
    cursor: pointer;
}

.form-group select:focus {
    border-color: var(--accent);
}

.row {
    display: flex;
    gap: 12px;
}

.col {
    flex: 1;
}

/* Color Pickers */
.color-picker-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-picker-wrapper input[type="color"] {
    position: absolute;
    width: 28px;
    height: 28px;
    opacity: 0;
    cursor: pointer;
}

.color-preview {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #303036;
    display: inline-block;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
}

/* Presets Container */
.presets-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.preset-badge {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.preset-badge:hover {
    border-color: var(--accent);
    color: var(--text-primary);
    background: rgba(229,57,53,0.05);
}

/* Toggle Switches */
.toggle-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toggle-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toggle-text h4 {
    font-size: 12.5px;
    font-weight: 700;
}

.toggle-text p {
    font-size: 10px;
    color: var(--text-secondary);
}

.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: #303036;
    transition: .3s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
}

input:checked + .slider {
    background-color: var(--accent);
}

input:checked + .slider:before {
    transform: translateX(16px);
}

.slider.round {
    border-radius: 20px;
}

.slider.round:before {
    border-radius: 50%;
}

.removal-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

/* Generic range inputs styling */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    background: #303036;
    border-radius: 2px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    border: 1px solid var(--accent);
    transition: all 0.15s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* ── TIMELINE EDITOR AREA ────────────────────────────────────────────── */
.footer-timeline {
    height: var(--timeline-height);
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.timeline-toolbar {
    height: 40px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
}

.zoom-controls span {
    font-size: 16px;
}

.zoom-controls input {
    width: 80px;
}

.timeline-editor {
    flex: 1;
    overflow-x: auto;
    position: relative;
}

.timeline-ruler {
    height: 20px;
    background: rgba(0,0,0,0.15);
    border-bottom: 1px solid var(--border-color);
    position: relative;
    pointer-events: none;
}

.ruler-hash {
    position: absolute;
    width: 1px;
    height: 6px;
    background: var(--text-muted);
    bottom: 0;
}

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

.timeline-tracks-container {
    position: relative;
    padding: 10px 0;
}

.timeline-track {
    display: flex;
    height: 48px;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.02);
}

.track-info {
    width: 80px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
    padding-left: 12px;
    border-right: 1px solid var(--border-color);
    height: 100%;
}

.track-info span {
    font-size: 14px;
}

.track-content {
    flex: 1;
    position: relative;
    height: 100%;
    background: rgba(0,0,0,0.05);
}

/* Timeline blocks */
.timeline-clip {
    position: absolute;
    height: 38px;
    top: 5px;
    background: rgba(229,57,53,0.1);
    border: 1px solid var(--accent);
    border-radius: 6px;
    cursor: move;
    font-size: 10.5px;
    font-weight: 700;
    display: flex;
    align-items: center;
    padding: 0 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.timeline-clip.active {
    background: rgba(229,57,53,0.2);
    box-shadow: 0 0 8px rgba(229,57,53,0.4);
    border-width: 1.5px;
}

.clip-handle {
    position: absolute;
    width: 6px;
    height: 100%;
    top: 0;
    background: var(--accent);
    cursor: ew-resize;
    opacity: 0.5;
    transition: opacity 0.15s;
}

.clip-handle:hover {
    opacity: 1.0;
}

.clip-handle.left { left: 0; }
.clip-handle.right { right: 0; }

/* Scrubber playhead line */
.timeline-playhead {
    position: absolute;
    width: 2px;
    height: 100%;
    top: 0;
    left: 80px;
    background: #ffc107;
    z-index: 5;
    pointer-events: none;
}

.timeline-playhead::before {
    content: "";
    position: absolute;
    width: 10px;
    height: 10px;
    background: #ffc107;
    border-radius: 50%;
    left: -4px;
    top: 0;
}

/* ── GOOGLE ADSENSE CONTAINERS ──────────────────────────────────────── */
.adsense-container {
    background: rgba(255,255,255,0.01);
    border: 1px dashed var(--border-color);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.ad-label {
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 8px;
    color: var(--text-muted);
    font-weight: 800;
    text-transform: uppercase;
}

.adsense-sidebar {
    margin: 16px;
    height: 150px;
    border-radius: 8px;
}

.adsense-bottom {
    margin-top: 10px;
    height: 90px;
    width: 100%;
    border-top: 1px solid var(--border-color);
}

/* ── BUTTON AND DIALOG STYLING ────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 6px;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 12px rgba(229, 57, 53, 0.2);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #26262b;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: #303036;
    color: var(--text-primary);
}

.btn-secondary.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* Hide helper class */
.hidden {
    display: none !important;
}

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

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 30px;
    border-radius: 20px;
    width: 400px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.modal-card h3 {
    margin-bottom: 20px;
    font-size: 18px;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: #303036;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    transition: width 0.1s;
    box-shadow: 0 0 8px var(--accent);
}

.modal-card p {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 24px;
}

.modal-card .hint {
    font-size: 10px;
    color: var(--text-muted);
}
