/* 
   JARVIS Cloud - Gemini Dark Theme
   Refined Layout: Sidebar + Chat Area
*/

:root {
    /* Gemini Dark Palette */
    --bg-dark: #131314;
    --bg-sidebar: #1E1F20;
    --bg-surface: #1E1F20;
    --bg-surface-hover: #2D2E30;
    --accent-blue: #A8C7FA;
    --accent-blue-dim: rgba(168, 199, 250, 0.1);
    --text-primary: #E3E3E3;
    --text-secondary: #C4C7C5;
    --text-placeholder: #8E918F;
    --border-subtle: #444746;

    /* Voice Visualizer Colors */
    --viz-1: #4285F4;
    --viz-2: #EA4335;
    --viz-3: #FBBC05;
    --viz-4: #34A853;

    /* Layout */
    --sidebar-width: 280px;
    --header-height: 60px;
    --max-width: 900px;
}

/* ============== Splash Screen ============== */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #131314;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.splash-screen.shrink-out {
    opacity: 0;
    transform: scale(0.3) translate(-60vw, -40vh);
    pointer-events: none;
}

.splash-screen.hidden {
    display: none;
}

.splash-logo-container {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: splash-float-in 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.splash-logo {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    position: relative;
    z-index: 2;
    filter: drop-shadow(0 0 15px rgba(66, 133, 244, 0.6));
    animation: splash-logo-glow 2s ease-in-out 1s infinite;
}

.splash-ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid transparent;
    animation-fill-mode: forwards;
}

.splash-ring:first-child {
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    border-top-color: #4285F4;
    border-right-color: rgba(66, 133, 244, 0.3);
    opacity: 0;
    animation: splash-ring-appear 0.5s ease 0.6s forwards, logo-spin 2.5s linear 0.6s infinite;
}

.splash-ring-2 {
    width: 85%;
    height: 85%;
    top: 7.5%;
    left: 7.5%;
    border-top-color: rgba(155, 114, 203, 0.8);
    border-left-color: rgba(234, 67, 53, 0.3);
    opacity: 0;
    animation: splash-ring-appear 0.5s ease 0.8s forwards, logo-spin-reverse 2s linear 0.8s infinite;
}

.splash-ring-3 {
    width: 115%;
    height: 115%;
    top: -7.5%;
    left: -7.5%;
    border-bottom-color: rgba(251, 188, 5, 0.5);
    border-right-color: rgba(66, 133, 244, 0.2);
    opacity: 0;
    animation: splash-ring-appear 0.5s ease 1s forwards, logo-spin 3s linear 1s infinite;
}

