:root { --bg: #070709; --side: #18181b; --card: #18181b; --input: #27272a; --text: #f4f4f5; --text-dim: #a1a1aa; --accent: #6366f1; --accent-hover: #4f46e5; --border: rgba(255, 255, 255, 0.08); --user-bubble: #27272a; }
[data-theme="light"] { --bg: #fafafa; --side: #f4f4f5; --card: #ffffff; --input: #e4e4e7; --text: #18181b; --text-dim: #71717a; --accent: #4f46e5; --accent-hover: #4338ca; --border: rgba(0, 0, 0, 0.08); --user-bubble: #e4e4e7; }
* { box-sizing: border-box; margin: 0; padding: 0; transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease; }
body { background: var(--bg); color: var(--text); font-family: 'Inter', system-ui, sans-serif; height: 100vh; overflow: hidden; }

/* Auth UI */
.auth-overlay { position: fixed; inset: 0; background: rgba(9, 9, 11, 0.85); backdrop-filter: blur(8px); z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 20px; transition: opacity 0.4s ease, visibility 0.4s ease; overflow-y: auto; }
.auth-overlay.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.auth-glass-card { background: var(--card); width: 100%; max-width: 420px; padding: 40px; border-radius: 24px; border: 1px solid var(--border); box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); text-align: center; margin: auto; animation: slideDownFade 0.5s cubic-bezier(0.16, 1, 0.3, 1); }
.auth-logo { font-size: 36px; color: var(--accent); margin-bottom: 12px; }
.auth-logo img { width: 72px; height: 72px; object-fit: contain; display: block; margin: 0 auto 8px; border-radius: 50%; overflow: hidden; }
.gradient-text { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
#auth-subtitle { color: var(--text-dim); font-size: 14px; margin-bottom: 24px; }
.social-auth-group { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.auth-social-btn { background: var(--input); color: var(--text); border: 1px solid var(--border); padding: 12px; border-radius: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 600; font-size: 14px; transition: all 0.2s ease; }
.auth-social-btn:hover { background: var(--border); }
#btn-google i { color: #DB4437; }
.input-field { background: var(--input); border: 2px solid transparent; border-radius: 12px; display: flex; align-items: center; padding: 0 16px; margin-bottom: 16px; transition: all 0.3s ease; }
.input-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15); }
.input-field i { color: var(--text-dim); }
.input-field:focus-within i { color: var(--accent); }
.input-field input { background: transparent; border: none; color: var(--text); padding: 14px; flex: 1; outline: none; font-size: 15px; }
.forgot-pass-wrapper { text-align: right; margin-top: -8px; margin-bottom: 16px; }
.forgot-pass-link { background: none; border: none; color: var(--text-dim); font-size: 12px; cursor: pointer; transition: color 0.2s; }
.forgot-pass-link:hover { color: var(--accent); text-decoration: underline; }
.auth-primary { width: 100%; padding: 14px; background: var(--accent); color: #fff; border: none; border-radius: 12px; font-weight: 600; font-size: 15px; cursor: pointer; margin-top: 5px; transition: transform 0.2s ease, background 0.2s ease; }
.auth-primary:hover { background: var(--accent-hover); transform: translateY(-2px); }
.error-msg { color: #ef4444; font-size: 13px; margin-top: 10px; display: none; padding: 12px; background: rgba(239, 68, 68, 0.1); border-radius: 8px; border: 1px solid rgba(239, 68, 68, 0.2); animation: shake 0.4s ease; }
.auth-divider { display: flex; align-items: center; margin: 20px 0; color: var(--text-dim); font-size: 11px; text-transform: uppercase; font-weight: 600; letter-spacing: 1px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); margin: 0 15px; }
.auth-toggle-text { font-size: 14px; color: var(--text-dim); }
.auth-toggle-text button { background: none; border: none; color: var(--accent); font-weight: 600; cursor: pointer; margin-left: 5px; font-size: 14px; }
.guest-access { background: rgba(255,255,255,0.03); border: 1px solid var(--border); color: var(--text-dim); padding: 10px 20px; border-radius: 20px; font-size: 13px; margin-top: 30px; cursor: pointer; font-weight: 500; transition: all 0.3s ease; }
.guest-access:hover { background: var(--input); color: var(--text); border-color: var(--accent); }

/* Sidebar */
.app-shell { display: flex; height: 100vh; background: var(--bg); position: relative; }
.sidebar { width: 280px; background: var(--side); display: flex; flex-direction: column; padding: 16px; border-right: 1px solid var(--border); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); z-index: 100; }
.brand { display: flex; align-items: center; padding: 8px; font-weight: 700; font-size: 18px; width: 100%; justify-content: center; position: relative; }
.mobile-close-btn { display: none; background: none; border: none; color: var(--text-dim); font-size: 20px; cursor: pointer; position: absolute; right: 10px; }
.new-chat-btn { background: var(--input); border: 1px solid transparent; color: var(--text); padding: 12px 16px; border-radius: 12px; cursor: pointer; display: flex; align-items: center; gap: 12px; width: 100%; margin: 15px 0 10px 0; font-weight: 500; transition: all 0.2s ease; }
.new-chat-btn:hover { background: var(--bg); border-color: var(--border); }
.history-list-area { flex: 1; overflow-y: auto; padding-right: 4px; }
.history-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; padding: 0 8px; }
.section-label { font-size: 12px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; margin: 0;}
.clear-all-btn { background: none; border: none; color: var(--text-dim); font-size: 11px; cursor: pointer; }
.history-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-radius: 10px; font-size: 14px; cursor: pointer; margin-bottom: 4px; transition: background 0.2s; }
.history-item:hover { background: var(--input); }
.history-item.active { background: var(--input); color: var(--accent); font-weight: 500; }
.history-item i { font-size: 14px; margin-right: 12px; }
.sidebar-bottom { padding-top: 16px; border-top: 1px solid var(--border); }
.action-item { display: flex; align-items: center; gap: 12px; padding: 12px; cursor: pointer; border-radius: 10px; font-size: 14px; color: var(--text-dim); }
.action-item:hover { background: var(--input); color: var(--text); }
.user-profile-box { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 10px; margin-top: 4px; background: var(--input); }
.user-avatar { width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: white; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; overflow: hidden; }
.user-avatar img { display: none; width: 100%; height: 100%; object-fit: contain; border-radius: 8px; }
.user-avatar span { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.user-details { display: flex; flex-direction: column; overflow: hidden; }
.user-details span { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#logout-btn { background: none; border: none; color: #ef4444; text-align: left; font-size: 11px; cursor: pointer; font-weight: 600; margin-top: 2px;}

/* Main Workspace */
.main-workspace { flex: 1; display: flex; flex-direction: column; position: relative; max-width: 1000px; margin: 0 auto; width: 100%; z-index: 1; }
.top-nav { height: 60px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; }
.top-nav > div:last-child { flex-wrap: wrap; justify-content: flex-end; }
.mobile-toggle { background: none; border: none; color: var(--text); font-size: 20px; cursor: pointer; display: none; }
.engine-badge { font-size: 12px; font-weight: 600; color: var(--accent); background: rgba(99, 102, 241, 0.1); padding: 6px 12px; border-radius: 20px; display: flex; align-items: center; gap: 6px; }
.action-icon-btn { background: var(--input); border: 1px solid transparent; color: var(--text-dim); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; justify-content: center;}
.action-icon-btn:hover, .action-icon-btn.active { background: var(--bg); border-color: var(--border); color: var(--accent); }
.chat-viewport { flex: 1; overflow-y: auto; padding: 24px 40px; scroll-behavior: smooth; }


/* Messages */
.message { margin-bottom: 32px; max-width: 100%; animation: slideInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; opacity: 0; transform: translateY(15px); }
.user-msg { display: flex; flex-direction: column; align-items: flex-end; width: 100%; font-size: 15px; line-height: 1.5; }
.user-bubble { background: var(--user-bubble); padding: 14px 20px; border-radius: 20px 20px 4px 20px; width: fit-content; max-width: 85%; overflow-wrap: anywhere; word-break: break-word; }
.ai-msg { display: flex; flex-direction: column; gap: 8px; font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; word-break: break-word; }
.ai-msg img { max-width: 100%; border-radius: 12px; border: 1px solid var(--border); margin-top: 12px; }
/* Code container styling */
.ai-msg pre {
    background: #0e0e12;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin: 16px 0;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.code-header {
    display: flex;
    align-items: center;
    background: #16161f;
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dim);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

/* macOS colored dots */
.mac-dots {
    display: flex;
    gap: 6px;
    margin-right: 12px;
}

.mac-dots .dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
}

.mac-dots .dot.close {
    background: #ff5f56;
}

.mac-dots .dot.minimize {
    background: #ffbd2e;
}

.mac-dots .dot.expand {
    background: #27c93f;
}

.code-lang-label {
    font-family: 'Fira Code', monospace;
    font-size: 11px;
    letter-spacing: 0.5px;
    color: var(--text-dim);
    text-transform: uppercase;
    margin-right: auto;
}

.copy-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 6px;
    font-family: inherit;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
}

