/* css/home.css */
@font-face {
    font-family: 'Share Tech';
    src: url('../font/ShareTech-Regular.ttf') format('truetype');
}

html {
    font-size: var(--app-font-size, 16px);
}

html, body, button, input, textarea, select, h1, h2, h3, h4, h5, h6, .chat-area, .message-content-wrapper, .message-bubble, .header-title, .chat-item {
    font-family: var(--app-font-family, 'Inter', 'Outfit', sans-serif);
}

body {
    font-size: var(--app-font-size, 16px);
}
* { margin: 0; padding: 0; box-sizing: border-box; }

/* ─── REDESIGNED AUTH OVERLAY MODAL ───────────────────────── */
.auth-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(4, 5, 10, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    overflow-y: auto;
    padding: 1.5rem;
}

body.light .auth-overlay {
    background: rgba(200, 205, 220, 0.7);
}

.auth-card-modal {
    display: flex;
    width: 100%;
    max-width: 980px;
    min-height: 620px;
    background: #12141a;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.75), 0 0 50px rgba(102, 126, 234, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    transition: all 0.3s ease;
}

body.light .auth-card-modal {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
}

/* ── LEFT PANEL (ILLUSTRATION & BRAND) ── */
.auth-left-panel {
    width: 400px;
    flex-shrink: 0;
    background: linear-gradient(145deg, #0e101a 0%, #1a1d30 100%);
    border-radius: 28px 0 0 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3.5rem 2.8rem;
    position: relative;
    overflow: hidden;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

body.light .auth-left-panel {
    background: linear-gradient(145deg, #5b73e8 0%, #3e56d4 100%);
    border-right-color: rgba(0, 0, 0, 0.05);
}

.auth-left-inner {
    text-align: center;
    position: relative;
    z-index: 2;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Circular Graphic Illustration Frame */
.auth-illustration-circle {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.25) 0%, rgba(255, 255, 255, 0.03) 70%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    position: relative;
    box-shadow: 0 0 35px rgba(102, 126, 234, 0.3);
}

body.light .auth-illustration-circle {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.auth-circle-logo {
    width: 90px;
    height: 90px;
    object-fit: contain;
    filter: drop-shadow(0 0 20px rgba(102, 126, 234, 0.8));
    animation: authLogoFloat 4s ease-in-out infinite alternate;
}

@keyframes authLogoFloat {
    0% { transform: translateY(0); }
    100% { transform: translateY(-8px); }
}

.auth-left-title {
    font-size: 2.1rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.8rem;
    letter-spacing: -0.01em;
}

.auth-left-sub {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.6;
}

body.light .auth-left-sub {
    color: rgba(255, 255, 255, 0.88);
}

/* ── RIGHT PANEL (FORM) ── */
.auth-right-panel {
    flex: 1;
    background: #14161d;
    border-radius: 0 28px 28px 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow-y: auto;
}

body.light .auth-right-panel {
    background: #ffffff;
}

.auth-right-scroll {
    width: 100%;
    padding: 3.5rem 4rem;
    display: flex;
    flex-direction: column;
}

/* Top Pill Badge & Home Button Row */
.auth-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 1.8rem;
}

.auth-top-badge {
    background: var(--accent-color, #667eea);
    color: #ffffff;
    padding: 8px 24px;
    border-radius: 30px;
    font-size: 0.88rem;
    font-weight: 600;
    display: inline-block;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.35);
    letter-spacing: 0.01em;
}

.auth-home-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #ffffff;
    padding: 8px 18px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.25s ease;
}

.auth-home-btn:hover {
    background: rgba(102, 126, 234, 0.25);
    border-color: rgba(102, 126, 234, 0.5);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

body.light .auth-home-btn {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.12);
    color: #1a1a1a;
}

.auth-right-heading {
    font-size: 1.65rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 1.6rem;
    letter-spacing: -0.01em;
}

body.light .auth-right-heading {
    color: #1a1a1a;
}

/* Form inputs & buttons */
.auth-form-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-label {
    font-size: 0.88rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
}

body.light .auth-label {
    color: rgba(0, 0, 0, 0.65);
}

.auth-input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    background: rgba(255, 255, 255, 0.04);
    color: #ffffff;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: all 0.2s ease;
}

body.light .auth-input {
    background: #f7f8fa;
    border-color: rgba(0, 0, 0, 0.1);
    color: #111;
}

.auth-input:focus {
    border-color: var(--accent-color, #667eea);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.18);
    background: rgba(255, 255, 255, 0.06);
}

.auth-hint {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.38);
    margin: 0;
}

body.light .auth-hint { color: rgba(0, 0, 0, 0.4); }

.auth-btn-row {
    margin-top: 12px;
    display: flex;
    justify-content: center;
    width: 100%;
}

.auth-btn-primary {
    min-width: 200px;
    padding: 13px 55px;
    border-radius: 50px;
    border: none;
    background: var(--accent-color, #667eea);
    color: #ffffff;
    font-size: 1.05rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    text-align: center;
}

.auth-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.45);
    opacity: 0.96;
}

.auth-btn-google {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.92rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s ease;
}

.auth-btn-google:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.2);
}

body.light .auth-btn-google {
    background: #f7f8fa;
    border-color: rgba(0, 0, 0, 0.1);
    color: #333;
}

.auth-or {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.82rem;
    margin: 4px 0;
}

body.light .auth-or { color: rgba(0, 0, 0, 0.3); }

.auth-or::before, .auth-or::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

body.light .auth-or::before,
body.light .auth-or::after {
    background: rgba(0, 0, 0, 0.1);
}

.auth-links-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
}

.auth-switch-link {
    background: transparent;
    border: none;
    color: var(--accent-color, #667eea);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    padding: 0;
    transition: opacity 0.2s;
}

.auth-switch-link:hover {
    text-decoration: underline;
    opacity: 0.9;
}

.auth-otp-info {
    text-align: center;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.6;
    margin-bottom: 6px;
}

body.light .auth-otp-info { color: rgba(0, 0, 0, 0.6); }

.auth-otp-input {
    text-align: center;
    letter-spacing: 8px;
    font-size: 1.4rem;
    font-weight: 700;
}

.auth-feedback {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 500;
    text-align: center;
    margin-bottom: 10px;
}

.auth-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ff7070;
}

.auth-success {
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #4ade80;
}

