/* CSS Variables */
:root {
    --bg-dark: #0F0A1A;
    --bg-panel: #1A1423;
    --bg-input: #241D30;
    --text-primary: #F3F4F6;
    --text-secondary: #9CA3AF;
    --primary: #8B5CF6;
    --primary-hover: #7C3AED;
    --secondary: #A78BFA;
    --accent: #F472B6;
    
    --border-radius: 16px;
    --transition: 250ms ease;
    --border-color: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar Controls */
.sidebar {
    width: 380px;
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    flex-shrink: 0;
    z-index: 10;
}

.app-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.app-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-row {
    display: flex;
    gap: 1rem;
}

.control-row > * {
    flex: 1;
}

label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

input[type="text"], select, textarea {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: var(--transition);
    font-family: inherit;
    width: 100%;
}

textarea {
    min-height: 120px;
    font-family: "Fira Code", monospace;
    resize: vertical;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Gradient Picker */
.gradient-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.gradient-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
}

.gradient-swatch:hover {
    transform: scale(1.1);
}

.gradient-swatch.active {
    border-color: white;
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}

/* Toggles */
.toggles {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toggle-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 0.75rem;
}

.toggle-container input {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 36px;
    height: 20px;
    background-color: var(--bg-input);
    border-radius: 20px;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background-color: var(--text-secondary);
    border-radius: 50%;
    transition: var(--transition);
}

.toggle-container input:checked + .toggle-slider {
    background-color: var(--primary);
    border-color: var(--primary);
}

.toggle-container input:checked + .toggle-slider::after {
    transform: translateX(16px);
    background-color: white;
}

.toggle-label {
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* Actions */
.actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.btn {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-size: 0.9rem;
    flex: 1;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Preview Panel */
.preview-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background-image: 
        radial-gradient(circle at center, rgba(139, 92, 246, 0.05) 0%, transparent 70%),
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 100% 100%, 20px 20px, 20px 20px;
    overflow: auto;
    padding: 2rem;
}

.preview-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: min-content;
}

.export-container {
    background: linear-gradient(to right, #ec4899, #8b5cf6);
    padding: 32px;
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.code-window {
    background: #1e1e1e; /* Match prism tomorrow theme approx */
    border-radius: 12px;
    width: 600px;
    max-width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
    overflow: hidden;
    position: relative;
}

.window-header {
    height: 40px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    padding: 0 16px;
}

.window-body {
    display: flex;
    padding: 1.5rem;
    font-family: "Fira Code", monospace;
    font-size: 14px;
    line-height: 1.6;
}

.line-numbers {
    display: flex;
    flex-direction: column;
    color: rgba(255, 255, 255, 0.3);
    text-align: right;
    padding-right: 1.5rem;
    user-select: none;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    margin-right: 1.5rem;
}

.line-numbers span {
    display: block;
}

.window-body pre {
    margin: 0;
    padding: 0;
    overflow: visible;
    flex: 1;
    background: transparent !important;
}

.window-body code {
    font-family: inherit;
    text-shadow: none !important;
}

.watermark-display {
    position: absolute;
    bottom: 16px;
    right: 24px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

@media (max-width: 900px) {
    .app-container {
        flex-direction: column;
        overflow: auto;
    }
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        max-height: 50vh;
    }
    .preview-panel {
        min-height: 50vh;
    }
}
