/* Core Variables & Typography */
@font-face { font-family: 'Inter'; src: url('/fonts/inter-v20-latin-regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('/fonts/jetbrains-mono-latin-regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }

:root {
    --bg-base: #0b0d10;
    --bg-surface: #14171d;
    --bg-surface-hover: #1f232b;
    --border-color: #272c36;
    --accent-primary: #3b82f6;
    --accent-hover: #2563eb;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --font-ui: 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

body { 
    background-color: var(--bg-base); color: var(--text-primary); 
    font-family: var(--font-ui); line-height: 1.6; 
    overflow-x: hidden;
}

h1, h2, h3 { font-weight: 600; letter-spacing: -0.02em; }
.hidden { display: none !important; }
.hide-desktop { display: none !important; }
.w-full { width: 100%; }
.mt-2 { margin-top: 0.5rem; }
.text-muted { color: var(--text-secondary); }
.text-sm { font-size: 0.85rem; }

/* Layout Architecture */
.studio-wrapper { display: flex; flex-direction: column; height: 100vh; min-height: 100dvh; }

.studio-header { 
    height: 60px; display: flex; justify-content: space-between; align-items: center; 
    padding: 0 1.5rem; background: var(--bg-surface); border-bottom: 1px solid var(--border-color); flex-shrink: 0;
}
.header-left { display: flex; align-items: center; gap: 15px; }
.back-link { color: var(--text-secondary); font-size: 1.2rem; min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 6px; text-decoration: none; transition: 0.2s; }
.back-link:hover { color: var(--text-primary); background: var(--bg-surface-hover); }
.logo { font-size: 1.2rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.logo i { color: var(--success); }
.logo span { color: var(--text-primary); }
.header-actions { display: flex; align-items: center; gap: 15px; }

.privacy-badge { font-size: 0.8rem; padding: 4px 10px; border-radius: 999px; background: rgba(16, 185, 129, 0.1); color: var(--success); display: flex; align-items: center; gap: 6px; border: 1px solid rgba(16, 185, 129, 0.2); }
.badge { font-size: 0.75rem; padding: 4px 10px; border-radius: 6px; background: rgba(245, 158, 11, 0.1); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.2); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0.6rem 1.4rem; border-radius: 9999px; font-weight: 500; cursor: pointer; transition: all 0.2s; border: none; font-family: var(--font-ui); min-height: 44px; }
.btn-primary { background: linear-gradient(180deg, var(--accent-primary) 0%, #1d4ed8 100%); color: #ffffff; box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25); }
.btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, #5b9af8 0%, #2563eb 100%); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--text-primary); border: 1px solid var(--border-color); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-surface-hover); }
.btn-ghost:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { min-height: 32px; padding: 0.3rem 0.85rem; font-size: 0.85rem; }

/* Layout & Editors */
.split-layout { display: flex; flex: 1; overflow: hidden; position: relative; }
.pane { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; }
.pane-left { background: var(--bg-base); border-right: 1px solid var(--border-color); display: flex; flex-direction: column; padding: 1.5rem; }
.pane-right { background: var(--bg-surface); padding: 1.5rem; }
.pane-header { margin-bottom: 1rem; flex-shrink: 0; }
.pane-title-row { display: flex; justify-content: space-between; align-items: center; }
.pane-header h2 { font-size: 1.1rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-secondary); }

.editor-wrapper { flex: 1; display: flex; position: relative; min-height: 200px; margin-bottom: 1.5rem; }
.code-editor { 
    width: 100%; height: 100%; resize: none; font-family: var(--font-ui); font-size: 1rem;
    background: #0f1115; color: #cbd5e1; border: 1px solid var(--border-color); 
    border-radius: 8px; padding: 1.2rem; outline: none; transition: border-color 0.2s;
    line-height: 1.6; white-space: pre-wrap; overflow-wrap: break-word; overflow-y: auto;
}
.code-editor:focus { border-color: var(--accent-primary); }
.output-editor { background: #000; color: #10b981; }

.empty-overlay { 
    position: absolute; inset: 0; display: flex; flex-direction: column; 
    align-items: center; justify-content: center; background: rgba(11,13,16,0.8);
    backdrop-filter: blur(4px); border-radius: 8px; color: var(--text-secondary);
    transition: opacity 0.2s; z-index: 3; pointer-events: none;
}
.empty-overlay i { font-size: 3rem; margin-bottom: 1rem; opacity: 0.5; }
.code-editor:focus + .empty-overlay, .editor-wrapper.has-content .empty-overlay { opacity: 0; pointer-events: none; }

/* Options Panel */
.options-panel { background: var(--bg-surface); border: 1px solid var(--border-color); padding: 1rem 1.5rem; border-radius: 8px; flex-shrink: 0; margin-bottom: 0; }
.options-panel h3 { font-size: 0.85rem; color: var(--text-secondary); text-transform: uppercase; margin-bottom: 0.8rem; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--text-primary); cursor: pointer; margin-bottom: 0.6rem; user-select: none; }
.checkbox-label:last-child { margin-bottom: 0; }
.checkbox-label input { accent-color: var(--accent-primary); width: 16px; height: 16px; cursor: pointer; }

/* Action Area */
.desktop-action-area { display: flex; gap: 12px; margin-top: auto; padding-top: 1.5rem; border-top: 1px solid var(--border-color); justify-content: flex-end; flex-shrink: 0;}

/* Toast */
.toast { position: fixed; bottom: 30px; left: 50%; transform: translate(-50%, 100px); background: var(--text-primary); color: var(--bg-base); padding: 12px 24px; border-radius: 8px; font-weight: 600; box-shadow: 0 10px 25px rgba(0,0,0,0.5); opacity: 0; transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55); z-index: 1000; pointer-events: none; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

.mobile-bottom-nav { display: none; }

/* Mobile View */
@media (max-width: 900px) {
    .hide-mobile { display: none !important; }
    
    .studio-layout { flex: none; overflow: visible; flex-direction: column; padding-bottom: 80px; }
    
    .pane { flex: none; height: auto; border: none; padding: 1rem; }
    .pane-right { border-top: 1px solid var(--border-color); }
    .pane-header { padding: 0; }
    
    .editor-wrapper { min-height: 250px; margin-bottom: 1rem; }
    .code-editor { font-size: 0.9rem; padding: 0.8rem; }
    
    .options-panel { padding: 1rem; }

    /* Native Bottom Nav */
    .mobile-bottom-nav { 
        position: fixed; bottom: 0; left: 0; right: 0;
        background: rgba(20, 23, 29, 0.95); backdrop-filter: blur(10px);
        display: flex; border-top: 1px solid var(--border-color); z-index: 900; 
        padding-bottom: env(safe-area-inset-bottom); transition: opacity 0.3s;
    }
    .nav-btn {
        flex: 1; background: transparent; border: none; color: var(--text-secondary);
        display: flex; flex-direction: column; align-items: center; justify-content: center;
        padding: 12px 0; font-size: 0.7rem; font-family: var(--font-ui); cursor: pointer; gap: 4px; transition: color 0.2s;
    }
    .nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }
    .nav-btn.active { color: var(--accent-primary); }
    .nav-btn i { font-size: 1.2rem; }
}