/*
 * ================================================================================
 * Vedika - GLOBAL STYLES & VARIABLES
 * Anthropic-like Clean, Professional & Responsive Design
 * ================================================================================
 */

:root {
    /* Backgrounds */
    --bg-main: #ffffff;
    --bg-sidebar: rgba(249, 250, 251, 0.92);
    --bg-user-msg: #f4f4f5;
    
    /* Text Colors */
    --text-primary: #18181b;
    --text-secondary: #52525b;
    --text-tertiary: #a1a1aa;
    
    /* Borders & Shadows */
    --border-light: rgba(0, 0, 0, 0.08);
    --border-focus: rgba(0, 0, 0, 0.15);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08);
    
    /* Brand Colors */
    --brand-color: #8b5cf6;
    --brand-gradient: linear-gradient(135deg, #8b5cf6 0%, #dc2626 100%);
    --brand-accent: #0f9e78;
    --brand-danger: #ef4444;
    --brand-warning: #f59e0b;
    --brand-success: #10b981;
    
    /* Typography */
    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-code: 'JetBrains Mono', monospace;
    
    /* Radii */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    
    /* Transitions */
    --transition-default: 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/*
 * ================================================================================
 * GLOBAL RESET & BASE STYLES
 * ================================================================================
 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Allow selection only in inputs and code */
input, textarea, [contenteditable="true"], code, pre {
    -webkit-user-select: auto !important;
    -moz-user-select: auto !important;
    -ms-user-select: auto !important;
    user-select: auto !important;
}

*:focus { 
    outline: none !important; 
    box-shadow: none !important; 
}

html, body {
    height: 100%;
    height: 100dvh;
    width: 100vw;
    font-family: var(--font-ui);
    color: var(--text-primary);
    display: flex;
    overflow: hidden;
    background: var(--bg-main);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button, a { 
    -webkit-tap-highlight-color: transparent; 
    outline: none; 
}

button { 
    background: none; 
    border: none; 
    cursor: pointer; 
    color: inherit; 
    font-family: inherit; 
}

input, textarea { 
    font-family: inherit; 
    outline: none; 
    border: none; 
    background: transparent; 
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.2); }

/*
 * ================================================================================
 * KEYFRAME ANIMATIONS
 * ================================================================================
 */
@keyframes fadeInUp { 
    from { opacity: 0; transform: translateY(12px); } 
    to { opacity: 1; transform: translateY(0); } 
}

@keyframes dropUpFade { 
    from { opacity: 0; transform: translateY(10px) scale(0.96); } 
    to { opacity: 1; transform: translateY(0) scale(1); } 
}

@keyframes modalFadeIn { 
    from { opacity: 0; transform: scale(0.96); } 
    to { opacity: 1; transform: scale(1); } 
}

@keyframes blinkCursor { 
    0%, 100% { opacity: 1; } 
    50% { opacity: 0; } 
}

@keyframes recordPulse { 
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); } 
    50% { transform: scale(1.05); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); } 
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } 
}

.blinking-cursor {
    display: inline-block; 
    width: 6px; 
    height: 18px; 
    background: var(--text-primary);
    margin-left: 2px; 
    vertical-align: text-bottom; 
    animation: blinkCursor 0.8s infinite; 
    border-radius: 2px;
}

/*
 * ================================================================================
 * SIDEBAR & NAVIGATION
 * ================================================================================
 */
.btn-menu {
    position: absolute; 
    top: 16px; 
    left: 16px; 
    z-index: 100; 
    width: 40px; 
    height: 40px;
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center;
    background: rgba(255,255,255,0.8); 
    backdrop-filter: blur(12px); 
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-light); 
    color: var(--text-secondary); 
    transition: var(--transition-default);
}

.btn-menu:hover { 
    background: #fff; 
    color: var(--text-primary); 
    border-color: var(--border-focus);
}

.sidebar {
    width: 280px; 
    background: var(--bg-sidebar); 
    backdrop-filter: blur(20px); 
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-light); 
    display: flex; 
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); 
    z-index: 110; 
    height: 100%; 
    flex-shrink: 0;
}