.splash-text {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 8px;
    background: linear-gradient(90deg, #4285F4, #9B72CB, #EA4335, #FBBC05);
    background-size: 200% auto;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    opacity: 0;
    animation: splash-text-in 0.8s ease 1.2s forwards, gradient-flow 3s ease infinite 1.2s;
}

.splash-subtitle {
    font-size: 0.85rem;
    color: #5f6368;
    letter-spacing: 3px;
    text-transform: uppercase;
    opacity: 0;
    animation: splash-text-in 0.8s ease 1.5s forwards;
}

@keyframes splash-float-in {
    0% {
        opacity: 0;
        transform: translateX(-100vw) scale(0.3) rotate(-180deg);
    }

    60% {
        opacity: 1;
        transform: translateX(10px) scale(1.1) rotate(10deg);
    }

    100% {
        opacity: 1;
        transform: translateX(0) scale(1) rotate(0deg);
    }
}

@keyframes splash-ring-appear {
    from {
        opacity: 0;
        transform: scale(0.5);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes splash-text-in {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes splash-logo-glow {

    0%,
    100% {
        filter: drop-shadow(0 0 10px rgba(66, 133, 244, 0.4));
    }

    50% {
        filter: drop-shadow(0 0 25px rgba(66, 133, 244, 0.8)) drop-shadow(0 0 50px rgba(155, 114, 203, 0.3));
    }
}

/* ============== Sidebar Emoji ============== */
.emoji-container {
    width: 48px;
    height: 48px;
    margin: 0 auto;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s;
}

.emoji-container:hover {
    transform: scale(1.1);
}

.emoji-face {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #FFD700, #F39C12);
    border-radius: 50%;
    position: relative;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3), inset 0 -4px 8px rgba(255, 140, 0, 0.4);
    overflow: hidden;
    transition: background 0.3s ease;
}

.emoji-brow {
    width: 12px;
    height: 3px;
    background: #8B4513;
    position: absolute;
    top: 10px;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.left-brow {
    left: 8px;
}

.right-brow {
    right: 8px;
}

.emoji-eye {
    width: 10px;
    height: 12px;
    background: #FFF;
    border-radius: 50%;
    position: absolute;
    top: 16px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.left-eye {
    left: 10px;
}

.right-eye {
    right: 10px;
}

.emoji-pupil {
    width: 5px;
    height: 5px;
    background: #000;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: transform 0.1s;
    /* for smooth tracking */
}

.emoji-mouth {
    width: 16px;
    height: 8px;
    border: 2px solid #8B4513;
    border-top: none;
    border-radius: 0 0 16px 16px;
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Moods --- */
.mood-angry .emoji-face {
    background: linear-gradient(135deg, #FF4500, #CD3333);
}

.mood-angry .left-brow {
    transform: rotate(25deg) translateY(3px);
}

.mood-angry .right-brow {
    transform: rotate(-25deg) translateY(3px);
}

.mood-angry .emoji-mouth {
    height: 4px;
    border-bottom: none;
    border-top: 2px solid #8B4513;
    border-radius: 16px 16px 0 0;
    bottom: 8px;
}

.mood-happy .left-brow {
    transform: translateY(-3px);
}

.mood-happy .right-brow {
    transform: translateY(-3px);
}

.mood-happy .emoji-mouth {
    height: 12px;
    width: 22px;
    border-radius: 0 0 22px 22px;
    background: rgba(139, 69, 19, 0.15);
}

.mood-sad .left-brow {
    transform: rotate(-15deg) translateY(-2px);
}

.mood-sad .right-brow {
    transform: rotate(15deg) translateY(-2px);
}

.mood-sad .emoji-mouth {
    height: 4px;
    border-bottom: none;
    border-top: 2px solid #8B4513;
    border-radius: 16px 16px 0 0;
    bottom: 8px;
}

.mood-typing .emoji-mouth {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid #8B4513;
    bottom: 10px;
    background: transparent;
}

/* ============== Profile Dropdown ============== */
.profile-dropdown {
    position: absolute;
    top: 50px;
    right: 0;
    width: 280px;
    background: #1E1F20;
    border: 1px solid #333;
    border-radius: 16px;
    padding: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    display: none;
    flex-direction: column;
    animation: fade-in-dropdown 0.2s ease;
}

/* ============== Image Viewer Modal ============== */
.image-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-modal-overlay.show {
    display: flex;
    opacity: 1;
}

.image-modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90dvh;
}

.image-modal-img {
    max-width: 100%;
    max-height: 90dvh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.image-modal-overlay.show .image-modal-img {
    transform: scale(1);
}

.image-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.image-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.profile-dropdown.show {
    display: flex;
}

@keyframes fade-in-dropdown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-user-info {
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.dropdown-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #4285F4;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    object-fit: cover;
}

.dropdown-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

.dropdown-user-details {
    flex: 1;
    overflow: hidden;
}

.dropdown-user-name {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-user-email {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-divider {
    height: 1px;
    background: #333;
    margin: 4px 0;
}

.dropdown-item {
    background: transparent;
    border: none;
    width: 100%;
    padding: 10px 12px;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: #333;
}

.dropdown-item .material-icons-round {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.dropdown-signout {
    color: #EA4335;
}

.dropdown-signout .material-icons-round {
    color: #EA4335;
}

.dropdown-signout:hover {
    background: rgba(234, 67, 53, 0.1);
}

.dropdown-badge {
    margin-left: auto;
    background: #4285F4;
    color: white;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 10px;
}

.dropdown-app-info {
    font-size: 0.75rem;
    color: var(--text-placeholder);
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dropdown-app-info .material-icons-round {
    font-size: 1rem;
}

/* ============== Info Modal ============== */
.info-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.info-modal-overlay.show {
    display: flex;
    animation: fade-in 0.3s ease;
}

.info-modal {
    background: #1E1F20;
    border: 1px solid #333;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.info-modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.info-modal-header h2 {
    font-size: 1.2rem;
    color: var(--text-primary);
}

.info-modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: background 0.2s;
}

.info-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.info-modal-body {
    padding: 24px;
    overflow-y: auto;
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.95rem;
}

.info-modal-body h3 {
    color: var(--text-primary);
    margin-bottom: 12px;
    margin-top: 24px;
}

.info-modal-body h3:first-child {
    margin-top: 0;
}

.info-modal-body p {
    margin-bottom: 16px;
}

.info-modal-body ul {
    margin-bottom: 16px;
    padding-left: 20px;
}

.info-modal-body li {
    margin-bottom: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    height: 100dvh;
    /* Dynamic Viewport Height for mobile browsers */
    display: flex;
    overflow: hidden;
    margin: 0;
    padding: 0;
    z-index: 1;
    touch-action: manipulation;
}

html {
    touch-action: manipulation;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* --- Sidebar --- */
.app-sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    padding: 20px 10px;
    border-right: 1px solid transparent;
    /* cleaner look */
    transition: transform 0.3s ease;
    z-index: 50;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 10px;
}

.user-profile-section {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background-color: var(--bg-surface);
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.user-profile-section:hover {
    background-color: var(--bg-surface-hover);
}

.sidebar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

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

.sidebar-username {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.sidebar-status {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.sidebar-settings-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-settings-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* Settings Modal */
.settings-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.settings-modal {
    background: var(--bg-surface);
    width: 90%;
    max-width: 500px;
    border-radius: 16px;
    border: 1px solid var(--border-subtle);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.settings-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.settings-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.settings-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
}

.settings-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.settings-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1rem;
    color: var(--accent-cyan);
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.setting-input,
.setting-select {
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 8px;
    outline: none;
}

.settings-footer {
    padding: 20px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: flex-end;
}

.new-chat-btn {
    background-color: var(--bg-surface-hover);
    color: var(--text-secondary);
    border: none;
    padding: 10px 16px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 20px;
}

.new-chat-btn:hover {
    background-color: #333537;
    color: var(--text-primary);
}

.recent-chats-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-placeholder);
    margin-bottom: 10px;
    padding-left: 12px;
}

.recent-list {
    flex: 1;
}

/* --- Input Styling --- */
.input-panel {
    flex-shrink: 0;
    z-index: 100;
}

.command-input-wrapper {
    display: flex;
    gap: 15px;
}

.futuristic-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    padding: 12px 20px;
    color: var(--text-main);
    border-radius: 4px;
    font-size: 1rem;
    line-height: 1.5;
    /* Ensure consistent text height */
    margin: 0;
    /* Reset margins */
    vertical-align: middle;
}

.futuristic-input:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 10px var(--accent-glow);
}

/* --- Attachment Menu --- */
.attachment-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-dim);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.btn-icon.active {
    background: rgba(0, 242, 255, 0.1);
    color: var(--accent-cyan);
    transform: rotate(45deg);
}

.attachment-menu {
    position: absolute;
    bottom: 110%;
    left: 0;
    width: 200px;
    background: rgba(15, 20, 30, 0.95);
    /* JARVIS Dark Theme */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
    z-index: 2005;
    display: none;
    /* Hidden by default */
    animation: menu-pop 0.2s cubic-bezier(0.2, 0, 0, 1);
    transform-origin: bottom left;
}

.attachment-menu.show {
    display: block;
}

@keyframes menu-pop {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--text-main);
    /* JARVIS Text Color */
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.menu-item:hover {
    background: rgba(0, 242, 255, 0.1);
    /* Cyan hover glow */
    border: 1px solid rgba(0, 242, 255, 0.2);
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.1);
}

.menu-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-cyan);
    /* Cyan Icons */
}

.menu-text {
    font-size: 0.9rem;
    font-weight: 500;
    font-family: 'Rajdhani', sans-serif;
    /* JARVIS Font */
    letter-spacing: 1px;
}

/* --- Code Block Styling --- */

.code-block-wrapper {
    background: #1e1e1e;
    border-radius: 8px;
    margin: 10px 0;
    overflow: hidden;
    border: 1px solid #333;
    font-family: 'Fira Code', 'Consolas', monospace;
    max-width: 100%;
    /* Prevent expansion */
    min-width: 0;
    /* Allow shrinking in flex/grid */
}

.code-block-header {
    background: #2d2d2d;

    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #333;
    font-size: 0.8rem;
    color: #e0e0e0;
}

.code-lang {
    font-weight: 600;
    text-transform: uppercase;
    color: #a8c7fa;
}

.code-copy-btn {
    background: transparent;
    border: none;
    color: #b0b0b0;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.code-copy-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.code-block-content {
    margin: 0;
    padding: 12px;
    overflow-x: auto;
    color: #d4d4d4;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Remove default hljs padding as we handle it */
.hljs {
    background: transparent !important;
    padding: 0 !important;
}

/* --- Processing State --- */
.processing .ring-inner {
    animation: alert-pulse 0.5s ease-in-out infinite;
    background: radial-gradient(circle, var(--accent-violet) 0%, transparent 70%);
}

@keyframes alert-pulse {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.8;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 1;
        filter: hue-rotate(90deg);
    }
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--accent-cyan);
}

/* --- Chat History --- */
.chat-history {
    height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.recent-item {
    padding: 10px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--text-primary);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.recent-item:hover {
    background-color: var(--bg-surface-hover);
}

.recent-item .icon {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* --- Main Content --- */
.main-layout {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    height: 100%;
}

/* --- Header --- */
.app-header {
    height: var(--header-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    /* Ensure solid background to prevent see-through */
    background-color: var(--bg-dark);
    z-index: 100;
    position: relative;
    border-bottom: 1px solid var(--border-subtle);
}

.brand {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 1;
}

/* Mobile Sidebar Toggle */
.menu-btn {
    display: none;
    /* Desktop hidden */
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
}

/* --- Chat Area --- */
.chat-container {
    flex: 1;
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 20px;
    padding-top: 40px;
    padding-bottom: 120px;
    /* Space for input */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.chat-container::-webkit-scrollbar {
    width: 6px;
}

.chat-container::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

/* Welcome Screen - Gemini Style */
.welcome-screen {
    display: none;
    /* Hidden by default, shown in start-mode */
    flex-direction: column;
    justify-content: center;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    height: 100%;
    padding-bottom: 140px;
    animation: fade-in 0.5s ease;
}

.start-mode .welcome-screen {
    display: flex;
}

.greeting-header {
    margin-bottom: 8px;
}

.greeting-text {
    font-size: 3.5rem;
    font-weight: 500;
    line-height: 1.2;
    padding-bottom: 10px;
    letter-spacing: -1px;
    background: linear-gradient(90deg, #4285F4, #9B72CB, #EA4335, #FBBC05);
    background-size: 200% auto;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient-flow 5s ease infinite;
    display: inline-block;
}

.welcome-title {
    font-size: 3.5rem;
    font-weight: 400;
    color: #444746;
    /* Muted dark gray */
    letter-spacing: -1px;
    margin-bottom: 40px;
}

/* Suggestion Chips */
.suggestion-chips {
    margin-top: 40px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    /* Center align chips */
}

.chip {
    background-color: #1E1F20;
    border: 1px solid transparent;
    border-radius: 16px;
    padding: 12px 20px;
    font-size: 0.95rem;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s, transform 0.2s;
}

.chip:hover {
    background-color: #2D2E30;
    transform: translateY(-2px);
}

.chip-icon {
    font-size: 1.2rem;
    color: var(--accent-blue);
    /* Default accent */
}

/* Individual chip colors (optional icons) */
.chip:nth-child(1) .chip-icon {
    color: #FBBC05;
}

/* Image - Yellow */
.chip:nth-child(2) .chip-icon {
    color: #EA4335;
}

/* Cricket - Red */
.chip:nth-child(3) .chip-icon {
    color: #4285F4;
}

/* Write - Blue */
.chip:nth-child(4) .chip-icon {
    color: #34A853;
}

/* Boost - Green */

/* Messages */
.message {
    display: flex;
    gap: 16px;
    max-width: 80%;
    animation: slide-up 0.3s forwards;
    line-height: 1.6;
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-msg {
    align-self: flex-end;
    /* Right align */
    flex-direction: row-reverse;
    /* Avatar on right */
    text-align: right;
}

.jarvis-msg {
    align-self: flex-start;
    /* Left align */
    text-align: left;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-avatar {
    background: #3c4043;
    color: #fff;
}

.jarvis-avatar {
    background: transparent;
}

.jarvis-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.message-bg {
    padding: 12px 18px;
    border-radius: 18px;
    position: relative;
}

.user-msg .message-bg {
    background: #282930;
    color: #E3E3E3;
    border-bottom-right-radius: 4px;
}

.jarvis-msg .message-bg {
    background: transparent;
    /* Clean look */
    color: #E3E3E3;
    padding: 0;
    /* No bubble for AI, just text like Gemini */
}

/* Code Blocks */
pre {
    background: #000000;
    padding: 16px;
    border-radius: 12px;
    overflow-x: auto;
    margin-top: 10px;
    border: 1px solid #333;
    text-align: left;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
}

strong {
    font-weight: 600;
    color: #fff;
}

/* --- Input Area --- */
.input-area {
    position: absolute;
    /* Default bottom */
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--bg-dark);
    padding: 24px;
    display: flex;
    justify-content: center;
    z-index: 20;
    transition: top 0.5s ease, transform 0.5s ease, background 0.5s ease;
}

/* Center Input in Start Mode */
.start-mode .input-area {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    background: transparent;
    padding: 0 20px 24px;
    width: 100%;
    max-width: 800px;
    align-items: center;
    overflow: visible;
}

/* Wrapper Styles */
.input-wrapper {
    width: 100%;
    max-width: var(--max-width);
    background: var(--bg-surface);
    border-radius: 24px;
    padding: 8px 8px 8px 8px;
    display: flex;
    flex-direction: column;
    gap: 0;
    transition: background 0.2s, box-shadow 0.2s;
    border: 1px solid transparent;
    position: relative;
}

/* Input Row — the text input + buttons row */
.input-row {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    padding: 4px 8px;
}

/* ============== Attach Menu (+ button popup) ============== */
.attach-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 12px;
    background: #282a2c;
    border: 1px solid #3c3f41;
    border-radius: 16px;
    padding: 6px;
    display: none;
    flex-direction: column;
    gap: 2px;
    min-width: 160px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 100;
    animation: attach-menu-in 0.2s cubic-bezier(0.2, 0, 0, 1);
}

.model-selector {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.85rem;
    outline: none;
    transition: all 0.2s ease;
    cursor: pointer;
    appearance: none;
    /* Remove default arrow */
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23AAAAAA%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 10px;
    padding-right: 24px;
    /* Space for arrow */
}

.model-selector:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
}

.model-selector:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 168, 255, 0.2);
}

.model-selector option {
    background: #1e1e1e;
    color: var(--text-primary);
    padding: 8px;
}

@keyframes attach-menu-in {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.attach-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 12px;
    transition: background 0.15s;
    white-space: nowrap;
}

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

.attach-option .material-icons-round {
    font-size: 1.3rem;
}

/* ============== File Preview Area ============== */
.file-preview-area {
    display: none;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px 4px 12px;
    overflow-x: auto;
    max-height: 140px;
}

.file-preview-item {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 12px;
    overflow: hidden;
    background: #282a2c;
    border: 1px solid #3c3f41;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.15s, box-shadow 0.15s;
}

.file-preview-item:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.file-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-preview-icon {
    font-size: 1.8rem;
    color: var(--text-secondary);
}

.file-remove-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
    color: #fff;
}

.file-preview-item:hover .file-remove-btn {
    opacity: 1;
}

/* Expanded wrapper when files are attached */
.input-wrapper.has-files {
    border-color: var(--border-subtle);
}

/* ============== Chat File Attachments (in messages) ============== */
.chat-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-image:hover {
    transform: scale(1.03);
}

.chat-file-attachment {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-file-attachment .material-icons-round {
    font-size: 1.1rem;
    color: var(--accent-blue);
}

.start-mode .input-wrapper {
    max-width: 100%;
    /* Full width of container */
    padding: 16px 24px;
    /* Larger in start mode */
    background: #1E1F20;
}

.input-wrapper:focus-within {
    background: var(--bg-surface-hover);
    border-color: var(--border-subtle);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.input-row {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 12px;
}

/* Text Input */
.text-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.1rem;
    outline: none;
    height: 26px;
    line-height: 26px;
    padding: 0;
    margin: 0;
    resize: none;
    align-self: center;
    overflow: hidden;
}

.text-input::placeholder {
    color: var(--text-placeholder);
}

/* Input Icons */
.icon-btn-input {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
}

.icon-btn-input:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

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

.btn-label {
    font-size: 0.9rem;
    font-weight: 500;
    margin-left: 6px;
}

.separator {
    width: 1px;
    height: 20px;
    background: #444746;
    margin: 0 4px;
    display: none;
    /* Hide for now, clean look */
}

/* Voice Trigger in Input */
.voice-mode-trigger {
    background: transparent;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.voice-mode-trigger:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Send Button */
.send-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    /* Inactive color */
    cursor: pointer;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.text-input:valid+.input-actions .send-btn,
.input-wrapper:focus-within .send-btn {
    color: var(--text-primary);
    /* Active color */
}

.send-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}


/* --- Voice Overlay --- */
.voice-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #131314;
    /* Solid for immersion */
    z-index: 100;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.voice-active .voice-overlay {
    display: flex;
    animation: fade-in 0.3s;
    z-index: 2000;
    /* Ensure on top */
}

.voice-status {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.waveform {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 120px;
    margin-bottom: 60px;
}

.wave-bar {
    width: 12px;
    height: 20px;
    border-radius: 10px;
    background: var(--text-primary);
    animation: wave-idle-lg 1s infinite alternate;
}

.wave-bar:nth-child(1) {
    background: var(--viz-1);
    animation-delay: 0s;
}

.wave-bar:nth-child(2) {
    background: var(--viz-2);
    animation-delay: 0.1s;
}

.wave-bar:nth-child(3) {
    background: var(--viz-3);
    animation-delay: 0.2s;
}

.wave-bar:nth-child(4) {
    background: var(--viz-4);
    animation-delay: 0.3s;
}

@keyframes wave-idle-lg {
    0% {
        height: 20px;
        opacity: 0.6;
    }

    100% {
        height: 50px;
        opacity: 1;
    }
}

.waveform.active .wave-bar {
    animation: none;
    /* Js controls height */
}

.voice-controls {
    display: flex;
    gap: 40px;
}

.v-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    transition: transform 0.2s;
}

.v-btn:hover {
    transform: scale(1.1);
}

.btn-end {
    background: #EA4335;
    color: white;
}

.btn-mic-toggle {
    background: #3c4043;
    color: white;
}

.muted {
    background: #fff;
    color: #000;
}

/* Responsive */
@media (max-width: 768px) {
    .app-header {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 900;
        /* Below sidebar (2001) but above content */
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        /* Subtle border */
    }

    .main-layout {
        padding-top: var(--header-height);
    }

    .app-sidebar {
        position: fixed;
        left: -280px;
        height: 100%;
        z-index: 2001;
        /* Higher than input-area (20) */
        width: 280px;
        /* Ensure fixed width */
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .app-sidebar.open {
        transform: translateX(280px);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
        /* Shadow when open */
    }

    /* Overlay for sidebar on mobile */
    .app-sidebar.open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 280px;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(2px);
        z-index: 1999;
    }

    .menu-btn {
        display: block;
    }

    .brand {
        opacity: 1;
        font-size: 1.2rem;
        /* Slightly smaller logic */
    }

    .message {
        max-width: 92%;
        /* Utilize more width on mobile */
        padding: 12px 16px;
    }

    .jarvis-msg {
        border-radius: 12px;
        /* Softer corners */
    }

    /* Adjust welcome title for mobile */
    .greeting-text {
        font-size: 2rem;
    }

    .welcome-title {
        font-size: 1.8rem;
        /* Prevent wrapping overflow */
        padding: 0 10px;
    }

    .welcome-screen {
        justify-content: center;
        padding-bottom: 160px;
        /* Increased from 120px to avoid input overlap */
    }

    .suggestion-chips {
        /* Hide suggestion chips on mobile */
        display: none !important;
    }

    .suggestion-chip {
        white-space: nowrap;
        flex-shrink: 0;
        scroll-snap-align: start;
        max-width: 80vw;
        /* Prevent single chip from being too wide */
    }

    /* Input Area Mobile Optimization */
    .start-mode .input-area {
        padding: 15px;
        z-index: 20;
    }

    .input-wrapper {
        padding: 8px 12px;
        /* Compact padding */
        gap: 8px;
    }

    .file-btn,
    .voice-btn,
    .send-btn {
        width: 36px;
        height: 36px;
        /* Larger touch targets */
    }

    /* Input area needs to be accessible but below sidebar when sidebar is open */
    .input-area {
        z-index: 20;
        padding: 10px;
        /* Reduced side padding */
    }

    /* Code blocks scrollable */
    .code-block {
        max-width: 100%;
        overflow-x: auto;
    }

    /* Prevent auto-zoom on input focus (iOS) */
    input,
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* Small Mobile (Phones) */
@media (max-width: 480px) {
    .greeting-text {
        font-size: 1.8rem;
    }

    .welcome-title {
        font-size: 1.5rem;
    }

    .message {
        font-size: 0.95rem;
        /* Readable font size */
    }
}

/* Thinking Animation */
.thinking-content {
    display: flex;
    gap: 4px;
    padding: 10px 0;
    align-items: center;
}

.dot {
    width: 6px;
    height: 6px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.dot:nth-child(1) {
    animation-delay: -0.32s;
}

.dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Reasoning Block (<think>) */
.reasoning-details {
    background: rgba(255, 255, 255, 0.05);
    /* Very subtle */
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
}

.reasoning-details summary {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-placeholder);
    font-weight: 500;
    user-select: none;
    outline: none;
    transition: color 0.2s;
}

.reasoning-details summary:hover {
    color: var(--text-secondary);
}

.reasoning-content {
    padding: 12px;
    padding-top: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    white-space: pre-wrap;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.2);
    font-family: 'Roboto Mono', monospace;
}

/* Logo Styles */
.sidebar-header {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.app-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 20px rgba(66, 133, 244, 0.3);
    border: 2px solid rgba(168, 199, 250, 0.2);
    transition: transform 0.3s;
}

.app-logo:hover {
    transform: scale(1.05) rotate(5deg);
    box-shadow: 0 0 30px rgba(66, 133, 244, 0.5);
}

/* --- Animated JARVIS Logo --- */
.logo-anim-wrapper {
    position: relative;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
}

.header-logo {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    position: relative;
    z-index: 2;
    filter: drop-shadow(0 0 4px rgba(66, 133, 244, 0.5));
}

.logo-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: #4285F4;
    border-right-color: rgba(66, 133, 244, 0.3);
    animation: logo-spin 3s linear infinite;
    z-index: 1;
}

.logo-ring.ring-2 {
    width: 90%;
    height: 90%;
    top: 5%;
    left: 5%;
    border-top-color: rgba(155, 114, 203, 0.8);
    border-left-color: rgba(66, 133, 244, 0.2);
    border-right-color: transparent;
    animation: logo-spin-reverse 2s linear infinite;
}

.logo-anim-wrapper::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(66, 133, 244, 0.15) 0%, transparent 70%);
    animation: logo-pulse 2s ease-in-out infinite;
    z-index: 0;
}

.logo-anim-wrapper:hover .header-logo {
    filter: drop-shadow(0 0 8px rgba(66, 133, 244, 0.8));
    transform: scale(1.05);
    transition: all 0.3s ease;
}

.logo-anim-wrapper:hover .logo-ring {
    border-top-color: #a8c7fa;
    animation-duration: 1.5s;
}

@keyframes logo-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes logo-spin-reverse {
    from {
        transform: rotate(360deg);
    }

    to {
        transform: rotate(0deg);
    }
}

@keyframes logo-pulse {

    0%,
    100% {
        opacity: 0.5;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.15);
    }
}

/* --- Login Modal --- */
.login-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.login-modal-overlay.show {
    display: flex;
    animation: fade-in 0.3s ease;
}

.login-modal {
    background: var(--bg-surface);
    border-radius: 24px;
    padding: 40px;
    width: 90%;
    max-width: 400px;
    position: relative;
    border: 1px solid var(--border-subtle);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.login-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: background 0.2s;
}

.login-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.login-header {
    text-align: center;
    margin-bottom: 24px;
}

.login-logo {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 16px;
    box-shadow: 0 0 20px rgba(66, 133, 244, 0.3);
}

.login-header h2 {
    font-size: 1.3rem;
    font-weight: 500;
    margin-bottom: 6px;
}

.login-subtitle {
    font-size: 0.85rem;
    color: var(--text-placeholder);
}

.login-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.google-signin-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: #fff;
    color: #333;
    border: none;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.google-signin-btn:hover {
    background: #f1f1f1;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-placeholder);
    font-size: 0.85rem;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-subtle);
}

.login-input {
    background: var(--bg-dark);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.login-input:focus {
    border-color: var(--accent-blue);
}

.login-input::placeholder {
    color: var(--text-placeholder);
}

.login-submit-btn {
    background: var(--accent-blue);
    color: #131314;
    border: none;
    border-radius: 12px;
    padding: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.login-submit-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.login-toggle {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 8px;
}

.login-toggle a {
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 500;
}

.login-toggle a:hover {
    text-decoration: underline;
}

.login-optional {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-placeholder);
    margin-top: 16px;
}

/* --- User Badge (Header) --- */
.user-badge {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #3c4043;
    transition: transform 0.2s, box-shadow 0.2s;
}

.user-badge:hover {
    transform: scale(1.1);
    box-shadow: 0 0 12px rgba(168, 199, 250, 0.3);
}

.user-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.user-initial {
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent-blue);
}

/* --- Sidebar Polish --- */
.sidebar-footer {
    padding: 12px 0;
    border-top: 1px solid var(--border-subtle);
    margin-top: auto;
}

.sidebar-footer .icon-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.sidebar-footer .icon-btn:hover {
    background: var(--bg-surface-hover);
}

.login-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.recent-group-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-placeholder);
    padding: 12px 12px 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.recent-item.active {
    background: var(--accent-blue-dim);
    color: var(--accent-blue);
}

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