@media (max-width: 780px) {
    .auth-card-modal {
        flex-direction: column;
        max-width: 480px;
        min-height: auto;
    }
    .auth-left-panel {
        width: 100%;
        border-radius: 28px 28px 0 0;
        padding: 2rem 1.5rem;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }
    .auth-illustration-circle {
        width: 120px;
        height: 120px;
        margin-bottom: 1rem;
    }
    .auth-circle-logo {
        width: 60px;
        height: 60px;
    }
    .auth-right-panel {
        border-radius: 0 0 28px 28px;
    }
    .auth-right-scroll {
        padding: 2rem;
    }
}
/* ─── END REDESIGNED AUTH OVERLAY MODAL ─────────────────────── */


:root {
    --bg-base: #0A0A0A;
    --glass-panel: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-blur: blur(12px);
    --accent-color: #667eea;
    --text-primary: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.6);
}

body {
    background: var(--bg-base);
    color: var(--text-primary);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    font-size: 16px;
}

body.light { 
    --bg-base: #F0F2F5;
    --glass-panel: #ffffff;
    --glass-border: rgba(0, 0, 0, 0.08);
    --text-primary: #1A1A1A;
    --text-muted: rgba(0, 0, 0, 0.6);
    background: #F0F2F5; color: #1A1A1A; 
}

.container { 
    display: flex; 
    height: 100%;
    position: relative; 
    background: var(--bg-base);
    overflow: hidden;
}

.container.zen-mode .sidebar { display: none; }
.container.zen-mode .header { display: none; }

.sidebar {
    width: 280px; 
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--glass-border);
    display: flex; flex-direction: column; 
    transition: transform 0.3s ease; z-index: 100; flex-shrink: 0;
}
body.light .sidebar { background: rgba(255, 255, 255, 0.8); border-right: 1px solid rgba(0,0,0,0.05); }

@media (min-width: 769px) {
    .sidebar.hidden { transform: translateX(-100%); margin-right: -280px; }
}

.sidebar-header { padding: 20px; display: flex; gap: 10px; flex-direction: column; }
.sidebar-header-row { display: flex; gap: 10px; }

.new-chat-btn {
    flex: 1; padding: 12px; 
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border); 
    border-radius: 12px;
    color: var(--text-primary); font-family: inherit; font-size: 0.95rem; font-weight: 600;
    cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px; 
    transition: all 0.2s;
}
.sidebar-action-btn {
     width: 46px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--glass-border); 
     border-radius: 12px; color: var(--text-primary); cursor: pointer; transition: all 0.2s; 
     display: flex; align-items: center; justify-content: center;
}

