/*
   CODE MINIFIER (JS/CSS) - EXPERT WEB TOOLS
*/

@font-face { font-family: 'Inter'; src: url('/fonts/inter-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; }
@font-face { font-family: 'JetBrains Mono'; src: url('/fonts/jetbrains-mono-latin-700.woff2') format('woff2'); font-weight: 700; 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;
    --error: #ef4444;
    --font-ui: 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

:root[data-theme="light"] {
    --bg-base: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f1f5f9;
    --border-color: #e2e8f0;
    --accent-primary: #2563eb;
    --accent-hover: #1d4ed8;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --success: #059669;
    --error: #dc2626;
}

@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        --bg-base: #f8fafc;
        --bg-surface: #ffffff;
        --bg-surface-hover: #f1f5f9;
        --border-color: #e2e8f0;
        --accent-primary: #2563eb;
        --accent-hover: #1d4ed8;
        --text-primary: #0f172a;
        --text-secondary: #475569;
        --success: #059669;
        --error: #dc2626;
    }
}

* { 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; transition: background-color 0.3s ease;
}

h1, h2, h3 { font-weight: 600; letter-spacing: -0.02em; }
.hidden { display: none !important; }
.hide-desktop { display: none !important; }
.pointer-events-none { pointer-events: none; }
.w-full { width: 100%; }
.mt-2 { margin-top: 0.5rem; }
.mb-2 { margin-bottom: 0.5rem; }

/* Layout */
.studio-wrapper { display: flex; flex-direction: column; min-height: 100vh; }

.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; margin: 0; }
.logo i { color: var(--accent-primary); }
.logo span { color: var(--text-primary); }
.header-actions { display: flex; align-items: center; gap: 10px; }

/* UI Elements */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0.6rem 1.4rem; border-radius: 6px; font-weight: 500; cursor: pointer; transition: all 0.2s; border: none; font-family: var(--font-ui); min-height: 44px; }
.btn-primary { background: var(--accent-primary); color: #ffffff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.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); border-color: var(--text-secondary); }
.btn-ghost:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { min-height: 32px; padding: 0.4rem 0.85rem; font-size: 0.85rem; }
.btn-icon { padding: 0; width: 44px; height: 44px; flex-shrink: 0; }

.tabs { display: flex; background: var(--bg-base); border-radius: 8px; padding: 4px; border: 1px solid var(--border-color); }
.tab { flex: 1; background: transparent; border: none; color: var(--text-secondary); padding: 8px 12px; border-radius: 6px; cursor: pointer; font-family: var(--font-ui); font-size: 0.85rem; min-height: 36px; font-weight: 500; transition: 0.2s; }
.tab.active { background: var(--bg-surface-hover); color: var(--text-primary); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

/* Settings Menu */
.settings-dropdown-container { position: relative; }
.settings-menu {
    position: absolute; top: calc(100% + 5px); right: 0; width: 220px;
    background: var(--bg-surface); border: 1px solid var(--border-color);
    border-radius: 8px; padding: 0.5rem; z-index: 100;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2); display: flex; flex-direction: column; gap: 4px;
}
.settings-header { padding: 8px 10px; font-size: 0.8rem; text-transform: uppercase; color: var(--text-secondary); letter-spacing: 0.5px; border-bottom: 1px solid var(--border-color); margin-bottom: 4px; }
.setting-item {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px;
    cursor: pointer; border-radius: 6px; transition: 0.2s; color: var(--text-primary); font-size: 0.9rem;
}
.setting-item:hover { background: var(--bg-surface-hover); }
.setting-item input[type="checkbox"] { accent-color: var(--accent-primary); width: 16px; height: 16px; cursor: pointer; }

/* Split Layout */
.split-layout { display: flex; min-height: calc(100vh - 60px); overflow: hidden; }
.pane { flex: 1; display: flex; flex-direction: column; padding: 1.5rem; overflow: hidden; min-width: 0; }
.pane-left { border-right: 1px solid var(--border-color); background: var(--bg-base); }
.pane-right { background: var(--bg-surface); }
.pane-header { margin-bottom: 1rem; display: flex; flex-direction: column; flex-shrink: 0; }
.pane-header h2 { font-size: 1rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 0.5rem; }

/* Code Editors */
.editor-wrapper { flex: 1; display: flex; position: relative; min-height: 250px; min-width: 0; }
.code-editor { 
    width: 100%; height: 100%; resize: none; font-family: var(--font-mono); font-size: 0.9rem;
    background: var(--bg-surface); color: var(--text-primary); border: 1px solid var(--border-color); 
    border-radius: 8px; padding: 1rem; outline: none; transition: border-color 0.2s;
    line-height: 1.5; white-space: pre; overflow-wrap: normal; overflow-x: auto;
    position: relative; z-index: 2; 
}
.code-editor:focus { border-color: var(--accent-primary); }
.output-editor { background: var(--bg-base); }
.output-editor.error-text { color: var(--error); }

.empty-overlay { 
    position: absolute; inset: 0; display: flex; flex-direction: column; 
    align-items: center; justify-content: center; background: var(--bg-base);
    opacity: 0.9; 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; }
.editor-wrapper.dragover .empty-overlay { background: rgba(59, 130, 246, 0.1); color: var(--accent-primary); border: 2px dashed var(--accent-primary); }

.code-editor:focus + .empty-overlay,
.editor-wrapper.has-content .empty-overlay { opacity: 0; pointer-events: none; }

/* Stats Dashboard */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 1.5rem; flex-shrink: 0; }
.stat-card { background: var(--bg-base); padding: 1rem; border-radius: 8px; border: 1px solid var(--border-color); text-align: left; display: flex; flex-direction: column; justify-content: center; }
.stat-label { font-size: 0.75rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.stat-val { font-size: 1.3rem; font-weight: 700; font-family: var(--font-mono); color: var(--text-primary); }
.stat-card.highlight { border-color: var(--success); background: rgba(16, 185, 129, 0.05); }
.stat-card.highlight .stat-val { color: var(--success); }

.desktop-action-area { display: flex; gap: 12px; margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border-color); justify-content: flex-end; }