.recent-delete {
    background: transparent;
    border: none;
    color: var(--text-placeholder);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, color 0.2s;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    font-size: 0.85rem;
}

.recent-item:hover .recent-delete {
    opacity: 1;
}

.recent-delete:hover {
    color: #EA4335;
    background: rgba(234, 67, 53, 0.1);
}

.empty-history {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 40px 20px;
}

.recent-list::-webkit-scrollbar {
    width: 4px;
}

.recent-list::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 2px;
}

/* Message action buttons */
.message-actions {
    display: flex;
    gap: 4px;
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.jarvis-msg:hover .message-actions {
    opacity: 1;
}

.msg-action-btn {
    background: transparent;
    border: none;
    color: var(--text-placeholder);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.msg-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.msg-action-btn .material-icons-round {
    font-size: 16px;
}

/* Code block header */
.code-block {
    margin: 12px 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #333;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: #1a1a1a;
    border-bottom: 1px solid #333;
}

.code-lang {
    font-size: 0.8rem;
    color: var(--text-placeholder);
    text-transform: uppercase;
    font-weight: 500;
}

.code-copy-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.code-copy-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.code-copy-btn .material-icons-round {
    font-size: 14px;
}

.code-block pre {
    margin: 0;
    border: none;
    border-radius: 0;
}

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

/* Chat image */
.chat-image {
    max-width: 100%;
    border-radius: 12px;
    margin: 10px 0;
    cursor: pointer;
    transition: transform 0.2s;
}

.chat-image:hover {
    transform: scale(1.02);
}

/* Typing cursor animation */
.typing-cursor::after {
    content: '\25CC';
    animation: blink-cursor 0.6s step-end infinite;
    color: var(--accent-blue);
    font-weight: 300;
    margin-left: 2px;
}

@keyframes blink-cursor {
    50% {
        opacity: 0;
    }
}

@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes gradient-flow {
    0% {
        background-position: 0% center;
    }

    100% {
        background-position: 200% center;
    }
}

/* ============== File Preview ============== */
.file-preview-area {
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 100%;
    padding: 10px 20px;
    display: flex;
    gap: 10px;
    overflow-x: auto;
    background: transparent;
    z-index: 90;
    margin-bottom: 24px;
    /* Lift above input */
}

.file-preview-item {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    background: #2a2b2e;
    border: 1px solid #444;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    overflow: hidden;
}

.file-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-preview-icon {
    font-size: 24px;
    color: #aeaeae;
}

.file-remove-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #EA4335;
    color: white;
    border: 2px solid #1E1F20;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    z-index: 2;
}

.file-remove-btn:hover {
    transform: scale(1.1);
}

.input-wrapper.has-files {
    border-radius: 16px 16px 24px 24px;
}

/* Attach Menu */
.attach-menu {
    position: absolute;
    bottom: 60px;
    left: 10px;
    background: #1e1f20;
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 140px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: fade-in 0.2s ease;
}

.recent-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 12px;
    flex: 1;
    /* Take remaining height */
    overflow-y: auto;
    /* Enable scrolling */
    min-height: 0;
    /* Important for flex child scrolling */
    padding-bottom: 20px;
}