body.light .new-chat-btn, body.light .sidebar-action-btn { 
    background: white; border-color: rgba(0,0,0,0.1); color: #000; box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.new-chat-btn:hover, .sidebar-action-btn:hover { background: rgba(255, 255, 255, 0.1); }
body.light .new-chat-btn:hover, body.light .sidebar-action-btn:hover { background: #f8f9fa; }

.temp-chat-btn { border-style: dashed; opacity: 0.8; }
.temp-chat-btn:hover { opacity: 1; border-style: solid; }

.section-label {
    padding: 15px 12px 8px; font-size: 0.75rem; color: var(--text-muted); 
    font-weight: 600; text-transform: uppercase; letter-spacing: 1px;
}

.chats-list { flex: 1; overflow-y: auto; padding: 0 10px; }
.chats-list::-webkit-scrollbar { width: 4px; }
.chats-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.chat-item {
    padding: 12px 14px; margin-bottom: 6px; border-radius: 10px; cursor: pointer;
    transition: all 0.2s; position: relative; display: flex; align-items: center;
    gap: 12px; font-size: 0.9rem; color: var(--text-muted);
}
.chat-item:hover { background: rgba(255, 255, 255, 0.05); color: var(--text-primary); }
body.light .chat-item:hover { background: rgba(0,0,0,0.05); }
.chat-item.active { 
    background: rgba(102, 126, 234, 0.15); 
    color: var(--text-primary); 
    border: 1px solid rgba(102, 126, 234, 0.3);
}
body.light .chat-item.active { background: #fff; border-color: var(--accent-color); color: var(--accent-color); box-shadow: 0 2px 8px rgba(0,0,0,0.05); }

.chat-item-title { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.chat-menu-btn {
    background: transparent; border: none; color: inherit; opacity: 0;
    padding: 6px; border-radius: 4px; cursor: pointer; transition: opacity 0.2s; font-size: 1rem;
}
.chat-item:hover .chat-menu-btn { opacity: 1; }
.chat-item.active .chat-menu-btn { opacity: 1; }
.chat-menu-btn:hover { background: rgba(255,255,255,0.2); }

.popover-menu {
    position: absolute; 
    background: #0A0A0A; 
    border: 1px solid var(--glass-border);
    border-radius: 12px; padding: 6px; z-index: 200; display: none;
    min-width: 160px; box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
body.light .popover-menu { background: white; border-color: rgba(0,0,0,0.1); box-shadow: 0 8px 32px rgba(0,0,0,0.1); }
.popover-menu.active { display: block; animation: fadeIn 0.2s; }
.popover-item {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 10px 14px; text-align: left;
    background: transparent; border: none; color: inherit;
    cursor: pointer; font-size: 0.9rem; border-radius: 8px; font-family: inherit;
}
.popover-item:hover { background: rgba(255,255,255,0.1); }
body.light .popover-item:hover { background: rgba(0,0,0,0.05); }

.sidebar-footer {
    display: flex;
    flex-direction: row !important;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    gap: 12px;
}

.profile-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.profile-actions {
    display: flex;
    flex-direction: row;
    gap: 8px;
    flex-shrink: 0;
}
.profile-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100px; }
.profile-engine { font-size: 0.75rem; opacity: 0.7; cursor: pointer; }
.profile-engine:hover { text-decoration: underline; color: var(--accent-color); }

.profile-actions button {
    padding: 8px; background: transparent; border: none; cursor: pointer;
    color: var(--text-muted); font-size: 1.1rem; border-radius: 50%; width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
}
.profile-actions button:hover { background: rgba(255, 255, 255, 0.1); color: var(--text-primary); }

.main-content { 
    flex: 1; display: flex; flex-direction: column; background: var(--bg-base); width: 100%; position: relative; overflow: hidden;
}

.chat-main-container {
    flex: 1;
    display: flex;
    flex-direction: row;
    width: 100%;
    min-height: 0;
    position: relative;
    overflow: hidden;
}

/* Central Deep Ambient Glow (matching Gemini design) */
.chat-main-container::before {
    content: '';
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 850px;
    height: 550px;
    max-width: 100vw;
    background: radial-gradient(ellipse at center, rgba(30, 48, 105, 0.4) 0%, rgba(16, 22, 48, 0.18) 45%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.main-content.is-empty-state .chat-main-container::before {
    opacity: 1;
}

body.light .chat-main-container::before {
    background: radial-gradient(ellipse at center, rgba(102, 126, 234, 0.22) 0%, rgba(180, 200, 255, 0.08) 50%, transparent 75%);
}

.main-content.is-empty-state .chat-main-container {
    flex: 1;
    width: 100%;
    position: relative;
}

.main-content.is-empty-state .chat-area {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.main-content.is-empty-state .empty-state {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.main-content.is-empty-state .empty-state h2 {
    position: absolute;
    top: calc(50% - 80px);
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.2rem;
    font-weight: 500;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
    text-align: center;
    z-index: 5;
}

.main-content.is-empty-state .input-area {
    position: absolute;
    bottom: calc(50% - 90px);
    top: auto;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 760px;
    padding: 0 20px;
    z-index: 5;
}

.header {
    padding: 16px 24px; 
    border-bottom: 1px solid var(--glass-border); 
    display: flex; align-items: center; justify-content: space-between;
    background: rgba(10, 10, 10, 0.6);
    backdrop-filter: blur(5px);
    width: 100%;
}
body.light .header { background: rgba(255, 255, 255, 0.6); border-bottom-color: rgba(0,0,0,0.05); }

.header-left { display: flex; align-items: center; gap: 12px; }
.header-right { display: flex; align-items: center; gap: 8px; }

.icon-btn {
    background: transparent; border: none; color: var(--text-muted); font-size: 1.2rem;
    cursor: pointer; padding: 8px; border-radius: 8px; transition: all 0.2s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.1); color: var(--text-primary); }
body.light .icon-btn:hover { background: rgba(0,0,0,0.05); }

.header-title { font-size: 1.1rem; font-weight: 600; color: var(--text-primary); }

.chat-area { 
    flex: 1; 
    overflow-y: auto; 
    overflow-x: hidden;
    display: flex; 
    flex-direction: column; 
    padding: 24px 0; 
    gap: 30px; 
    padding-bottom: 20px;
    min-height: 0;
    position: relative;
    z-index: 2;
}

.empty-state {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    justify-content: center; text-align: center; z-index: 2;
}
.empty-state h2 { 
    font-size: clamp(2rem, 4vw, 2.6rem); 
    margin-bottom: 0; 
    font-weight: 400; 
    color: var(--text-primary, rgba(255, 255, 255, 0.95)); 
    letter-spacing: -0.015em;
    font-family: inherit;
}
body.light .empty-state h2 { color: #1a1a1a; }
.empty-state p { color: var(--text-muted); font-size: 1.1rem; max-width: 400px; margin-top: 8px; }

.message-row {
    display: flex; width: 100%; flex-direction: column; padding: 0 10%;
}
@media (max-width: 1024px) { .message-row { padding: 0 5%; } }

.message-row:hover .message-actions { opacity: 1; }

.message-container { display: flex; width: 100%; }
.message-content-wrapper { max-width: 90%; position: relative; }

.message-bubble {
    padding: 20px 24px; border-radius: 18px; line-height: 1.6;
    word-wrap: break-word; font-size: 1.05rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.message-row.assistant .message-container { justify-content: flex-start; }
.message-row.assistant .message-bubble {
    background: rgba(255, 255, 255, 0.05); 
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(5px);
    color: var(--text-primary);
    border-top-left-radius: 4px;
}
body.light .message-row.assistant .message-bubble { 
    background: white; border-color: rgba(0,0,0,0.05); color: #000; box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.message-row.user .message-container { justify-content: flex-end; }
.message-row.user .message-bubble {
    background: var(--accent-color); 
    color: #fff; 
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.message-actions {
    display: flex; gap: 8px; margin-top: 8px; opacity: 0; transition: opacity 0.2s;
    font-size: 0.9rem; color: var(--text-muted);
}
@media (max-width: 768px) { .message-actions { opacity: 1; } }

.message-row.user .message-actions { justify-content: flex-end; padding-right: 4px; }
.message-row.assistant .message-actions { justify-content: flex-start; padding-left: 0; }

.action-btn {
    background: rgba(255,255,255,0.05); border: 1px solid transparent; 
    color: inherit; cursor: pointer;
    padding: 6px 10px; border-radius: 8px; display: flex; align-items: center; gap: 4px;
    font-size: 0.9rem;
}
.action-btn:hover { background: rgba(255,255,255,0.15); color: var(--text-primary); border-color: var(--glass-border); }

.input-area { 
    position: absolute;
    bottom: 0;
    top: auto;
    left: 50%;
    transform: translateX(-50%);
    padding: 16px 20px 24px; 
    background: transparent; 
    max-width: 740px;
    width: 100%;
    z-index: 5;
    transition: bottom 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.input-wrapper.pill-bar {
    position: relative; 
    background: #1e1e23;
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-radius: 28px; 
    border: 1px solid rgba(255, 255, 255, 0.09);
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.45); 
    display: flex;
    flex-direction: column;
    padding: 6px 12px 6px 14px;
    transition: border-radius 0.3s cubic-bezier(0.16, 1, 0.3, 1), padding 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

.pill-bar-main-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.mode-dropdown-inline {
    width: 100%;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0;
    margin-bottom: 0;
    border-bottom: 0px solid transparent;
    transition: max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, margin-bottom 0.3s ease, padding-bottom 0.3s ease;
}

.input-wrapper.pill-bar.expanded-mode-open {
    border-radius: 20px;
    padding: 10px 14px 8px;
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.6);
}

.input-wrapper.pill-bar.expanded-mode-open .mode-dropdown-inline {
    max-height: 220px;
    opacity: 1;
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.input-wrapper.pill-bar:focus-within {
    border-color: rgba(255, 255, 255, 0.22);
    background: #232329;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}

body.light .input-wrapper.pill-bar { 
    background: #ffffff; 
    border-color: rgba(0,0,0,0.12); 
    box-shadow: 0 6px 25px rgba(0,0,0,0.08); 
}

body.light .input-wrapper.pill-bar:focus-within {
    border-color: rgba(102, 126, 234, 0.4);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.15);
}

.bar-left-tools, .bar-right-tools {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.bar-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s ease, color 0.2s ease;
}

body.light .bar-btn {
    color: rgba(0, 0, 0, 0.6);
}

.bar-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

body.light .bar-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #000000;
}

.bar-btn.active {
    background: var(--accent-color, #667eea);
    color: white;
}

/* Web Search Chip Button (replacing Pro button) */
.bar-chip-btn {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.85);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    outline: none;
}

.bar-chip-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.25);
}

.bar-chip-btn.active {
    background: rgba(102, 126, 234, 0.22);
    border-color: rgba(102, 126, 234, 0.6);
    color: #a4b6ff;
    font-weight: 600;
    box-shadow: 0 0 14px rgba(102, 126, 234, 0.25);
}

body.light .bar-chip-btn {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.12);
    color: rgba(0, 0, 0, 0.75);
}

body.light .bar-chip-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #000000;
}

body.light .bar-chip-btn.active {
    background: rgba(102, 126, 234, 0.15);
    border-color: #667eea;
    color: #4169e1;
}

.send-btn-pill {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #ffffff;
    color: #000000;
    border: none;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.15s ease, opacity 0.2s ease, background 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.send-btn-pill:hover:not(:disabled) {
    transform: scale(1.06);
    opacity: 0.95;
}

.send-btn-pill:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.2);
    color: #888;
}

body.light .send-btn-pill {
    background: #1a1a1a;
    color: #ffffff;
}

.bar-input-box {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary, #ffffff);
    font-family: inherit;
    font-size: 1rem;
    padding: 6px 8px;
    resize: none;
    min-height: 24px;
    max-height: 160px;
    line-height: 1.45;
}

.bar-input-box::placeholder {
    color: var(--text-muted, rgba(255, 255, 255, 0.45));
}

.token-counter {
    text-align: center; font-size: 0.75rem; color: var(--text-muted); margin-top: 8px;
}

.sidebar-backdrop {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(3px); z-index: 90;
}

.search-bar {
    margin: 0 12px 12px; padding: 12px; 
    background: rgba(0,0,0,0.2); 
    border-radius: 12px;
    border: 1px solid var(--glass-border); 
    color: white; display: none; font-family: inherit; font-size: 0.9rem;
}
.search-bar.active { display: block; }
body.light .search-bar { background: #f0f0f0; border: none; color: black; }

.toast {
    position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
    background: #667eea; 
    color: white; padding: 12px 24px; border-radius: 50px;
    font-size: 0.95rem; opacity: 0; transition: all 0.3s; pointer-events: none; z-index: 1000;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-10px); }

.custom-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7); backdrop-filter: blur(8px); z-index: 999; display: none;
    align-items: center; justify-content: center;
}
.custom-modal-overlay.open { display: flex; animation: fadeIn 0.3s; }

.custom-modal {
    background: #0A0A0A; 
    border: 1px solid var(--glass-border);
    border-radius: 20px; padding: 28px; width: 90%; max-width: 420px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5); transform: scale(0.95);
    animation: slideIn 0.3s forwards;
}
@keyframes slideIn { to { transform: scale(1); } }
body.light .custom-modal { background: white; border-color: rgba(0,0,0,0.1); color: #000; }

.custom-modal h3 { margin-bottom: 20px; font-size: 1.4rem; font-weight: 700; }
.custom-modal input {
    width: 100%; padding: 14px; border-radius: 12px; border: 1px solid var(--glass-border);
    background: rgba(0,0,0,0.3); color: white; margin-bottom: 24px;
    font-family: inherit; font-size: 1rem;
}
body.light .custom-modal input { background: #f0f0f0; border-color: #ccc; color: black; }

.modal-btns { display: flex; justify-content: flex-end; gap: 12px; }
.modal-btn {
    padding: 10px 20px; border-radius: 50px; border: none; cursor: pointer;
    font-size: 0.95rem; font-weight: 600; transition: background 0.2s;
}
.modal-btn.cancel { background: transparent; color: var(--text-muted); border: 1px solid var(--glass-border); }
.modal-btn.cancel:hover { background: rgba(255,255,255,0.05); color: white; }
.modal-btn.confirm { background: #fff; color: var(--accent-color); box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3); }
.modal-btn.confirm:hover { opacity: 0.9; box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4); }

.share-options { display: flex; flex-direction: column; gap: 10px; }

/* Settings Modal Overlay System */
.settings-modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.settings-modal-overlay.open {
    display: flex;
    opacity: 1;
}

.settings-modal-card {
    background: #0A0A0A;
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.12));
    border-radius: 24px;
    width: 100%;
    max-width: 960px;
    height: 85vh;
    max-height: 720px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
    font-family: inherit;
}

.settings-modal-card input,
.settings-modal-card select,
.settings-modal-card textarea,
.settings-modal-card button,
.settings-modal-card h3,
.settings-modal-card h4,
.settings-modal-card p,
.settings-modal-card div,
.settings-modal-card span,
.settings-modal-card label {
    font-family: inherit;
}

.settings-modal-card i,
.settings-modal-card i[class*="fa-"],
.settings-modal-card .fa,
.settings-modal-card .fa-solid,
.settings-modal-card .fa-regular,
.settings-modal-card .fa-brands {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands", "FontAwesome" !important;
}

body.light .settings-modal-card {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.12);
    color: #1a1a1a;
}

.settings-modal-header {
    padding: 1.2rem 1.8rem;
    border-bottom: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.settings-modal-header h3 {
    font-size: 1.35rem;
    font-weight: 700;
}

.settings-modal-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.settings-modal-sidebar {
    width: 240px;
    background: rgba(255, 255, 255, 0.03);
    border-right: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
    padding: 1rem 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex-shrink: 0;
    overflow-y: auto;
}

.modal-tab-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    color: var(--text-muted, rgba(255, 255, 255, 0.6));
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
}

.modal-tab-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary, #ffffff);
}

.modal-tab-item.active {
    background: var(--accent-color, #667eea);
    color: #ffffff;
    font-weight: 600;
}

.settings-modal-panes {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 2.5rem;
}

.modal-tab-pane {
    display: none;
}

.modal-tab-pane.active {
    display: block;
}

@media (max-width: 768px) {
    .settings-modal-card {
        height: 95vh;
        max-height: none;
    }
    .settings-modal-body {
        flex-direction: column;
    }
    .settings-modal-sidebar {
        width: 100%;
        flex-direction: row;
        border-right: none;
        border-bottom: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
        overflow-x: auto;
        padding: 0.5rem;
    }
    .modal-tab-item {
        white-space: nowrap;
    }
    .settings-modal-panes {
        padding: 1.2rem;
    }
}
.share-option-btn {
    padding: 14px; background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border); 
    border-radius: 12px; color: inherit; cursor: pointer; text-align: left; 
    display: flex; align-items: center; gap: 14px;
    font-size: 1rem; transition: background 0.2s;
}
.share-option-btn:hover { background: rgba(255,255,255,0.1); }

.swipe-trigger-zone {
    position: fixed; top: 0; left: 0; width: 20px; height: 100%; z-index: 50; display: none;
}
.zen-exit-btn {
    position: absolute; top: 20px; right: 20px; z-index: 1000;
    width: 45px; height: 45px; border-radius: 50%;
    background: rgba(255, 255, 255, 0.1); backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    color: #ececf1; cursor: pointer; display: none;
    align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3); transition: background 0.2s;
}
.zen-exit-btn:hover { background: rgba(255, 255, 255, 0.2); }
.container.zen-mode .zen-exit-btn { display: flex; }

