/* 
   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));
    }
}


/* ============== Profile Dropdown ============== */
.profile-dropdown-wrapper {
    position: relative;
    z-index: 100;
}

.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;
}

.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: 'Roboto', 'Google Sans', sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    overflow: hidden;
}

/* --- 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;
}

.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;
    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;
    /* transparent background in main area */
}

.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-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: flex-end;
    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;
    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 {
    border-top: 100px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    /* Center align chips */
    margin-top: 20px;
}

.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);
}

@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);
}

/* Text Input */
.text-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.1rem;
    outline: none;
    height: 24px;
    resize: none;
    /* Fix height */
}

.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-sidebar {
        position: fixed;
        left: -280px;
        height: 100%;
    }

    .app-sidebar.open {
        transform: translateX(280px);
    }

    .menu-btn {
        display: block;
    }

    .brand {
        opacity: 1;
    }

    .message {
        max-width: 90%;
    }

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

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

    .suggestion-chips {
        display: none;
    }

    .welcome-screen {
        justify-content: center;
        padding-bottom: 100px;
    }

    .start-mode .input-area {
        padding: 20px;
    }
}

/* 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;
}

.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-area {
        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);
    }

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

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

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

/* 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;
}