:root {
    --bg-color: #0A0A1A;
    --surface-color: #17172A;
    --surface-hover: #222238;
    --border-color: #2D2D44;
    --text-primary: #F0F0F5;
    --text-minor: #8C8CAB;
    --primary-color: #FF6B6B;
    --primary-hover: #ff5252;
    --secondary-color: #EE5A24;
    --accent-color: #00CEC9;
    --danger-color: #ff4757;

    --radius: 12px;
    --font: 'Inter', system-ui, sans-serif;
    --transition: all 0.2s ease;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.hidden {
    display: none !important;
}

/* Base Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.app-header {
    height: 60px;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--primary-color);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.preset-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-minor);
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebars */
.sidebar {
    width: 320px;
    min-width: 320px;
    background-color: var(--surface-color);
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

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

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

.sidebar-header {
    margin-bottom: 1.5rem;
}

.sidebar-header h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-minor);
}

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

/* UI Elements */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-family: var(--font);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

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

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

.btn-secondary {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--surface-hover);
    border-color: var(--text-minor);
}

.btn-danger {
    background-color: rgba(255, 71, 87, 0.1);
    color: var(--danger-color);
}

.btn-danger:hover {
    background-color: var(--danger-color);
    color: white;
}

.w-full {
    width: 100%;
}

.icon-btn,
.icon-btn-small {
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: var(--transition);
}

.icon-btn {
    padding: 0.5rem;
}

.icon-btn:hover {
    background-color: var(--surface-hover);
    color: var(--accent-color);
}

.icon-btn-small {
    width: 28px;
    height: 28px;
    font-size: 1.2rem;
    background-color: var(--surface-hover);
}

.icon-btn-small:hover {
    background-color: var(--primary-color);
    color: white;
}

/* Forms */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-minor);
    display: flex;
    justify-content: space-between;
}

input[type="text"],
input[type="number"],
select {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.6rem;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
}

input:focus,
select:focus {
    border-color: var(--primary-color);
}

input[type="color"] {
    -webkit-appearance: none;
    border: 1px solid var(--border-color);
    width: 100%;
    height: 38px;
    border-radius: var(--radius);
    padding: 0;
    cursor: pointer;
    background: var(--bg-color);
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: calc(var(--radius) - 2px);
}

input[type="range"] {
    width: 100%;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.form-section {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--accent-color);
    margin: 1.5rem 0 0.5rem 0;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.25rem;
}

/* Keyframes List */
.keyframes-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.kf-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.kf-item:hover {
    border-color: var(--text-minor);
}

.kf-item.active {
    border-color: var(--accent-color);
    background-color: rgba(0, 206, 201, 0.05);
}

.kf-percent {
    font-weight: 600;
    color: var(--primary-color);
}

.kf-props {
    font-size: 0.8rem;
    color: var(--text-minor);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 150px;
}

/* Keyframe Editor (Slides over list) */
.keyframe-editor {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--surface-color);
    padding: 1.5rem;
    z-index: 10;
    overflow-y: auto;
    border-left: 1px solid var(--border-color);
}

/* Workspace (Center Stage) */
.workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-image:
        radial-gradient(circle at center, var(--border-color) 1px, transparent 1px);
    background-size: 30px 30px;
    background-position: center center;
}

.preview-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1000px;
    /* For 3d transforms */
    overflow: hidden;
}

.preview-target {
    /* Base styles, manipulated by animation class */
    transform-style: preserve-3d;
}

/* Preview Target Variants */
.preview-target.box {
    width: 120px;
    height: 120px;
    background-color: var(--primary-color);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(255, 107, 107, 0.3);
}

.preview-target.text {
    font-size: 4rem;
    font-weight: 800;
    color: var(--primary-color);
    text-shadow: 0 5px 15px rgba(255, 107, 107, 0.3);
}

.preview-target.text::before {
    content: "CSS3";
}

.preview-target.button {
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 30px;
    font-size: 1.2rem;
    font-weight: 600;
    border: none;
    box-shadow: 0 10px 20px rgba(238, 90, 36, 0.3);
}

.preview-target.button::before {
    content: "Click Me";
}

.preview-target.image {
    width: 150px;
    height: 150px;
    background-image: url('https://picsum.photos/300');
    background-size: cover;
    background-position: center;
    border-radius: 50%;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    border: 4px solid white;
}

/* Timeline Controls */
.timeline-panel {
    background-color: var(--surface-color);
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
}

.timeline-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.timeline-scrubber-container {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.timeline-scrubber {
    width: 100%;
}

.timeline-scrubber:disabled {
    opacity: 0.5;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(10, 10, 26, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    width: 600px;
    max-width: 90vw;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

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

.modal-body {
    padding: 1.5rem;
}

.modal-body textarea {
    width: 100%;
    height: 300px;
    background-color: var(--bg-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    resize: none;
    outline: none;
}

.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-color);
}