@media (max-width: 768px) {
    body { font-size: 15px; }
    
    .sidebar { 
        position: absolute; left: 0; top: 0; height: 100%; 
        transform: translateX(-100%); 
        background: #0A0A0A;
        will-change: transform;
    }
    .sidebar:focus {
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5); 
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-backdrop.open { display: block; }
    .swipe-trigger-zone { display: block; }

    .message-row { 
        padding: 0 10px;
    }
    .message-content-wrapper { 
        max-width: 98%;
    }

    .message-row.assistant .message-bubble {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        padding-left: 0;
        padding-right: 0;
        font-size: 1rem;
    }

    .input-area { padding: 16px 12px; }
    .input-box { padding: 14px 45px 14px 14px; }
    
    .header { padding: 12px 16px; }
    .header-title { font-size: 1rem; }
}

.profile-icon {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--secondary-bg, rgba(255,255,255,0.1));
    color: var(--text-primary);
    font-size: 1.2rem;
    overflow: hidden;
    flex-shrink: 0;
}

.profile-icon.emoji-profile {
    background: transparent !important;
}

.profile-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.profile-icon span {
    font-size: 1.8rem;
    line-height: 1;
}

.message-bubble strong,
.message-bubble b,
.message-bubble h1, .message-bubble h2, .message-bubble h3, 
.message-bubble h4, .message-bubble h5, .message-bubble h6 {
    color: var(--text-primary) !important;
    font-weight: 700;
}

