:root {
    --bg-dark: #13111C;
    --bg-secondary: #1E1B29;
    --primary: #8B5CF6;
    --primary-light: #C4B5FD;
    --accent: #F5F3FF;
    --text-primary: #FFFFFF;
    --text-secondary: #A1A1AA;
    --border-color: #2D2A3D;
    --glass-bg: rgba(30, 27, 41, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

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

.app-container {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
}

/* Sidebar Styles */
.sidebar {
    width: 100%;
    background: var(--glass-bg);
    border-right: 1px solid var(--border-color);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    overflow-y: auto;
    z-index: 10;
}

.sidebar-header h1 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 24px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

input[type="text"],
input[type="number"],
select {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.color-picker-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    background: none;
    padding: 0;
}
input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}
input[type="color"]::-webkit-color-swatch {
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.actions {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.btn {
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-align: center;
}

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover {
    background: #7C3AED;
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover {
    background: #2D2A3D;
    border-color: var(--primary-light);
}

.btn-outline {
    background: transparent;
    color: var(--primary-light);
    border: 1px solid var(--primary);
}
.btn-outline:hover {
    background: rgba(139, 92, 246, 0.1);
}

/* Main Preview Area */
.preview-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 24px;
    gap: 24px;
    background: radial-gradient(circle at 50% 50%, #2D2A3D 0%, var(--bg-dark) 100%);
    overflow: auto;
    position: relative;
    justify-content: center;
    align-items: center;
}

.editor-container {
    width: 100%;
    max-width: 800px;
    margin-bottom: 24px;
}

textarea#code-editor {
    width: 100%;
    min-height: 150px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    outline: none;
    transition: var(--transition);
}

textarea#code-editor:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

/* Snippet Display */
.snippet-container {
    background: #1e1e1e; /* Default background, overridden by theme */
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    min-width: 300px;
    transition: var(--transition);
    position: relative;
}

.window-chrome {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2); /* Slightly darker header */
}

.window-controls {
    display: flex;
    gap: 8px;
    margin-right: 16px;
}

.control {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}
.control.red { background: #FF5F56; }
.control.yellow { background: #FFBD2E; }
.control.green { background: #27C93F; }

.window-title {
    flex: 1;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
    font-family: system-ui;
    margin-right: 52px; /* Balance controls width */
}

.code-area {
    display: flex;
    align-items: stretch;
    position: relative;
}

.line-numbers {
    display: none;
    padding: 24px 0 24px 16px;
    text-align: right;
    color: rgba(255, 255, 255, 0.3);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    user-select: none;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.1);
    min-width: 48px;
}

.line-numbers.show {
    display: block;
}

.line-number {
    display: block;
    padding-right: 12px;
}

pre {
    flex: 1;
    margin: 0;
    padding: 0;
    overflow: auto;
}

code.hljs {
    padding: 24px !important;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    background: transparent !important; /* Let container handle bg */
    width: 100%;
}

.watermark {
    position: absolute;
    bottom: 12px;
    right: 16px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.3);
    pointer-events: none;
    font-weight: 500;
}

/* Responsive */
@media (min-width: 1024px) {
    .app-container {
        flex-direction: row;
    }

    .sidebar {
        width: 320px;
        flex-shrink: 0;
    }
}