.ai-msg pre code {
    display: block;
    padding: 18px 20px;
    overflow-x: auto;
    font-family: 'Fira Code', 'JetBrains Mono', monospace;
    font-size: 13.5px;
    line-height: 1.6;
}

/* Add custom studio highlight colors to overlay standard highlight themes */
.hljs-keyword, .hljs-selector-tag, .hljs-built_in, .hljs-name {
    color: #ff7b72 !important; /* Studio soft red */
    font-weight: 600;
}
[data-theme="light"] .hljs-keyword, [data-theme="light"] .hljs-selector-tag, [data-theme="light"] .hljs-built_in, [data-theme="light"] .hljs-name {
    color: #d73a49 !important; /* Darker red */
}
.hljs-string, .hljs-title, .hljs-section, .hljs-attribute, .hljs-literal, .hljs-template-tag, .hljs-template-variable, .hljs-type {
    color: #79c0ff !important; /* Studio soft blue */
}
[data-theme="light"] .hljs-string, [data-theme="light"] .hljs-title, [data-theme="light"] .hljs-section, [data-theme="light"] .hljs-attribute, [data-theme="light"] .hljs-literal, [data-theme="light"] .hljs-template-tag, [data-theme="light"] .hljs-template-variable, [data-theme="light"] .hljs-type {
    color: #032f62 !important; /* Darker blue */
}
.hljs-comment, .hljs-quote, .hljs-deletion, .hljs-meta {
    color: #8b949e !important; /* Clean gray */
    font-style: italic;
}
[data-theme="light"] .hljs-comment, [data-theme="light"] .hljs-quote, [data-theme="light"] .hljs-deletion, [data-theme="light"] .hljs-meta {
    color: #6a737d !important;
}
.hljs-number, .hljs-regexp, .hljs-link, .hljs-symbol, .hljs-bullet {
    color: #d2a8ff !important; /* Soft purple */
}
[data-theme="light"] .hljs-number, [data-theme="light"] .hljs-regexp, [data-theme="light"] .hljs-link, [data-theme="light"] .hljs-symbol, [data-theme="light"] .hljs-bullet {
    color: #6f42c1 !important;
}
.hljs-params, .hljs-variable, .hljs-class .hljs-title {
    color: #ffa657 !important; /* Soft orange */
}
[data-theme="light"] .hljs-params, [data-theme="light"] .hljs-variable, [data-theme="light"] .hljs-class .hljs-title {
    color: #e36209 !important;
}
.hljs-function, .hljs-subst {
    color: #c9d1d9 !important;
}
[data-theme="light"] .hljs-function, [data-theme="light"] .hljs-subst {
    color: #24292e !important;
}
.message-body { max-width: 100%; }
.message-body p { margin: 0 0 10px; }
.message-body p:last-child { margin-bottom: 0; }
.message-body ul, .message-body ol { margin: 8px 0 12px 24px; }
.message-body li { margin: 4px 0; }
.message-body table { width: 100%; border-collapse: collapse; margin: 12px 0; border-radius: 8px; overflow: hidden; }
.message-body th, .message-body td { border: 1px solid var(--border); padding: 9px 10px; text-align: left; vertical-align: top; }
.message-body th { background: var(--input); font-weight: 700; }
.message-body blockquote { border-left: 3px solid var(--accent); padding-left: 12px; color: var(--text-dim); margin: 10px 0; }
.generated-art { margin: 0; }
.generated-art figcaption { color: var(--text-dim); font-size: 12px; line-height: 1.4; margin-top: 8px; }
.message-actions, .user-message-actions { display: flex; align-items: center; gap: 6px; margin-top: 6px; color: var(--text-dim); }
.user-message-actions { justify-content: flex-end; }
.mini-action-btn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--text-dim); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: all 0.2s; }
.mini-action-btn:hover, .mini-action-btn.active { background: var(--input); color: var(--text); border-color: var(--border); }
.mini-action-btn.danger, .mini-action-btn.active.danger { color: #ef4444; }
.mini-action-btn.success, .mini-action-btn.active.success { color: #10b981; }

.inline-editor {
    background: var(--input);
    border-radius: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    margin-top: 5px;
}
.inline-edit-textarea {
    width: 100%;
    min-height: 80px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 10px;
    font-family: inherit;
    font-size: 14px;
    resize: none;
    outline: none;
}
.inline-edit-textarea:focus {
    border-color: #6366f1;
}
.inline-edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 10px;
}
.btn-save-edit, .btn-cancel-edit {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
}
.btn-save-edit {
    background: #6366f1;
    color: white;
}
.btn-save-edit:hover {
    background: #4f46e5;
}
.btn-cancel-edit {
    background: transparent;
    color: var(--text-dim);
}
.btn-cancel-edit:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}
.message-download { position: relative; }
.download-menu { position: absolute; bottom: 34px; right: 0; width: 120px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 24px rgba(0,0,0,0.35); padding: 6px; z-index: 20; }
.download-menu.hidden { display: none; }
.download-menu button { display: block; width: 100%; text-align: left; background: none; border: none; color: var(--text); padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 13px; }
.download-menu button:hover { background: var(--input); }
.attachment-pill { display: inline-flex; align-items: center; gap: 8px; background: rgba(99, 102, 241, 0.14); color: var(--text); border: 1px solid var(--border); border-radius: 999px; padding: 6px 10px; font-size: 12px; margin: 2px 0 6px; }