body.light .message-bubble code {
    color: #c7254e;
    background: rgba(0, 0, 0, 0.05);
}

body.light .message-bubble pre {
    background: #f6f8fa !important;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

body.light .message-bubble pre code {
    color: #24292e;
    background: transparent;
}

body, .sidebar, .header, .input-wrapper, .message-bubble {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

body.light ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
}
body.light ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

::selection {
    background: rgba(102, 126, 234, 0.3);
    color: inherit;
}
body.light ::selection {
    background: rgba(102, 126, 234, 0.2);
}

.message-row {
    animation: messagePop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    transform-origin: bottom left;
}
.message-row.user {
    transform-origin: bottom right;
}

@keyframes messagePop {
    0% { opacity: 0; transform: scale(0.9) translateY(10px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.sidebar {
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.send-btn {
    transition: background 0.2s ease, opacity 0.2s ease;
}

.chat-item {
    transition: background 0.2s ease, color 0.2s ease;
}
.chat-item:hover {
    background: rgba(255, 255, 255, 0.05);
}
@media (max-width: 768px) {
    .input-area {
        padding: 10px;
        background: var(--bg-base);
        position: relative;
        z-index: 20; 
    }

    .input-wrapper {
        border-radius: 10px;
    }
}

.tool-btn.active {
    color: white;
}

.search-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid rgba(76, 175, 80, 0.5);
    border-radius: 12px;
    font-size: 0.75rem;
    color: #4CAF50;
}

.search-indicator i {
    font-size: 0.7rem;
}

.search-citations {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.85rem;
    color: #888;
}

.search-citations a {
    color: var(--accent-color);
    text-decoration: none;
    display: block;
    margin-top: 4px;
    transition: color 0.2s;
}

.search-citations a:hover {
    color: #fff;
    text-decoration: underline;
}

.usage-stats {
    padding: 16px;
    margin: 12px;
    background: var(--glass-panel);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.usage-item {
    margin-bottom: 16px;
}
@media (max-width: 768px) {
    .speak-btn {
        min-width: 40px;
        min-height: 40px;
        font-size: 1.2rem !important;
    }
    
    .message-actions {
        gap: 8px !important;
    }
}
.usage-item:last-child {
    margin-bottom: 0;
}

.usage-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.usage-label i {
    font-size: 0.9rem;
    color: var(--accent-color);
}

.usage-bar {
    height: 6px;
    background: var(--glass-panel);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 6px;
}

.usage-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), #667eea);
    border-radius: 10px;
    transition: width 0.3s ease;
    width: 0%;
}

.usage-fill.warning {
    background: linear-gradient(90deg, #f39c12, #e74c3c);
}

.usage-fill.critical {
    background: linear-gradient(90deg, #e74c3c, #c0392b);
}

.usage-count {
    font-size: 0.75rem;
    color: var(--text-primary);
    text-align: right;
}

.ai-loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    min-height: 100px;
}

.ai-loading {
    position: relative;
    width: 80px;
    height: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ai-loading-logo {
    width: 40px;
    height: 40px;
    background-image: url('../icon/logo.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    z-index: 2;
    animation: logo-pulse 2s infinite ease-in-out;
}

.ai-loading-circle {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    z-index: 1;
}

.ai-loading-circle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(
        transparent 0deg,
        transparent 180deg,
        #4285F4 180deg,
        #4285F4 360deg
    );
    animation: circle-rotate 1.5s linear infinite;
    mask: radial-gradient(circle, transparent 50%, #000 51%);
    -webkit-mask: radial-gradient(circle, transparent 50%, #000 51%);
}

.ai-loading-circle::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    right: 4px;
    bottom: 4px;
    background: var(--secondary-bg, #1a1a1a);
    border-radius: 50%;
    z-index: 1;
}

.light-theme .ai-loading-circle::after {
    background: #f5f5f5;
}

@keyframes circle-rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes logo-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
}

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

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

.ai-loading-fade-in { animation: fadeIn 0.3s ease forwards; }
.ai-loading-fade-out { animation: fadeOut 0.3s ease forwards; }

/* ─── ULTRA-MODERN AI THINKING BUBBLE ───────────────────────── */
.ai-thinking-bubble {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2), 0 0 25px rgba(102, 126, 234, 0.12);
    margin-top: 4px;
    user-select: none;
    transition: all 0.3s ease;
}

body.light .ai-thinking-bubble {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
}

.ai-thinking-logo-wrapper {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.ai-thinking-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 6px rgba(102, 126, 234, 0.8));
    animation: thinkingLogoGlow 2s ease-in-out infinite alternate;
}

@keyframes thinkingLogoGlow {
    0% { transform: scale(0.95); filter: drop-shadow(0 0 4px rgba(102, 126, 234, 0.5)); }
    100% { transform: scale(1.08); filter: drop-shadow(0 0 10px rgba(102, 126, 234, 0.95)); }
}

.ai-thinking-text {
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0.95) 50%, rgba(255, 255, 255, 0.4) 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: thinkingTextShimmer 2.5s linear infinite;
}

body.light .ai-thinking-text {
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.9) 50%, rgba(0, 0, 0, 0.4) 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

@keyframes thinkingTextShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.ai-thinking-dots {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ai-thinking-dots .dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: var(--accent-color, #667eea);
    box-shadow: 0 0 8px var(--accent-color, #667eea);
    animation: thinkingDotBounce 1.4s infinite ease-in-out both;
}

.ai-thinking-dots .dot:nth-child(1) { animation-delay: -0.32s; }
.ai-thinking-dots .dot:nth-child(2) { animation-delay: -0.16s; }
.ai-thinking-dots .dot:nth-child(3) { animation-delay: 0s; }

@keyframes thinkingDotBounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.3;
    }
    40% {
        transform: scale(1.3) translateY(-3px);
        opacity: 1;
    }
}

.message-bubble {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.message-bubble > *:first-child { margin-top: 0 !important; }
.message-bubble > *:last-child { margin-bottom: 0 !important; }
.message-bubble p { margin: 0 0 8px 0; }

body {
    height: 100dvh; 
    width: 100vw;
    font-size: 16px;
    padding-top: 0;
    padding-bottom: 0;
}
body.cordova-android-mode {
    padding-top: env(safe-area-inset-top); 
    padding-bottom: env(safe-area-inset-bottom); 
}
.container { 
    display: flex; 
    height: 100%;
    width: 100%;
    position: relative; 
    background: var(--bg-base);
}
body.cordova-android-mode .header {
    padding-top: 10px !important; 
}

html, body {
    height: 100% !important; 
    margin: 0;
    padding: 0;
}

.container {
    height: 100% !important; 
    display: flex;
}

.chat-area {
    flex: 1; 
    overflow-y: scroll !important; 
    -webkit-overflow-scrolling: touch;
    height: auto;
    min-height: 0;
}

.input-area {
    flex-shrink: 0; 
    position: relative; 
    z-index: 10;
}

.message-bubble {
    display: block !important;
}

.message-bubble p {
    margin: 0 0 10px 0;
    display: inline-block;
    width: 100%;
}
.message-bubble p:last-child { margin-bottom: 0; }

.message-bubble ul, 
.message-bubble ol {
    margin: 8px 0 8px 20px;
    padding-left: 0;
}

.message-bubble li {
    margin-bottom: 6px;
    line-height: 1.6;
}

.message-bubble li p {
    display: inline;
    margin: 0;
}

.message-bubble strong {
    color: var(--text-primary);
    font-weight: 700;
}

.message-bubble ol {
    padding-left: 32px !important; 
    list-style-position: outside;
    margin-left: 0;
}

.message-bubble ul {
    padding-left: 25px !important;
    list-style-position: outside;
}

.message-bubble table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
}

.message-bubble th,
.message-bubble td {
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: left;
}

.message-bubble th {
    background: rgba(255, 255, 255, 0.1);
    font-weight: 700;
}

body.light .message-bubble table { border-color: rgba(0,0,0,0.1); }
body.light .message-bubble th, 
body.light .message-bubble td { border-color: rgba(0,0,0,0.1); color: #333; }
body.light .message-bubble th { background: rgba(0,0,0,0.05); }

.message-bubble a {
    color: #4facfe;
    text-decoration: none;
    border-bottom: 1px solid rgba(79, 172, 254, 0.5);
    word-break: break-all;
    transition: all 0.2s;
}

.message-bubble a:hover {
    color: #fff;
    border-bottom-color: #fff;
}

body.light .message-bubble a { color: #0066cc; border-bottom-color: rgba(0, 102, 204, 0.3); }
body.light .message-bubble a:hover { color: #004499; }

.message-bubble pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 10px 0;
    border: 1px solid var(--glass-border);
}

.message-bubble code {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 4px;
    border-radius: 4px;
}

.message-bubble pre code {
    background: transparent;
    padding: 0;
    color: #e0e0e0;
}

body.light .message-bubble pre { background: #f6f8fa; border-color: rgba(0,0,0,0.1); }
body.light .message-bubble pre code { color: #24292e; }
body.light .message-bubble code { background: rgba(0,0,0,0.05); color: #c7254e; }

.message-bubble blockquote {
    border-left: 4px solid var(--accent-color);
    margin: 10px 0;
    padding-left: 12px;
    color: var(--text-muted);
    font-style: italic;
}

/* ─── MINIMAL LARGE HORIZONTAL LOADING BAR ──────────────────── */
.fullscreen-loader {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: #08090d;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease-out, visibility 0.5s ease;
    overflow: hidden;
}

body.light .fullscreen-loader {
    background: #f4f6fa;
}

.large-loading-bar-track {
    width: clamp(280px, 45vw, 420px);
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
}

body.light .large-loading-bar-track {
    background: rgba(0, 0, 0, 0.08);
}

.large-loading-bar-fill {
    position: absolute;
    top: 0;
    left: -50%;
    height: 100%;
    width: 50%;
    background: linear-gradient(90deg, #667eea, #4285f4, #9b51e0);
    border-radius: 12px;
    box-shadow: 0 0 18px rgba(102, 126, 234, 0.7);
    animation: horizontalBarAnim 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes horizontalBarAnim {
    0% {
        left: -40%;
        width: 30%;
    }
    50% {
        width: 60%;
    }
    100% {
        left: 110%;
        width: 30%;
    }
}

.fullscreen-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
@media (min-width: 769px) {
    .message-row { padding: 0 15% !important; }
    .message-content-wrapper { max-width: 95% !important; }
}

.message-bubble {
    word-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
}

@media (min-width: 769px) {
    .message-row { padding: 0 !important; }
    .message-container {
        width: 100%;
        max-width: 1500px;
        margin: 0 auto;
        padding: 0 20px;
        box-sizing: border-box;
    }
    body, html, .main-content {
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }
}

.attachment-area {
    display: flex;
    gap: 12px;
    padding: 6px 12px;
    margin-bottom: 10px;
    overflow-x: auto;
    width: 100%;
    max-width: 100%;
    align-self: flex-start;
}

.attachment-area:empty {
    display: none !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
}

.attachment-item {
    position: relative;
    background: rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 82px;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.attachment-item:hover {
    transform: translateY(-2px);
    border-color: rgba(102, 126, 234, 0.4);
}

.attachment-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 4px;
    background: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #aaa;
}

.attachment-name {
    font-size: 0.7rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
    text-align: center;
}

.remove-attachment-btn {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mode-dropdown-inline .mode-option {
    padding: 8px 12px;
}

.mode-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
    color: var(--text-primary, #ffffff);
}

body.light .mode-option {
    color: #1a1a1a;
}

.mode-option:hover {
    background: rgba(255, 255, 255, 0.08);
}

body.light .mode-option:hover {
    background: rgba(0, 0, 0, 0.06);
}

.mode-option.active {
    background: rgba(102, 126, 234, 0.15);
    border: 1px solid rgba(102, 126, 234, 0.3);
}

.mode-option i {
    font-size: 1.1rem;
    color: var(--accent-color, #667eea);
    width: 20px;
    text-align: center;
}

.mode-opt-text {
    display: flex;
    flex-direction: column;
}

.mode-opt-title {
    font-size: 0.9rem;
    font-weight: 600;
}

.mode-opt-sub {
    font-size: 0.75rem;
    opacity: 0.65;
}

/* Gemini AI Canvas Side Panel Layout */
.chat-main-container {
    display: flex;
    flex-direction: row;
    flex: 1;
    width: 100%;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

.chat-area {
    flex: 1;
    transition: flex 0.3s ease, width 0.3s ease;
    height: 100%;
    overflow-y: auto;
    padding-bottom: 100px;
}

.canvas-side-panel {
    width: 0;
    opacity: 0;
    visibility: hidden;
    background: #0A0A0A;
    border-left: 1px solid var(--glass-border, rgba(255, 255, 255, 0.12));
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, opacity 0.25s ease, visibility 0.25s;
    z-index: 150;
    overflow: hidden;
}

body.light .canvas-side-panel {
    background: #f8f9fa;
    border-left-color: rgba(0, 0, 0, 0.1);
}

.chat-main-container.canvas-open .canvas-side-panel {
    width: 50%;
    max-width: 680px;
    min-width: 360px;
    opacity: 1;
    visibility: visible;
}

@media (max-width: 900px) {
    .chat-main-container.canvas-open .canvas-side-panel {
        position: absolute;
        top: 0; right: 0; bottom: 0; left: 0;
        width: 100% !important;
        max-width: none;
        z-index: 1000;
    }
}

.canvas-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.02);
}

.canvas-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

/* Canvas Artifact Select Dropdown */
.canvas-artifact-select {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.15));
    color: var(--text-primary, #ffffff);
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 0.85rem;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    max-width: 220px;
}

body.light .canvas-artifact-select {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.15);
    color: #1a1a1a;
}

/* Compact Chat Artifact Card (Gemini/Claude Canvas Style) */
.chat-artifact-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    margin: 12px 0;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.15));
    border-radius: 14px;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.chat-artifact-card:hover {
    background: rgba(102, 126, 234, 0.12);
    border-color: rgba(102, 126, 234, 0.4);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.25);
}

body.light .chat-artifact-card {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

body.light .chat-artifact-card:hover {
    background: rgba(102, 126, 234, 0.08);
    border-color: rgba(102, 126, 234, 0.3);
}

.artifact-card-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.artifact-card-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: rgba(102, 126, 234, 0.2);
    color: var(--accent-color, #667eea);
    border: 1px solid rgba(102, 126, 234, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.artifact-card-info {
    display: flex;
    flex-direction: column;
}

.artifact-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary, #ffffff);
}

body.light .artifact-card-title {
    color: #1a1a1a;
}

.artifact-card-sub {
    font-size: 0.78rem;
    color: var(--text-muted, rgba(255, 255, 255, 0.6));
    margin-top: 2px;
}

.artifact-card-btn {
    background: var(--accent-color, #667eea);
    color: #ffffff;
    border: none;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: filter 0.15s ease, background 0.15s ease;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.4);
}

.artifact-card-btn:hover {
    filter: brightness(1.15);
    box-shadow: 0 4px 18px rgba(102, 126, 234, 0.55);
}

.artifact-card-btn i {
    font-size: 0.95rem;
}

/* Chat Code Block Wrapper & Open in Canvas Header */
.code-block-wrapper {
    position: relative;
    margin: 12px 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.12));
    background: rgba(12, 12, 16, 0.95);
}

.code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
}

.code-lang {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent-color, #667eea);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: flex;
    align-items: center;
    gap: 6px;
}

.code-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.code-action-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.85);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: background 0.2s;
}

.code-action-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}

.code-action-btn.open-canvas-btn {
    background: var(--accent-color, #667eea);
    color: #ffffff;
    border: none;
}

.code-action-btn.open-canvas-btn:hover {
    filter: brightness(1.15);
}

.code-block-wrapper pre {
    margin: 0 !important;
    border-radius: 0 !important;
    border: none !important;
    background: transparent !important;
    padding: 14px 16px !important;
}

.canvas-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(102, 126, 234, 0.2);
    color: var(--accent-color, #667eea);
    border: 1px solid rgba(102, 126, 234, 0.4);
    white-space: nowrap;
}

.canvas-title {
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary, #ffffff);
}

body.light .canvas-title {
    color: #1a1a1a;
}

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

.canvas-action-btn {
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.12));
    color: var(--text-primary, #ffffff);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}

body.light .canvas-action-btn {
    background: #ffffff;
    color: #1a1a1a;
    border-color: rgba(0, 0, 0, 0.15);
}

.canvas-action-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.canvas-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: var(--text-muted, #aaa);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: background 0.2s, color 0.2s;
}

.canvas-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.canvas-tabs-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--glass-border, rgba(255, 255, 255, 0.08));
}

.canvas-tab {
    padding: 6px 14px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted, rgba(255, 255, 255, 0.6));
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.canvas-tab.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary, #ffffff);
    border-color: rgba(255, 255, 255, 0.15);
}