.attach-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: #e3e3e3;
    font-size: 14px;
    cursor: pointer;
    border-radius: 8px;
    text-align: left;
    transition: background 0.2s;
}

.attach-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.attach-option span {
    font-size: 20px;
}

/* Enhanced Input Layout (Gemini-style) */
.input-wrapper {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 12px 16px !important;
    transition: border-radius 0.2s;
}

.file-preview-area {
    position: relative !important;
    bottom: auto !important;
    left: auto !important;
    width: 100% !important;
    margin-bottom: 8px !important;
    padding: 0 !important;
    background: transparent !important;
    border-radius: 8px;
    /* Ensure it doesn't overflow horizontally */
    flex-wrap: nowrap;
    overflow-x: auto;
}

.input-row {
    display: flex;
    align-items: flex-end;
    width: 100%;
    gap: 12px;
}

.chat-file-attachment {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Fix alignment */
.input-wrapper {
    display: flex;
    align-items: center;
}

/* --- Mobile Fixes (KOYEB) --- */

@media (max-width: 768px) {

    /* 1. Dock Input to Bottom */
    .input-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: #131314;
        /* Match bg-dark */
        z-index: 1000;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
        border-top: 1px solid var(--border-subtle);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
    }

    .command-input-wrapper {
        align-items: center;
    }

    /* Prevent chat from being hidden behind input */
    .chat-container {
        padding: 10px !important;
        padding-bottom: 140px !important;
    }

    /* Message Styling on Mobile */
    .message {
        max-width: 95% !important;
    }

    .message-bg,
    .jarvis-msg,
    .user-msg {
        font-size: 1.15rem !important;
        /* Larger font */
        line-height: 1.6;
    }

    /* 2. Fix Text Alignment */
    .input-row {
        align-items: center !important;
        /* Force center alignment */
    }

    .text-input {
        padding-top: 0;
        /* Let flex align it */
    }

    /* Ensure mute button is visible and touchable */
    .user-actions {
        display: flex;
        gap: 10px;
        z-index: 1002;
    }

    /* 3. Fix Mute Button Visibility in Voice Mode */
    .voice-controls {
        z-index: 2000 !important;
        position: relative;
        pointer-events: auto;
    }

    .voice-overlay {
        z-index: 1500 !important;
        margin: 0;
        border-radius: 12px 12px 0 0;
        /* Rounded top only */
        background: rgba(15, 20, 30, 0.98);
        /* Less transparent for readability */
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        z-index: 2000;
        /* Increased z-index */
        padding: 15px;
        padding-bottom: max(20px, env(safe-area-inset-bottom));
        /* Increased base padding */
        border-bottom: none;
        border-left: none;
        border-right: none;
        box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.8);
    }

    /* Adjust main content to not be covered by fixed input */
    .dashboard-grid {
        padding-bottom: 20px;
        /* Space is now handled by the fixed input panel potentially overlap, 
            but since input panel is outside flow on mobile (fixed), 
            we need extra padding at bottom of grid */
        padding-bottom: 120px;
    }

    /* Ensure header buttons are visible */
    .top-nav {
        z-index: 1100;
        padding-right: 10px;
        position: sticky;
        top: 0;
        background: rgba(5, 5, 8, 0.9);
    }

    .user-actions .btn-futuristic {
        padding: 8px 12px;
        font-size: 0.7rem;
    }
}

/* ============== Light Theme ============== */
.light-theme {
    --bg-dark: #F8F9FA;
    --bg-sidebar: #FFFFFF;
    --bg-surface: #FFFFFF;
    --bg-surface-hover: #F1F3F4;
    --text-primary: #1F1F1F;
    --text-secondary: #444746;
    --text-placeholder: #5F6368;
    --border-subtle: #E0E2E0;
    --accent-blue-dim: rgba(26, 115, 232, 0.1);
}

.light-theme .app-header {
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.light-theme .message.user .message-content {
    background: #E8F0FE;
    color: #1A73E8;
}

.light-theme .message.assistant .message-content {
    background: #FFFFFF;
    border: 1px solid var(--border-subtle);
}

.light-theme .input-area {
    background: rgba(248, 249, 250, 0.9);
    border-top: 1px solid var(--border-subtle);
}

.light-theme .input-wrapper {
    background: #FFFFFF;
    border: 1px solid var(--border-subtle);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.light-theme .text-input {
    color: #1F1F1F;
}

.light-theme .text-input::placeholder {
    color: #5F6368;
}