:root {
    --bg-color: #0d0d12;
    --surface-color: #1a1a24;
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #ec4899;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
    --glass-bg: rgba(26, 26, 36, 0.8);
    --accent-glow: 0 0 20px rgba(99, 102, 241, 0.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', sans-serif;
    background: radial-gradient(circle at center, #1e1e2d 0%, #0d0d12 100%);
    color: var(--text-color);
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 4px;
    box-shadow: 0 0 15px var(--primary-color);
}

#app-container {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    background-color: var(--bg-color);
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    transition: max-width 0.3s ease;
}

.app-header {
    height: 60px;
    padding: 0 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 10;
}

.app-title {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.app-title span {
    color: var(--primary-color);
    font-weight: 300;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.icon-btn:hover {
    transform: scale(1.1);
}

.btn-icon {
    font-size: 1.2rem;
}

.btn-text {
    font-size: 0.7rem;
    color: var(--text-muted);
}

#main-content-wrapper {
    flex: 1;
    display: flex;
    overflow: hidden;
    flex-direction: column;
}

.preview-section {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
}

#video-preview-container {
    width: 100%;
    max-width: 1000px;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: var(--accent-glow);
    border: 1px solid var(--border-color);
}

#preview-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    padding: 10px 20px;
    border-radius: 40px;
    display: flex;
    gap: 15px;
    border: 1px solid var(--border-color);
    opacity: 0.2;
    transition: opacity 0.3s;
    z-index: 10;
}

#video-preview-container:hover #preview-controls {
    opacity: 1;
}

.control-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.main-play {
    background: var(--primary-color) !important;
    font-size: 1.4rem;
}

#preview-canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#folder-sidebar {
    width: 300px;
    background: var(--surface-color);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    overflow-y: auto;
    display: none;
    pointer-events: auto;
    z-index: 20;
}

#folder-items-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.folder-item {
    background: rgba(255, 255, 255, 0.03);
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.4);
}

.empty-state h3 {
    color: var(--primary-color);
    margin-bottom: 8px;
    font-size: 1.4rem;
}

.empty-state p {
    font-size: 0.9rem;
    max-width: 200px;
}

.context-menu-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.context-menu {
    position: absolute;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px;
    z-index: 1000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
    min-width: 200px;
    backdrop-filter: blur(15px);
    animation: menuFade 0.2s ease-out;
}

@keyframes menuFade {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.context-menu button {
    width: 100%;
    padding: 10px 15px;
    background: transparent;
    border: none;
    color: white;
    text-align: left;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.9rem;
}

.context-menu button:hover {
    background: var(--primary-color);
}

.timeline-section {
    height: 200px;
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 16px;
    gap: 12px;
}

.timeline-header {
    display: flex;
    flex-direction: column;
    /* Stack vertically for more width on slider */
    align-items: center;
    gap: 8px;
    width: 100%;
}

#playhead-slider-container {
    width: 100%;
    display: flex;
    align-items: center;
}

#playhead-slider {
    width: 100%;
    accent-color: var(--primary-color);
    height: 12px;
    /* Thicker for easier touch */
    cursor: pointer;
    margin: 0;
}

#time-display {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    color: var(--primary-color);
}

#timeline-tracks {
    flex: 1;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow-x: auto;
    overflow-y: auto;
    position: relative;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    padding: 10px 0;
}

.timeline-clip {
    height: 70px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 6px solid var(--primary-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 12px;
    cursor: pointer;
    position: absolute;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.video-clip {
    border-left-color: #3b82f6;
}

.audio-clip {
    border-left-color: #10b981;
}

.text-clip {
    border-left-color: #f59e0b;
}

.clip-label {
    font-weight: 600;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-footer {
    height: 70px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--glass-bg);
    gap: 15px;
}

.add-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 3px solid rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.add-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.secondary-add {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

@media (min-width: 768px) {
    #app-container {
        max-width: 100%;
        border: none;
    }

    #main-content-wrapper {
        flex-direction: row;
    }

    #folder-sidebar {
        display: block;
        flex: 1;
    }

    .preview-section {
        flex: 0 0 450px;
        border-left: 1px solid var(--border-color);
    }
}

/* Modals */
#modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
}

.modal {
    background: rgba(26, 26, 36, 0.98);
    width: 95%;
    max-width: 460px;
    border-radius: 28px;
    padding: 40px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(99, 102, 241, 0.1);
    animation: modalPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPop {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(30px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.grid-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.grid-buttons button {
    padding: 16px 20px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: white;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.grid-buttons button:hover {
    background: var(--primary-color);
    transform: translateX(5px);
}

.primary-btn {
    width: 100%;
    padding: 16px;
    border-radius: 12px;
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    border: none;
    margin-top: 10px;
}

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Reposition Mode Styles */
#reposition-here-container {
    flex: 1;
    padding: 40px;
    background: radial-gradient(circle at center, #1a1a24 0%, #0d0d12 100%);
    display: flex;
    justify-content: center;
    align-items: center;
}

.big-reposition-btn {
    width: 100%;
    max-width: 600px;
    height: 120px;
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    color: white;
    font-size: 1.8rem;
    font-weight: 800;
    border: none;
    border-radius: 60px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 20px 50px rgba(236, 72, 153, 0.3);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.big-reposition-btn:hover {
    transform: scale(1.05) translateY(-5px);
    box-shadow: 0 30px 60px rgba(236, 72, 153, 0.5);
    filter: brightness(1.1);
}

.big-reposition-btn:active {
    transform: scale(0.95);
}