.canvas-tab.disabled {
    opacity: 0.65;
    cursor: pointer;
}

.coming-soon-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 10px;
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
    font-weight: 600;
}

.canvas-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
}

.canvas-code-block {
    background: #050505;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 16px;
    color: #e0e0e0;
    font-family: 'Share Tech Monospace', monospace, monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    overflow-x: auto;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
}

.canvas-doc-view {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 24px;
    line-height: 1.7;
    font-size: 0.95rem;
    color: var(--text-primary, #ffffff);
}

body.light .canvas-doc-view {
    background: #ffffff;
    color: #1a1a1a;
    border-color: rgba(0, 0, 0, 0.1);
}

.canvas-preview-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    text-align: center;
}

.preview-coming-soon {
    padding: 30px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.15);
}

.open-canvas-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(102, 126, 234, 0.15);
    border: 1px solid rgba(102, 126, 234, 0.3);
    color: var(--accent-color, #667eea);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.open-canvas-btn:hover {
    background: rgba(102, 126, 234, 0.3);
}

/* ─── SIDEBAR BACKDROP & DRAWER ─────────────────────── */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.sidebar-backdrop.open {
    display: block !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* ─── MOBILE UI OPTIMIZATIONS ─────────────────────── */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }

    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        height: 100% !important;
        height: 100dvh !important;
        width: 82% !important;
        max-width: 320px !important;
        z-index: 1000 !important;
        transform: translateX(-100%) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        box-shadow: 4px 0 25px rgba(0, 0, 0, 0.6) !important;
    }

    .sidebar.open {
        transform: translateX(0) !important;
    }
    
    .header {
        padding: 10px 14px;
        min-height: 56px;
    }

    .header-title {
        font-size: 1.1rem;
    }

    .icon-btn {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    .auth-overlay {
        padding: 1rem 0.75rem;
    }

    .auth-card-modal {
        flex-direction: column;
        width: 100%;
        max-width: 100%;
        min-height: auto;
        border-radius: 22px;
    }

    .auth-left-panel {
        width: 100%;
        border-radius: 22px 22px 0 0;
        padding: 2rem 1.25rem;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }

    .auth-illustration-circle {
        width: 120px;
        height: 120px;
        margin-bottom: 1rem;
    }

    .auth-circle-logo {
        width: 60px;
        height: 60px;
    }

    .auth-left-title {
        font-size: 1.5rem;
    }

    .auth-left-sub {
        font-size: 0.85rem;
    }

    .auth-right-panel {
        border-radius: 0 0 22px 22px;
    }

    .auth-right-scroll {
        padding: 1.75rem 1.25rem;
    }

    .auth-top-row {
        margin-bottom: 1.2rem;
    }

    .auth-top-badge {
        padding: 6px 18px;
        font-size: 0.8rem;
    }

    .auth-home-btn {
        padding: 6px 14px;
        font-size: 0.8rem;
    }

    .auth-right-heading {
        font-size: 1.4rem;
        margin-bottom: 1.2rem;
    }

    .auth-input {
        padding: 14px 16px;
        font-size: 1rem; /* Prevents auto-zoom on mobile safari */
    }

    .auth-btn-primary, .auth-btn-google {
        padding: 14px 18px;
        font-size: 0.95rem;
    }

    .input-area {
        padding: 8px 10px;
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }

    /* ── Mobile Input Pill Bar Grid Layout (Like ChatGPT & Claude Mobile) ── */
    .pill-bar {
        border-radius: 20px !important;
        padding: 10px 12px !important;
        background: rgba(22, 24, 32, 0.95) !important;
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
    }

    body.light .pill-bar {
        background: #ffffff !important;
        border-color: rgba(0, 0, 0, 0.12) !important;
    }

    .pill-bar-main-row {
        display: grid !important;
        grid-template-columns: 1fr auto !important;
        grid-template-rows: auto auto !important;
        gap: 8px 6px !important;
        align-items: center !important;
    }

    /* Row 1: Full-width Textarea */
    .bar-input-box {
        grid-column: 1 / -1 !important;
        grid-row: 1 !important;
        width: 100% !important;
        flex: none !important;
        min-height: 40px !important;
        max-height: 140px !important;
        padding: 4px 6px !important;
        font-size: 1rem !important;
        line-height: 1.4 !important;
    }

    /* Row 2 Left: Attach (+) & Web Search */
    .bar-left-tools {
        grid-column: 1 !important;
        grid-row: 2 !important;
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
    }

    /* Row 2 Right: Mode Badge, Mic, Send Button */
    .bar-right-tools {
        grid-column: 2 !important;
        grid-row: 2 !important;
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
    }

    .bar-btn, .bar-btn-plus {
        width: 36px !important;
        height: 36px !important;
        font-size: 0.95rem !important;
    }

    .send-btn-pill {
        width: 38px !important;
        height: 38px !important;
        font-size: 1rem !important;
    }

    .bar-chip-btn {
        padding: 4px 10px !important;
        font-size: 0.78rem !important;
    }

    /* Hide duplicate header buttons on narrow mobile screens for a clean aesthetic */
    .header-right .icon-btn[title="Zen Mode"],
    .header-right .icon-btn[title="Font Size"] {
        display: none !important;
    }

    /* ── ALWAYS KEEP INPUT AREA AT BOTTOM ON MOBILE ── */
    .main-content.is-empty-state .input-area,
    .input-area {
        position: relative !important;
        bottom: 0 !important;
        left: 0 !important;
        top: auto !important;
        transform: none !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 8px 12px !important;
        padding-bottom: max(12px, env(safe-area-inset-bottom)) !important;
        margin-top: auto !important;
        z-index: 10 !important;
    }

    .main-content.is-empty-state .chat-main-container {
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-between !important;
        align-items: center !important;
    }

    .main-content.is-empty-state .chat-area {
        height: auto !important;
        flex: 1 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .main-content.is-empty-state .empty-state h2 {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
        font-size: 1.6rem !important;
        text-align: center !important;
        margin: auto !important;
        white-space: normal !important;
    }

    .usage-stats {
        margin: 10px 12px;
        padding: 12px;
        border-radius: 14px;
    }

    .usage-label {
        font-size: 0.82rem;
    }
}