/* Toast */
.toast { position: fixed; bottom: 30px; left: 50%; transform: translate(-50%, 100px); background: var(--text-primary); color: var(--bg-surface); padding: 12px 24px; border-radius: 8px; font-weight: 600; box-shadow: 0 10px 25px rgba(0,0,0,0.2); opacity: 0; transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55); z-index: 2000; pointer-events: none; white-space: nowrap; }
.toast.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }

/* Info Section */
.info-section { max-width: 1200px; margin: 4rem auto; padding: 0 1.5rem; background: var(--bg-base); width: 100%; }
.info-section h2 { color: var(--text-primary); font-size: 1.8rem; margin-bottom: 2rem; text-align: center; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 2rem; margin-bottom: 4rem; }
.info-grid h3 { color: var(--accent-primary); font-size: 1.1rem; margin-bottom: 0.75rem; display: flex; align-items: center; gap: 10px; }
.info-grid p { color: var(--text-secondary); font-size: 0.95rem; line-height: 1.6; }

.faq-container { max-width: 800px; margin: 0 auto; padding-bottom: 3rem; }
.faq-container h2 { border-bottom: 1px solid var(--border-color); padding-bottom: 1rem; margin-bottom: 1.5rem; text-align: left; font-size: 1.5rem; }
.faq-container h3 { color: var(--text-primary); font-size: 1.1rem; margin: 1.5rem 0 0.5rem 0; }
.faq-container p { color: var(--text-secondary); font-size: 0.95rem; }

.mobile-bottom-nav { display: none; }

/* Responsive */
@media (max-width: 900px) {
    .hide-mobile { display: none !important; }
    .hide-desktop { display: flex !important; } 

    .split-layout { flex: none; overflow: visible; flex-direction: column; padding-bottom: 80px; }
    
    .pane { padding: 1rem; flex: none; height: auto; border: none; }
    .pane-left { border-bottom: 1px solid var(--border-color); min-height: 45vh; }
    
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 1rem; }
    .stat-card { padding: 0.8rem; }
    .stat-val { font-size: 1.1rem; }

    .editor-wrapper { min-height: 250px; }
    .code-editor { font-size: 0.8rem; padding: 0.75rem; }

    .settings-menu { right: -50px; }

    .mobile-bottom-nav { 
        position: fixed; bottom: 0; left: 0; right: 0;
        background: var(--bg-surface);
        display: flex; border-top: 1px solid var(--border-color); z-index: 900; 
        padding-bottom: env(safe-area-inset-bottom);
    }
    .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; }
}