/* Input Hub */
.input-area { padding: 0 40px 30px; }
.img-preview-box { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--input); border-radius: 16px 16px 0 0; border: 1px solid var(--border); border-bottom: none; width: fit-content; animation: fadeIn 0.3s ease; }
.img-preview-box img { max-height: 50px; border-radius: 6px; }
.img-preview-box button { background: rgba(239, 68, 68, 0.1); color: #ef4444; border: none; width: 28px; height: 28px; border-radius: 50%; cursor: pointer; margin-left: 15px;}
.attachment-preview-box { align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; background: rgba(255, 255, 255, 0.05); border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.1); margin-bottom: 10px; width: fit-content; max-width: 100%; color: var(--text); font-size: 13px; animation: fadeIn 0.3s ease; }
.attachment-preview-box span { display: flex; align-items: center; gap: 8px; min-width: 0; }
.attachment-preview-box strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.attachment-preview-box button { background: rgba(255, 255, 255, 0.05); color: var(--text-dim); border: none; width: 24px; height: 24px; border-radius: 50%; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; justify-content: center; }
.attachment-preview-box button:hover { background: rgba(239, 68, 68, 0.2); color: #ef4444; }
[data-theme="light"] .attachment-preview-box { background: rgba(0, 0, 0, 0.03); border: 1px solid rgba(0, 0, 0, 0.08); }
[data-theme="light"] .attachment-preview-box button { background: rgba(0, 0, 0, 0.05); }
.input-area.read-only .engine-toggle-container, .input-area.read-only .art-options, .input-area.read-only .input-wrapper, .input-area.read-only .img-preview-box, .input-area.read-only .attachment-preview-box { display: none !important; }
.engine-toggle-container { display: flex; gap: 10px; margin-bottom: 12px; justify-content: center; }
.mode-btn { background: rgba(255,255,255,0.03); border: 1px solid var(--border); color: var(--text-dim); padding: 8px 16px; border-radius: 20px; font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.3s ease; display: flex; align-items: center; gap: 8px; }
.mode-btn:hover { background: var(--input); color: var(--text); }
.mode-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3); }
.art-options { display: flex; align-items: center; justify-content: center; gap: 8px; margin: -2px 0 12px; }
.art-options.hidden { display: none; }
.art-options select { background: var(--input); color: var(--text); border: 1px solid var(--border); border-radius: 9px; padding: 7px 10px; font: inherit; font-size: 12px; outline: none; cursor: pointer; }
.input-wrapper { background: var(--card); border-radius: 20px; padding: 12px 20px; border: 1px solid var(--border); box-shadow: 0 10px 30px -15px rgba(0,0,0,0.3); transition: all 0.3s ease; }
.input-wrapper:focus-within { border-color: var(--accent); box-shadow: 0 10px 40px -10px rgba(99, 102, 241, 0.15); }
.input-row { display: flex; align-items: flex-end; gap: 12px; }
.input-icon { font-size: 20px; color: var(--text-dim); background: none; border: none; cursor: pointer; padding: 10px 5px; transition: color 0.2s; display: flex; align-items: center; }
.input-icon:hover { color: var(--accent); }
.mic-active { color: #ef4444 !important; animation: pulseMic 1.5s infinite; }
textarea { flex: 1; background: transparent; border: none; color: var(--text); padding: 10px 0; font-size: 15px; outline: none; resize: none; font-family: inherit; line-height: 1.5; max-height: 200px; overflow-y: auto; overflow-wrap: anywhere; word-break: break-word; }
.send-button { background: var(--accent); color: #fff; border: none; width: 40px; height: 40px; border-radius: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform 0.2s ease, background 0.2s; margin-bottom: 2px; }
.send-button:hover { background: var(--accent-hover); transform: scale(1.05); }

/* Hero Section & Typing */
.welcome-hero { text-align: center; margin-top: 15vh; animation: fadeIn 0.8s ease; }
.hero-logo { font-size: 48px; color: var(--accent); margin-bottom: 24px; animation: floatLogo 4s ease-in-out infinite; }
.shimmer-text { font-size: 48px; font-weight: 700; letter-spacing: 0; margin-bottom: 12px; background: linear-gradient(135deg, #fff, #a1a1aa); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
[data-theme="light"] .shimmer-text { background: linear-gradient(135deg, #18181b, #71717a); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.welcome-hero p { color: var(--text-dim); font-size: 16px; }
.legal-text { font-size: 12px; color: var(--text-dim); text-align: center; margin-top: 16px; font-weight: 500; }
.typing-indicator { display: inline-flex; align-items: center; gap: 5px; padding: 8px 4px; }
.typing-indicator span { width: 8px; height: 8px; background-color: var(--accent); border-radius: 50%; animation: bounce 1.4s infinite ease-in-out both; }
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

/* Image gallery and lightbox styles removed for text-only build */

/* Toast Notifications */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { background: var(--card); color: var(--text); padding: 12px 20px; border-radius: 8px; border-left: 4px solid var(--accent); box-shadow: 0 5px 15px rgba(0,0,0,0.3); animation: slideInRight 0.3s ease, fadeOut 0.3s ease 2.7s forwards; font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 10px; pointer-events: auto; }
.toast.success { border-left-color: #10b981; }
.toast.error { border-left-color: #ef4444; }

/* NEW: Developer Portal Styles */
.portal-card { max-width: 500px; padding: 30px; }
.portal-tabs { display: flex; gap: 10px; margin-bottom: 20px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.tab-btn { flex: 1; background: none; border: none; color: var(--text-dim); font-size: 14px; font-weight: 600; padding: 10px; cursor: pointer; border-radius: 8px; transition: all 0.2s; }
.tab-btn:hover { background: var(--input); color: var(--text); }
.tab-btn.active { background: var(--accent); color: white; }
.tab-pane { display: none; text-align: center; animation: fadeIn 0.3s ease; }
.tab-pane.active { display: block; }
.role-badge { display: inline-block; background: rgba(99, 102, 241, 0.15); color: var(--accent); padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: bold; margin-top: 5px; }
.qr-container { background: white; padding: 15px; border-radius: 12px; display: inline-block; box-shadow: 0 10px 25px rgba(0,0,0,0.2); }
.qr-container img { width: 180px; height: 180px; object-fit: contain; border-radius: 8px; }

#mobile-sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 90; display: none; opacity: 0; transition: opacity 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideInUp { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDownFade { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes floatLogo { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes bounce { 0%, 80%, 100% { transform: scale(0); opacity: 0.3; } 40% { transform: scale(1); opacity: 1; } }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; visibility: hidden; } }
@keyframes pulseMic { 0% { transform: scale(1); } 50% { transform: scale(1.1); } 100% { transform: scale(1); } }
@media (max-width: 768px) {
    .sidebar { position: fixed; left: 0; top: 0; height: 100vh; transform: translateX(-100%); }
    .sidebar.mobile-open { transform: translateX(0); box-shadow: 10px 0 30px rgba(0,0,0,0.5); }
    .mobile-toggle { display: block; margin-right: 15px; }
    .mobile-close-btn { display: block; }
    .chat-viewport, .input-area { padding-left: 20px; padding-right: 20px; }
    .shimmer-text { font-size: 32px; }
    .top-nav { padding: 0 14px; }
    .engine-badge { max-width: 126px; overflow: hidden; white-space: nowrap; }
    .model-dropdown, .persona-dropdown { right: 0; width: min(280px, calc(100vw - 28px)); }
    .message-body table { display: block; overflow-x: auto; }
}

/* Model Dropdown Styles */
#model-selector-btn { border: 1px solid transparent; transition: all 0.2s; }
#model-selector-btn:hover { background: rgba(99, 102, 241, 0.2); border-color: rgba(99, 102, 241, 0.3); }
.model-dropdown { position: absolute; top: 45px; right: 0; background: var(--card); border: 1px solid var(--border); border-radius: 16px; width: 280px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); z-index: 1000; overflow: hidden; animation: slideDownFade 0.2s ease; }
.persona-dropdown { right: 165px; }
.model-dropdown.hidden { display: none; }
.model-option { padding: 12px 16px; cursor: pointer; border-bottom: 1px solid var(--border); transition: background 0.2s; }
.model-option:last-child { border-bottom: none; }
.model-option:hover { background: var(--input); }
.model-option.active { background: rgba(99, 102, 241, 0.1); }
.model-title { font-size: 14px; font-weight: 600; color: var(--text); display: flex; align-items: center; justify-content: space-between; }
.model-tag { font-size: 10px; background: var(--input); padding: 2px 6px; border-radius: 4px; color: var(--text-dim); }
.model-tag.pro { background: var(--accent); color: white; }
.model-desc { font-size: 12px; color: var(--text-dim); margin-top: 4px; line-height: 1.4; }

@media (max-width: 768px) {
    .persona-dropdown { right: 0; }
}

/* General Modal Layout Styles */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    margin: 0;
    font-size: 24px;
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 24px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.modal-close-btn:hover {
    color: var(--text);
}


    margin-top: 50px;
}

/* Sidebar Search */
.sidebar-search {
    position: relative;
    margin: 10px 0 0;
    display: flex;
    align-items: center;
}

.sidebar-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    font-size: 13px;
    pointer-events: none;
}

.sidebar-search input {
    width: 100%;
    background: var(--input);
    color: var(--text);
    border: 1px solid transparent;
    padding: 10px 12px 10px 36px;
    border-radius: 12px;
    outline: none;
    font-size: 13px;
    font-family: inherit;
    transition: all 0.2s ease;
}

.sidebar-search input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Voice Waveform Animation */
.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: #16161f;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    white-space: normal;
}

.voice-waveform {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    height: 30px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.voice-waveform.hidden {
    display: none;
}

.voice-waveform .bar {
    width: 3px;
    height: 8px;
    background: var(--accent);
    border-radius: 2px;
    animation: bounceWave 0.8s infinite ease-in-out alternate;
}

.voice-waveform .bar:nth-child(2) {
    animation-delay: 0.15s;
    height: 14px;
}

.voice-waveform .bar:nth-child(3) {
    animation-delay: 0.3s;
    height: 20px;
}

.voice-waveform .bar:nth-child(4) {
    animation-delay: 0.45s;
    height: 12px;
}

.voice-waveform .bar:nth-child(5) {
    animation-delay: 0.6s;
    height: 6px;
}

@keyframes bounceWave {
    from {
        transform: scaleY(1);
    }
    to {
        transform: scaleY(2.2);
    }
}

/* Gutter Line Numbers Layout */
.code-block-wrapper {
    display: flex;
    background: #0e0e12;
}

.code-gutter {
    display: flex;
    flex-direction: column;
    text-align: right;
    padding: 18px 0 18px 16px;
    color: #4b5563;
    font-family: 'Fira Code', 'JetBrains Mono', monospace;
    font-size: 13.5px;
    line-height: 1.6;
    user-select: none;
    background: #0b0b0e;
    border-right: 1px solid rgba(255, 255, 255, 0.03);
    min-width: 40px;
}

.code-gutter span {
    display: block;
    height: 21.6px; /* Explicit line match: 13.5px * 1.6 */
}

/* ==========================================
   PHASE 2: SETTINGS MODAL & UI IMPROVEMENTS
   ========================================== */

/* Settings Modal & Card */
.settings-card {
    max-width: 460px;
    padding: 30px;
}

.settings-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 15px;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.setting-row.column {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

.setting-row:last-child {
    border-bottom: none;
}

.setting-info {
    flex: 1;
    text-align: left;
}

.setting-title {
    display: block;
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.setting-desc {
    display: block;
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.4;
}

.settings-btn {
    background: var(--input);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.settings-btn:hover {
    background: var(--border);
    border-color: var(--accent);
}

.style-selector-buttons {
    display: flex;
    gap: 10px;
    width: 100%;
}

.settings-style-btn {
    flex: 1;
    background: var(--input);
    color: var(--text-dim);
    border: 1px solid var(--border);
    padding: 12px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.settings-style-btn:hover {
    background: var(--border);
    color: var(--text);
}

.settings-style-btn.active {
    background: var(--accent) !important;
    color: #fff !important;
    border-color: var(--accent) !important;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

/* Ambient Glows */
.app-shell::before {
    content: '';
    position: absolute;
    top: -15%;
    left: -15%;
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    transition: opacity 0.5s ease, background 0.5s ease;
    opacity: 0;
}

.app-shell::after {
    content: '';
    position: absolute;
    bottom: -15%;
    right: -15%;
    width: 70%;
    height: 70%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.06) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    transition: opacity 0.5s ease, background 0.5s ease;
    opacity: 0;
}

 .app-shell::before,
 .app-shell::after {
    opacity: 1;
}

[data-theme="light"] .app-shell::before {
    background: radial-gradient(circle, rgba(99, 102, 241, 0.04) 0%, transparent 70%);
}

[data-theme="light"] .app-shell::after {
    background: radial-gradient(circle, rgba(139, 92, 246, 0.03) 0%, transparent 70%);
}

/* Ensure main containers stack properly over ambient glows */
.sidebar, .main-workspace {
    position: relative;
    z-index: 2;
}

/* Custom Scrollbars for Studio UI style */
 ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
 ::-webkit-scrollbar-track {
    background: transparent;
}
 ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 99px;
}
 ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.15);
}

/* Studio Glassmorphic Styles */
 {
    --bg: #070709;
}

 .main-workspace {
    background: transparent;
}

 .sidebar {
    background: rgba(24, 24, 27, 0.45);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .sidebar {
    background: rgba(244, 244, 245, 0.55);
    border-right: 1px solid rgba(0, 0, 0, 0.05);
}

 .input-wrapper {
    background: rgba(24, 24, 27, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .input-wrapper {
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

 .auth-glass-card {
    background: rgba(24, 24, 27, 0.65);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .auth-glass-card {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

 .model-dropdown {
    background: rgba(24, 24, 27, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .model-dropdown {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

/* Prompt Starters Grid */
.prompt-starters-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    max-width: 640px;
    margin: 32px auto 0;
    padding: 0 10px;
    animation: slideInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.prompt-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    text-align: left;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.prompt-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.12);
}

[data-theme="light"] .prompt-card {
    background: rgba(0, 0, 0, 0.01);
}

[data-theme="light"] .prompt-card:hover {
    background: rgba(0, 0, 0, 0.03);
}

.prompt-card .card-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.prompt-card:hover .card-icon {
    background: var(--accent);
    color: white;
}

.prompt-card .card-text h4 {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}

.prompt-card .card-text p {
    font-size: 11.5px;
    color: var(--text-dim);
    margin: 0;
}

@media (max-width: 600px) {
    .prompt-starters-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

/* User Bubble & AI Message Spring Animations */
 .message.user-msg {
    animation: springBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

 .message.ai-msg {
    animation: springBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes springBounce {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.96);
    }
    60% {
        transform: translateY(-2px) scale(1.008);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Smooth Dropdown Opening Transitions */
.model-dropdown {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    visibility: visible;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s;
    animation: none !important; /* Disable instant keyframes key */
}

.model-dropdown.hidden {
    display: block !important; /* Keep in layout to allow transition */
    opacity: 0 !important;
    transform: translateY(10px) scale(0.95) !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

[data-ui-style="classic"] .model-dropdown {
    transition: none !important;
}

/* Guest Notice Sidebar Box */
.guest-notice-box {
    text-align: center;
    padding: 24px 16px;
    border: 1px dashed var(--border);
    border-radius: 16px;
    margin: 16px 8px;
    background: rgba(255, 255, 255, 0.01);
}

.guest-notice-box i {
    font-size: 20px;
    color: var(--accent);
    margin-bottom: 10px;
    display: block;
}

.guest-notice-box h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.guest-notice-box p {
    font-size: 11.5px;
    color: var(--text-dim);
    line-height: 1.45;
    margin-bottom: 14px;
}

.guest-signin-link {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s;
    font-family: inherit;
}

.guest-signin-link:hover {
    color: var(--accent-hover);
}

/* Message Time Display */
.message-time {
    font-size: 10.5px;
    color: var(--text-dim);
    font-weight: 500;
    align-self: center;
    opacity: 0.75;
}

.message-actions .message-time {
    margin-right: auto; /* Push icons to the right in flex */
    padding-left: 6px;
}

.user-message-actions .message-time {
    margin-right: auto; /* Keep time on the left in flex */
    padding-right: 8px;
}

.copy-code-btn { position: absolute; top: 8px; right: 8px; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.2); color: #e4e4e7; padding: 4px 8px; border-radius: 6px; font-size: 12px; cursor: pointer; transition: all 0.2s; z-index: 10; display: flex; align-items: center; gap: 6px; font-family: inherit; }
.copy-code-btn:hover { background: rgba(255, 255, 255, 0.2); color: #fff; }


.scroll-bottom-btn { position: absolute; bottom: 90px; right: 50%; transform: translateX(50%); background: var(--card); color: var(--text); border: 1px solid var(--border); width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,0.2); z-index: 50; transition: opacity 0.3s, transform 0.3s; }
.scroll-bottom-btn:hover { background: var(--input); }
.scroll-bottom-btn.hidden { opacity: 0; pointer-events: none; transform: translate(50%, 10px); }

