:root {
    --bg-color: #121212;
    --surface-color: #1e1e1e;
    --primary-color: #007bff; /* Blue */
    --accent-color: #00d4ff;
    --text-color: #ffffff;
    --text-secondary: #aaaaaa;
    --border-color: #333333;
    --overlay-border: 2px solid rgba(255, 255, 255, 0.8);
    --handle-color: #fff;
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 1200px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

header {
    text-align: center;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

header h1 {
    margin: 0;
    font-weight: 600;
}

header p {
    color: var(--text-secondary);
    margin: 5px 0 0;
}

/* Upload Section */
.upload-box {
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    padding: 60px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.3s, background-color 0.3s;
}

.upload-box:hover {
    border-color: var(--primary-color);
    background-color: rgba(0, 123, 255, 0.05);
}

/* Editor Section */
.hidden {
    display: none !important;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface-color);
    padding: 10px 20px;
    border-radius: 8px;
}

.btn {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn:hover {
    background: linear-gradient(rgba(255,255,255,0.05), rgba(255,255,255,0.05));
    border-color: var(--text-secondary);
}

.btn.active, .btn.primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.btn.primary:hover {
    filter: brightness(1.1);
}

.btn.danger {
    color: #ff4d4d;
    border-color: #550000;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Video Workspace */
.video-workspace {
    display: flex;
    justify-content: center;
    background: #000;
    padding: 20px;
    border-radius: 8px;
    overflow: hidden;
}

.video-container {
    position: relative;
    display: inline-block;
    max-width: 100%;
    /* Max height to fit screen reasonably */
    max-height: 60vh; 
}

video {
    display: block;
    max-width: 100%;
    max-height: 60vh;
    border-radius: 4px;
}

/* Crop Overlay */
.crop-overlay {
    position: absolute;
    top: 0; 
    left: 0;
    width: 100px; /* Initial */
    height: 177px; /* Initial 9:16 approx */
    border: var(--overlay-border);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6); /* Dim surroundings */
    cursor: move;
    box-sizing: border-box;
    z-index: 10;
}

/* Handles for resizing (optional, if allowed) */
.handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--handle-color);
    border-radius: 50%;
}

.nw { top: -5px; left: -5px; cursor: nw-resize; }
.ne { top: -5px; right: -5px; cursor: ne-resize; }
.sw { bottom: -5px; left: -5px; cursor: sw-resize; }
.se { bottom: -5px; right: -5px; cursor: se-resize; }

/* Timeline & Keyframes */
.timeline-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    background: var(--surface-color);
    padding: 10px 20px;
    border-radius: 8px;
}

.playback-info {
    font-family: monospace;
    font-size: 14px;
}

.keyframes-list {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.keyframe-item {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.keyframe-item:hover {
    border-color: var(--primary-color);
}

.keyframe-item.active {
    background: var(--primary-color);
    color: white;
}

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--surface-color);
    padding: 20px;
    border-radius: 10px;
    width: 80%;
    max-width: 500px;
    position: relative;
    text-align: center;
}

.close-modal {
    position: absolute;
    top: 10px; right: 15px;
    font-size: 24px;
    cursor: pointer;
}

.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
