:root {
    --primary: #6366F1;
    --primary-hover: #4F46E5;
    --secondary: #94A3B8;
    --accent: #22D3EE;
    --bg: #0F172A;
    --panel-bg: #1E293B;
    --layer-bg: #334155;
    --text: #F8FAFC;
    --text-muted: #CBD5E1;
    --border: #475569;
    --danger: #EF4444;
    --radius: 12px;
}

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

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

h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}

.header-actions {
    display: flex;
    gap: 1rem;
}

button {
    font-family: inherit;
    font-weight: 600;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

button.primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
}

button.secondary {
    background-color: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

button.secondary:hover:not(:disabled) {
    background-color: var(--layer-bg);
}

button.border-btn {
    border-style: dashed;
    border-color: var(--secondary);
    color: var(--secondary);
}

button.border-btn:hover {
    border-color: var(--text);
    color: var(--text);
}

.split-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.controls-panel {
    width: 400px;
    background-color: var(--panel-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

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

.panel-header h2 {
    font-size: 1.1rem;
}

.layers-container {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1;
}

.layer-item {
    background-color: var(--layer-bg);
    border-radius: var(--radius);
    padding: 1rem;
    border: 1px solid var(--border);
    transition: border-color 0.2s;
}

.layer-item.active {
    border-color: var(--primary);
}

.layer-item.hidden {
    opacity: 0.5;
}

.layer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.layer-title {
    font-weight: 600;
}

.layer-actions button {
    padding: 0.3rem 0.5rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
}

.layer-actions button:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.1);
}

.layer-actions .btn-delete-layer:hover {
    color: var(--danger);
}

.setting-group {
    margin-bottom: 0.8rem;
}

.setting-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.slider-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

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

.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    background: none;
}

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

input[type="color"]::-webkit-color-swatch {
    border: 1px solid var(--border);
    border-radius: 4px;
}

.presets-section {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
}

.presets-section h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.preset-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.preset-btn {
    background: var(--layer-bg);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.85rem;
}

.preset-btn:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg);
}

.preview-controls {
    padding: 1rem 2rem;
    display: flex;
    gap: 2rem;
    border-bottom: 1px solid var(--border);
}

.preview-controls label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.preview-area {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s;
}

.preview-box {
    width: 250px;
    height: 250px;
    background-color: var(--panel-bg);
    border-radius: var(--radius);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 600;
    color: var(--text-muted);
    transition: box-shadow 0.2s, background-color 0.3s;
}

.output-panel {
    background-color: var(--panel-bg);
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border);
}

.output-panel h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

pre {
    background: #000;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    color: var(--accent);
    font-family: monospace;
    font-size: 0.95rem;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary);
}