.sidebar.collapsed { 
    transform: translateX(-100%); 
    position: absolute; 
}

.sidebar-header { 
    padding: 20px 16px 10px; 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
}

.sidebar-logo { 
    font-weight: 600; 
    font-size: 15px; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    letter-spacing: -0.3px;
}

.btn-new-chat {
    margin: 10px 16px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 8px;
    padding: 10px; 
    border-radius: var(--radius-sm); 
    background: var(--brand-gradient);
    border: none;
    font-size: 13.5px; 
    font-weight: 500; 
    transition: var(--transition-default); 
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.btn-new-chat:hover { 
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4); 
}

.sidebar-history { 
    flex: 1; 
    overflow-y: auto; 
    padding: 10px 12px; 
    display: flex; 
    flex-direction: column; 
    gap: 2px; 
}

.history-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 4px 8px 8px; 
    margin-bottom: 4px; 
}

.history-title-text { 
    font-size: 11px; 
    font-weight: 600; 
    color: var(--text-tertiary); 
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
}

.btn-clear-all { 
    font-size: 11px; 
    font-weight: 500; 
    color: var(--text-tertiary); 
    cursor: pointer; 
    transition: 0.2s; 
    padding: 4px 8px;
    border-radius: 6px;
}

.btn-clear-all:hover { 
    color: var(--brand-danger); 
    background: rgba(239, 68, 68, 0.05);
}

.history-item {
    padding: 9px 10px; 
    border-radius: var(--radius-sm); 
    font-size: 13px; 
    font-weight: 400; 
    color: var(--text-secondary);
    cursor: pointer; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    transition: 0.15s;
}

.history-item:hover { 
    background: rgba(0,0,0,0.04); 
    color: var(--text-primary); 
}

.history-item.active { 
    background: #fff; 
    color: var(--text-primary); 
    font-weight: 500; 
    box-shadow: var(--shadow-sm); 
    border: 1px solid var(--border-light);
}

.history-text { 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    flex: 1; 
}

.btn-delete-chat { 
    background: none; 
    border: none; 
    color: var(--text-tertiary); 
    cursor: pointer; 
    padding: 4px; 
    display: none; 
    border-radius: 6px; 
}

.history-item:hover .btn-delete-chat { 
    display: flex; 
}

.btn-delete-chat:hover { 
    color: var(--brand-danger); 
    background: #fee2e2; 
}

.sidebar-footer { 
    padding: 16px; 
    border-top: 1px solid var(--border-light); 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    flex-wrap: wrap; 
}

.user-avatar { 
    width: 34px; 
    height: 34px; 
    border-radius: 50%; 
    background: var(--text-primary); 
    color: #fff; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 13px; 
    font-weight: 600; 
    flex-shrink: 0; 
}

.user-info-box { 
    flex: 1; 
    overflow: hidden; 
    display: flex; 
    flex-direction: column; 
}

.user-name { 
    font-size: 13px; 
    font-weight: 600; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
}

.user-sub { 
    font-size: 11px; 
    color: var(--text-tertiary); 
    margin-top: 2px; 
}

.btn-login-register { 
    background: var(--brand-gradient);
    color: #fff; 
    border-radius: var(--radius-sm); 
    padding: 7px 12px; 
    font-size: 12px; 
    font-weight: 500; 
    cursor: pointer; 
    transition: var(--transition-default); 
    margin-left: auto; 
    border: none;
}

.btn-login-register:hover { 
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.btn-power { 
    width: 32px; 
    height: 32px; 
    border-radius: var(--radius-sm); 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    color: var(--text-secondary); 
    transition: 0.2s; 
}

.btn-power:hover { 
    background: #fee2e2; 
    color: var(--brand-danger); 
}

/*
 * ================================================================================
 * MAIN CHAT AREA
 * ================================================================================
 */
.main-area { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    position: relative; 
    transition: 0.3s; 
    height: 100%; 
    overflow: hidden; 
    z-index: 1; 
}

.chat-container { 
    flex: 1; 
    overflow-x: hidden; 
    overflow-y: auto; 
    padding: 80px 20px 200px; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    scroll-behavior: smooth; 
    background: radial-gradient(circle at 50% 50%, rgba(139, 92, 246, 0.05) 0%, rgba(139, 92, 246, 0.02) 50%, transparent 70%);
}

.welcome-center { 
    margin: auto; 
    text-align: center; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    animation: fadeInUp 0.6s ease; 
    width: 100%; 
    justify-content: center; 
    flex: 1; 
}

.welcome-center img { 
    width: 64px; 
    height: 64px; 
    border-radius: 16px; 
    margin-bottom: 24px; 
    object-fit: contain; 
}

.welcome-center h1 { 
    font-size: 28px; 
    font-weight: 500; 
    letter-spacing: -0.5px; 
    color: var(--text-primary); 
    margin-bottom: 8px; 
}

.welcome-center p { 
    font-size: 15px; 
    color: var(--text-secondary); 
    font-weight: 400;
}

#chatMessages { width: 100%; display: flex; flex-direction: column; align-items: center; }

.message-wrapper { 
    width: 100%; 
    max-width: 800px; 
    margin-bottom: 32px; 
    display: flex; 
    flex-direction: column; 
    animation: fadeInUp 0.3s ease; 
}

/* User Message */
.user-message {
    align-self: flex-end; 
    max-width: 85%; 
    background: var(--bg-user-msg);
    padding: 12px 18px; 
    border-radius: 18px 18px 4px 18px; 
    font-size: 15px; 
    font-weight: 400;
    line-height: 1.5; 
    color: var(--text-primary); 
    word-wrap: break-word; 
    overflow-wrap: break-word;
    border: 1px solid rgba(0,0,0,0.04);
}

/* Bot Message */
.bot-message { 
    align-self: flex-start; 
    max-width: 100%; 
    display: flex; 
    gap: 16px; 
    width: 100%; 
    box-sizing: border-box; 
    background: transparent; 
    padding: 0; 
}

.bot-avatar {
    width: 30px; 
    height: 30px; 
    border-radius: 8px; 
    flex-shrink: 0; 
    overflow: hidden;
    display: flex; 
    align-items: center; 
    justify-content: center; 
    margin-top: 4px;
    border: 1px solid var(--border-light); 
    background: #fff;
}

.bot-avatar img { width: 100%; height: 100%; object-fit: cover; }

.bot-content-wrapper { 
    flex: 1 1 0%; 
    min-width: 0; 
    max-width: calc(100% - 46px); 
    width: 100%; 
    overflow: hidden; 
}

.bot-content { 
    font-size: 15.5px; 
    line-height: 1.7; 
    color: var(--text-primary); 
    word-wrap: break-word; 
    font-weight: 400; 
    letter-spacing: 0.1px; 
}

.bot-content p { margin-bottom: 16px; }
.bot-content p:last-child { margin-bottom: 0; }
.bot-content strong { font-weight: 600; color: #000; }
.bot-content ul, .bot-content ol { padding-left: 24px; margin-bottom: 16px; }
.bot-content li { margin-bottom: 8px; }

.bot-content code { 
    font-family: var(--font-code); 
    background: rgba(0,0,0,0.06); 
    padding: 3px 6px; 
    border-radius: 6px; 
    font-size: 0.85em; 
    color: #000; 
}

.bot-content pre { 
    background: #0d1117; 
    padding: 16px; 
    border-radius: var(--radius-md); 
    overflow-x: auto; 
    margin: 16px 0; 
    border: 1px solid var(--border-light); 
    position: relative; 
}

.bot-content pre code { 
    background: none; 
    padding: 0; 
    color: #e2e8f0; 
    font-size: 13.5px; 
}

.bot-content table { 
    width: 100%; 
    border-collapse: collapse; 
    margin: 16px 0; 
    font-size: 14px; 
    border: 1px solid var(--border-light); 
    border-radius: 8px; 
    overflow: hidden; 
    display: block; 
    overflow-x: auto; 
}

.bot-content th, .bot-content td { 
    border: 1px solid var(--border-light); 
    padding: 10px 14px; 
    text-align: left; 
}

.bot-content th { 
    background: rgba(0,0,0,0.03); 
    font-weight: 500; 
}

.mjx-container { max-width: 100%; overflow-x: auto; overflow-y: hidden; }

/* KaTeX styling overrides for consistent appearance */
.katex { font-size: 1.1em; }
.katex-display { margin: 0.5em 0; overflow-x: auto; overflow-y: hidden; }
.katex .katex-html { white-space: normal; }

/* Attachments */
.chat-attachment-container { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chat-file-pill { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--border-light); padding: 8px 12px; border-radius: 10px; font-size: 12.5px; font-weight: 500; }
.chat-img-preview { max-width: 140px; max-height: 140px; border-radius: var(--radius-md); object-fit: cover; border: 1px solid var(--border-light); }

/* Thinking Box */
.qwen-think-box { border-left: 2px solid #e4e4e7; padding-left: 16px; margin-bottom: 16px; transition: 0.3s; }
.qwen-think-box summary { font-size: 12.5px; font-weight: 500; color: var(--text-tertiary); cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; user-select: none; }
.qwen-think-box summary::-webkit-details-marker { display: none; }
.qwen-think-content { margin-top: 8px; font-size: 14px; color: var(--text-secondary); font-style: italic; white-space: pre-wrap; line-height: 1.6; }

/* Message Actions */
.msg-actions { display: flex; gap: 4px; margin-top: 12px; opacity: 0; transition: 0.2s; align-items: center; }
.message-wrapper:hover .msg-actions { opacity: 1; }
@media (hover: none) { .msg-actions { opacity: 1; } }

.action-btn { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; color: var(--text-tertiary); padding: 6px 10px; border-radius: 8px; transition: 0.2s; background: transparent; }
.action-btn:hover { color: var(--text-primary); background: rgba(0,0,0,0.04); }
.action-btn.listen-btn { background: #f4f4f5; }
.action-btn.listen-btn:hover { background: #e4e4e7; }

.code-copy-btn { position: absolute; top: 8px; right: 8px; display: flex; align-items: center; gap: 4px; padding: 4px 8px; font-size: 11px; color: var(--text-secondary); background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.1); border-radius: 6px; cursor: pointer; z-index: 2; backdrop-filter: blur(4px); }
.code-copy-btn:hover { background: rgba(255,255,255,0.2); color: #fff; }
.code-copy-btn.copied { color: var(--brand-success); border-color: var(--brand-success); }

.btn-scroll-bottom { 
    position: absolute; 
    bottom: 120px; 
    left: 50%; 
    transform: translateX(-50%) translateY(20px); 
    width: 36px; 
    height: 36px; 
    border-radius: 50%; 
    background: var(--brand-gradient); 
    border: none;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
    display: flex; 
    align-items: center; 
    justify-content: center; 
    color: #fff;
    opacity: 0; 
    pointer-events: none; 
    transition: var(--transition-default); 
    z-index: 45; 
}

.btn-scroll-bottom.visible { 
    opacity: 1; 
    pointer-events: auto; 
    transform: translateX(-50%) translateY(0); 
}

.btn-scroll-bottom:hover {
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.5);
}

/*
 * ================================================================================
 * INPUT DOCK (The Core UI - Clean & Professional)
 * ================================================================================
 */
.input-dock {
    position: absolute; 
    bottom: 24px; 
    left: 50%;
    transform: translateX(-50%);
    width: 100%; 
    max-width: 800px;
    padding: 0 20px;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.input-dock-wrapper {
    position: relative; 
    width: 100%; 
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px); 
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg); 
    padding: 12px 16px;
    display: flex; 
    flex-direction: column;
    transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: var(--shadow-md);
}

/* Expanded State (No RGB Glow, just crisp shadow & border) */
.input-dock-wrapper.expanded {
    background: rgba(255, 255, 255, 0.98);
    border-color: var(--border-focus);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Focus State - Subtle Purple Glow */
.input-dock-wrapper.focused {
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15), var(--shadow-lg);
    border-color: rgba(139, 92, 246, 0.3);
}

.file-preview-bar { display: none; padding-bottom: 10px; align-items: center; gap: 8px; }
.file-preview-bar.active { display: flex; }
.file-preview-pill { display: flex; align-items: center; gap: 8px; background: #f4f4f5; padding: 6px 12px; border-radius: 10px; font-size: 12px; border: 1px solid var(--border-light); }
.file-preview-icon { width: 16px; height: 16px; object-fit: cover; border-radius: 4px; }
.file-preview-name { max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-primary); }
.btn-remove-file { width: 18px; height: 18px; border-radius: 50%; background: #e4e4e7; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.btn-remove-file:hover { background: #d4d4d8; }

.chat-input { 
    width: 100%; 
    padding: 8px 4px 12px; 
    font-size: 15px; 
    font-weight: 400; 
    resize: none; 
    color: var(--text-primary); 
    line-height: 1.5; 
    background: transparent; 
    caret-color: #000;
    min-height: 24px; 
    max-height: 200px;
    transition: min-height 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.chat-input::placeholder { color: var(--text-tertiary); font-weight: 400; }

.input-dock-wrapper.expanded .chat-input {
    min-height: 60px;
}

.input-row { display: flex; align-items: center; justify-content: space-between; width: 100%; margin-top: 4px; }

.tools-left { display: flex; gap: 2px; align-items: center; position: relative; }

.tool-btn { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--text-secondary); transition: 0.2s; background: transparent; flex-shrink: 0; }
.tool-btn:hover { background: #f4f4f5; color: var(--text-primary); }

/* Tool Active States */
.tool-btn.active { color: #fff; background: var(--brand-gradient); }

.btn-mic.recording { color: var(--brand-danger); background: #fee2e2; animation: recordPulse 1.5s infinite; }

.tools-right { display: flex; align-items: center; gap: 8px; }

.btn-send { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-gradient); color: #fff; display: flex; align-items: center; justify-content: center; transition: var(--transition-default); flex-shrink: 0; border: none; }
.btn-send:hover:not(:disabled) { transform: scale(1.08); box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4); }
.btn-send:disabled { background: #e4e4e7; color: #a1a1aa; cursor: not-allowed; }

.btn-stop { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-gradient); color: #fff; display: none; align-items: center; justify-content: center; transition: var(--transition-default); flex-shrink: 0; }
.btn-stop.active { display: flex; }
.btn-stop:hover { transform: scale(1.08); box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4); }

.hidden-input { display: none; }

/* Dropdowns */
.dropdown-menu { 
    position: absolute; 
    bottom: calc(100% + 12px); 
    left: 0; 
    background: rgba(255, 255, 255, 0.98); 
    backdrop-filter: blur(20px); 
    border: 1px solid var(--border-light); 
    border-radius: 14px; 
    padding: 6px; 
    box-shadow: var(--shadow-lg); 
    display: none; 
    flex-direction: column; 
    min-width: 200px; 
    z-index: 100; 
    transform-origin: bottom left; 
}

.dropdown-menu.active { display: flex; animation: dropUpFade 0.2s cubic-bezier(0.2, 0.8, 0.2, 1); }

.dropdown-header { padding: 8px 12px; font-size: 11px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }

.dropdown-item { padding: 9px 12px; border-radius: 8px; font-size: 13px; display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; transition: 0.15s; color: var(--text-primary); }
.dropdown-item:hover { background: #f4f4f5; }
.dropdown-item.selected { background: #f4f4f5; font-weight: 500; }

/* Model Badges */
.model-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-fast {
    background: rgba(16, 185, 129, 0.15);
    color: var(--brand-success);
}

.badge-image-only {
    background: rgba(245, 158, 11, 0.15);
    color: var(--brand-warning);
}

.badge-reasoning {
    background: rgba(139, 92, 246, 0.15);
    color: var(--brand-color);
}

/*
 * ================================================================================
 * MODALS & OVERLAYS
 * ================================================================================
 */
.mobile-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.2); backdrop-filter: blur(4px); z-index: 95; opacity: 0; transition: 0.3s ease; pointer-events: none; }
.mobile-overlay.active { display: block; opacity: 1; pointer-events: all; }

.auth-overlay { position: fixed; inset: 0; background: rgba(0,0,0, 0.3); backdrop-filter: blur(8px); display: none; align-items: center; justify-content: center; z-index: 2000; }
.auth-modal { background: #ffffff; width: 90%; max-width: 360px; border-radius: 20px; padding: 32px; box-shadow: 0 20px 50px rgba(0,0,0, 0.15); position: relative; animation: modalFadeIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); border: 1px solid var(--border-light); }
.auth-close { position: absolute; top: 16px; right: 16px; color: var(--text-tertiary); width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: #f4f4f5; transition: 0.2s; }
.auth-close:hover { background: #e4e4e7; color: var(--text-primary); }
.auth-title { font-size: 18px; font-weight: 600; margin-bottom: 24px; text-align: center; letter-spacing: -0.3px; }
.auth-tabs { display: flex; background: #f4f4f5; border-radius: 10px; padding: 4px; margin-bottom: 20px; }
.auth-tab { flex: 1; text-align: center; padding: 8px; font-size: 13px; font-weight: 500; cursor: pointer; border-radius: 8px; color: var(--text-secondary); transition: 0.2s; }
.auth-tab.active { background: #ffffff; color: #000; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.auth-input { width: 100%; padding: 12px 14px; border: 1px solid var(--border-light); border-radius: 10px; font-size: 14px; margin-bottom: 12px; background: #fcfcfc; transition: 0.2s; }
.auth-input:focus { border-color: var(--text-primary); background: #fff; }
.auth-btn { width: 100%; padding: 12px; background: var(--brand-gradient); color: #fff; font-size: 14px; font-weight: 500; border-radius: 10px; transition: var(--transition-default); }
.auth-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4); }
.auth-phase { display: none; }
.auth-phase.active { display: block; }
.auth-message { font-size: 12px; text-align: center; margin-top: 12px; min-height: 16px; }

.custom-confirm-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.3); backdrop-filter: blur(8px); display: none; align-items: center; justify-content: center; z-index: 2500; }
.custom-confirm-box { background: #fff; border-radius: 16px; padding: 24px; max-width: 300px; width: 90%; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,0.15); animation: modalFadeIn 0.2s; border: 1px solid var(--border-light); }
.custom-confirm-msg { font-size: 14px; margin-bottom: 24px; color: var(--text-primary); font-weight: 500; line-height: 1.5; }
.custom-confirm-btns { display: flex; gap: 12px; }
.custom-confirm-btn { flex: 1; padding: 10px; border-radius: 10px; font-size: 13px; font-weight: 500; transition: 0.2s; }
.custom-confirm-btn.cancel { background: #f4f4f5; color: var(--text-secondary); }
.custom-confirm-btn.cancel:hover { background: #e4e4e7; }
.custom-confirm-btn.confirm { background: var(--brand-gradient); color: #fff; }
.custom-confirm-btn.confirm:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4); }

/*
 * ================================================================================
 * RESPONSIVE DESIGN
 * ================================================================================
 */
@media (max-width: 900px) {
    .sidebar { position: fixed; left: 0; top: 0; box-shadow: 4px 0 24px rgba(0,0,0,0.05); }
    .sidebar.collapsed { box-shadow: none; }
    .input-dock { padding: 10px 16px calc(16px + env(safe-area-inset-bottom)); bottom: 0; }
    .chat-container { padding: 70px 16px 180px; }
    .user-message { max-width: 90%; }
}

@media (max-width: 600px) {
    .code-copy-btn span { display: none; }
    .welcome-center img { width: 56px; height: 56px; }
    .welcome-center h1 { font-size: 24px; }
    .tool-btn, .btn-send, .btn-stop { width: 36px; height: 36px; }
    .input-dock-wrapper.expanded .chat-input { min-height: 50px; }
    
    /* Prevents iOS zoom on focus */
    .chat-input { font-size: 16px; } 
}
