/* GPTHub Styles - MTC True Tech Arena Theme */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Animations */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spinning {
    animation: spin 1s linear infinite;
}

/* Share page - always show floating header even on mobile */
.share-page .floating-header,
.share-page .app .floating-header {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* MTC Brand Colors */
:root {
    --mtc-red: #E30613;
    --mtc-red-dark: #B8050F;
    --mtc-red-light: #FF1A2E;
    
    /* Dark Theme (default) */
    --bg-primary: #0D0D0D;
    --bg-secondary: #1A1A1A;
    --bg-tertiary: #252525;
    --bg-card: #1E1E1E;
    --bg-hover: #2A2A2A;
    --bg-input: #141414;
    
    --text-primary: #FFFFFF;
    --text-secondary: #B3B3B3;
    --text-muted: #666666;
    
    --border-color: #333333;
    --border-hover: #444444;
    
    --accent-primary: var(--mtc-red);
    --accent-hover: var(--mtc-red-light);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #F5F5F5;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #F0F0F0;
    --bg-card: #FFFFFF;
    --bg-hover: #E8E8E8;
    --bg-input: #FFFFFF;
    
    --text-primary: #1A1A1A;
    --text-secondary: #4A4A4A;
    --text-muted: #888888;
    
    --border-color: #E0E0E0;
    --border-hover: #CCCCCC;
    
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    line-height: 1.5;
}

.app {
    display: flex;
    height: 100vh;
}

/* Material Icons */
.material-symbols-rounded {
    font-family: 'Material Symbols Rounded';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
    vertical-align: middle;
}

/* Show Sidebar Button (when sidebar is hidden) */
.sidebar-show-btn {
    position: fixed;
    top: 12px;
    left: 12px;
    width: 36px;
    height: 36px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: all 0.2s;
}

.sidebar-show-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-show-btn.visible {
    display: flex;
}

/* Sidebar */
.sidebar {
    width: 300px;
    min-width: 300px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 16px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed {
    width: 0;
    min-width: 0;
    padding: 0;
    border: none;
    opacity: 0;
}

/* Chat container expands when sidebar is hidden */
.app:has(.sidebar.collapsed) .chat-container {
    width: 100%;
}

.app:has(.sidebar.collapsed) .sidebar-show-btn {
    display: flex;
}

/* Logo */
.logo-img {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.mini-logo {
    width: 32px;
    height: 32px;
    overflow: hidden;
}

.mini-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Floating header with logo when sidebar is hidden */
.floating-header {
    position: fixed;
    top: 20px;
    left: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1000;
}

.app:has(.sidebar:not(.collapsed)) .floating-header {
    display: none;
}

.floating-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 100%;
}

.floating-logo-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Mobile: sidebar full screen */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        width: 100%;
        min-width: 100%;
    }

    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar.collapsed {
        transform: translateX(-100%);
        opacity: 1;
    }

    /* Hide floating header on mobile - logo is in chat-header */
    .floating-header {
        display: none !important;
    }
    
    /* Mobile chat header - with menu button and logo inside */
    .chat-header {
        padding: 10px 12px;
        min-height: 52px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    .chat-header-left {
        display: flex;
        align-items: center;
        gap: 10px;
        flex: 1;
    }
    
    .mobile-dropdown-menu.active {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
    
    .mobile-dropdown-item {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 14px;
        cursor: pointer;
        font-size: 14px;
        color: var(--text-secondary);
        transition: all 0.2s;
        white-space: nowrap;
    }
    
    .mobile-dropdown-item:hover {
        background: var(--bg-hover);
        color: var(--text-primary);
    }
    
    .mobile-dropdown-item .material-symbols-rounded {
        font-size: 18px;
    }
    
    .mobile-dropdown-item.delete {
        color: var(--mtc-red);
    }
    
    .mobile-dropdown-item.delete:hover {
        background: rgba(227, 6, 19, 0.1);
    }
    
    /* Mobile chat area adjustments */
    .messages {
        padding: 12px;
    }
    
    .message {
        max-width: 90%;
        padding: 10px 14px;
    }
    
    /* Mobile input area - smaller and more compact */
    .input-wrapper {
        padding: 8px 10px;
        margin: 0 8px 8px;
    }
    
    .input-container {
        min-height: 48px;
        padding: 8px 10px;
    }
    
    #message-input {
        font-size: 16px;
        padding: 8px 10px;
        min-height: 40px;
    }
    
    .model-selector-btn,
    .action-btn {
        width: 32px;
        height: 32px;
    }
    
    .model-selector-btn .material-symbols-rounded,
    .action-btn .material-symbols-rounded {
        font-size: 18px;
    }
    
    /* Chat container full width */
    .chat-container {
        width: 100%;
    }
    
    /* Hide floating header on mobile */
    .floating-header {
        display: none !important;
    }
    
    /* Mobile chat header layout */
    .chat-header {
        padding: 10px 12px;
        min-height: 52px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    .chat-header-left {
        display: flex;
        align-items: center;
        gap: 10px;
        flex: 1;
        min-width: 0;
    }
    
    /* Menu button inside header on the left */
    .header-menu-btn {
        display: flex !important;
        position: static;
        width: 36px;
        height: 36px;
        flex-shrink: 0;
    }
    
    /* Mobile logo inside header */
    .mobile-logo {
        display: flex !important;
        align-items: center;
        flex-shrink: 0;
    }
    
    .mobile-logo img {
        width: 28px;
        height: 28px;
    }
    
    /* Chat info takes remaining space */
    .chat-info {
        flex: 1;
        min-width: 0;
    }
    
    /* Mobile actions button (three dots) on the right */
    .mobile-actions-btn {
        display: flex !important;
        width: 36px;
        height: 36px;
        border: none;
        background: none;
        color: var(--text-secondary);
        cursor: pointer;
        align-items: center;
        justify-content: center;
        border-radius: var(--radius-sm);
        flex-shrink: 0;
    }
    
    .mobile-actions-btn:hover {
        background: var(--bg-hover);
        color: var(--text-primary);
    }
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-icon img {
    display: block;
}

.logo-text h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.badge {
    font-size: 11px;
    font-weight: 500;
    color: var(--mtc-red);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.header-actions {
    display: flex;
    gap: 8px;
}

/* Hide sidebar close on PC */
.sidebar-close {
    display: none;
}

/* Mobile: show sidebar close */
@media (max-width: 768px) {
    .sidebar-close {
        display: flex;
        width: 36px;
        height: 36px;
        border: none;
        background: none;
        color: var(--text-muted);
        cursor: pointer;
        align-items: center;
        justify-content: center;
        border-radius: var(--radius-sm);
        transition: all 0.2s;
    }

    .sidebar-close:hover {
        background: var(--bg-hover);
        color: var(--text-primary);
    }
}

.theme-toggle {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.new-chat-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    background: var(--mtc-red);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.new-chat-btn:hover {
    background: var(--mtc-red-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

/* Chat Search - same width as New Chat button */
.chat-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 10px;
}

.chat-search .material-symbols-rounded {
    font-size: 18px;
    color: var(--text-muted);
}

.chat-search input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    min-width: 0;
}

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

.sidebar-section {
    margin-bottom: 20px;
}

.sidebar-section h3 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 12px;
}

.model-select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.model-select:hover,
.model-select:focus {
    border-color: var(--mtc-red);
}

.model-select optgroup {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 600;
}

.tool-toggles {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s;
}

.toggle:hover {
    background: var(--bg-hover);
}

.toggle input {
    display: none;
}

.toggle input:checked + .material-symbols-rounded {
    color: var(--mtc-red);
}

.toggle .material-symbols-rounded {
    font-size: 20px;
    color: var(--text-muted);
    transition: color 0.2s;
}

.toggle input:checked ~ span:last-child {
    color: var(--text-primary);
}

.toggle span:last-child {
    font-size: 14px;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    margin: 0 -8px;
}

.no-results {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 4px;
    position: relative;
}

.chat-item:hover {
    background: var(--bg-hover);
}

.chat-item.active {
    background: var(--bg-hover);
    border-left: 2px solid var(--mtc-red);
}

.chat-item .material-symbols-rounded {
    font-size: 18px;
    color: var(--text-muted);
}

.chat-item span:last-child {
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Chat sections */
.pinned-section,
.all-chats-section {
    margin-bottom: 16px;
}

.chat-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chat-section-header .material-symbols-rounded {
    font-size: 16px;
}

/* Pinned chat indicator */
.chat-item.pinned {
    background: rgba(227, 6, 19, 0.05);
    border-left: 3px solid var(--mtc-red);
}

.chat-item.pinned .pinned-icon {
    color: var(--mtc-red);
    font-size: 18px;
}

.chat-item.pinned::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--mtc-red);
    border-radius: 0 2px 2px 0;
}

/* Chat menu button */
.chat-menu-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s;
    margin-left: auto;
}

.chat-item:hover .chat-menu-btn {
    opacity: 1;
}

.chat-menu-btn:hover {
    background: var(--bg-hover);
}

.chat-menu-btn .material-symbols-rounded {
    font-size: 16px;
    color: var(--text-muted);
}

/* Chat dropdown menu - hidden by default */
.chat-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    pointer-events: none;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 6px 0;
    min-width: 160px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
}

.chat-dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.chat-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.chat-dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.chat-dropdown-item .material-symbols-rounded {
    font-size: 16px;
}

.chat-dropdown-item.delete {
    color: var(--mtc-red);
}

.chat-dropdown-item.delete:hover {
    background: rgba(227, 6, 19, 0.1);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.user-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
}

.user-btn .material-symbols-rounded {
    font-size: 20px;
    color: var(--text-muted);
}

.expand-icon {
    margin-left: auto;
}

.user-dropdown {
    display: block;
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    margin-bottom: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.user-dropdown.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.user-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s;
}

.user-dropdown a:hover {
    background: var(--bg-hover);
}

.user-dropdown a .material-symbols-rounded {
    font-size: 18px;
    color: var(--text-muted);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 12px;
}

.dropdown-label {
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.logout-link {
    color: var(--mtc-red) !important;
}

.logout-link .material-symbols-rounded {
    color: var(--mtc-red) !important;
}

/* Chat Container */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    position: relative;
}

.chat-header {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 60px;
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    transition: margin-left 0.3s ease;
}

/* When sidebar is collapsed, shift header content to the right to not overlap floating logo */
.app:has(.sidebar.collapsed) .chat-header-left {
    margin-left: 140px;
}

/* Share page - shift header content to not overlap floating logo */
.share-page .chat-header-left,
body.share-page .chat-header-left {
    margin-left: 140px;
}

/* Share page - hide menu buttons completely */
.share-page .header-menu-btn,
body.share-page .header-menu-btn,
.share-page .mobile-actions,
body.share-page .mobile-actions,
.share-page .mobile-menu-btn,
body.share-page .mobile-menu-btn {
    display: none !important;
}

.header-menu-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 1001;
}

.header-menu-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.chat-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-info h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.current-model {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.current-model::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #10B981;
    border-radius: 50%;
}

.chat-header-actions {
    display: flex;
    gap: 4px;
}

/* Desktop: hide mobile actions */
.mobile-actions {
    display: none;
}

/* Mobile dropdown menu - base styles */
.mobile-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

/* Mobile: hide desktop actions */
@media (max-width: 768px) {
    .desktop-actions {
        display: none !important;
    }
    
    .mobile-actions {
        display: flex !important;
        position: relative;
    }
    
    /* Hide header menu button when sidebar is open */
    .app:has(.sidebar.open) .header-menu-btn {
        display: none !important;
    }
    
    .mobile-dropdown-menu.active {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
}

.header-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.header-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    scroll-behavior: smooth;
}

.welcome-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.welcome-logo {
display: flex;
align-items: center;
gap: 16px;
margin-bottom: 16px;
}

.welcome-logo img {
width: 60px;
height: 60px;
object-fit: contain;
}

.welcome-logo-text {
font-size: 32px;
font-weight: 700;
color: var(--text-primary);
}

.welcome-message p {
font-size: 16px;
color: var(--text-secondary);
margin-bottom: 32px;
}

.welcome-subtitle {
font-size: 16px;
color: var(--text-secondary);
margin-bottom: 32px;
}

.mode-selector {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 12px;
max-width: 500px;
width: 100%;
}

.mode-btn {
display: flex;
flex-direction: column;
align-items: center;
gap: 4px;
padding: 16px;
background: var(--bg-tertiary);
border: 2px solid var(--border-color);
border-radius: var(--radius-md);
cursor: pointer;
transition: all 0.2s;
text-align: center;
}

.mode-btn:hover {
background: var(--bg-hover);
border-color: var(--border-hover);
}

.mode-btn.active {
border-color: var(--mtc-red);
background: rgba(227, 6, 19, 0.1);
}

.mode-btn .material-symbols-rounded {
font-size: 28px;
color: var(--mtc-red);
margin-bottom: 4px;
}

.mode-label {
font-size: 14px;
font-weight: 600;
color: var(--text-primary);
}

.mode-desc {
font-size: 12px;
color: var(--text-muted);
}

/* Messages */
.message {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    max-width: 85%;
    align-items: flex-start;
}

.message.user {
    margin-left: auto;
    flex-direction: row-reverse;
}

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

.message.user .message-avatar {
    background: var(--mtc-red);
    color: white;
}

.message.assistant .message-avatar {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.message-avatar .material-symbols-rounded {
    font-size: 20px;
}

.message-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
}

.message.user .message-content {
    background: var(--bg-tertiary);
    border-color: var(--border-hover);
}

.message-content p {
    margin-bottom: 12px;
}

.message-content p:last-child {
    margin-bottom: 0;
}

/* Mobile message adjustments */
@media (max-width: 768px) {
    .message {
        max-width: 95%;
        gap: 8px;
        margin-bottom: 16px;
    }
    
    .message.assistant {
        padding-left: 0;
        margin-right: auto;
    }
    
    .message.user {
        padding-right: 0;
        margin-left: auto;
    }
    
    .message-avatar {
        width: 28px;
        height: 28px;
    }
    
    .message-avatar .material-symbols-rounded {
        font-size: 16px;
    }
    
    .message-content {
        padding: 10px 14px;
        font-size: 14px;
    }
}

.message-content pre {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
    overflow-x: auto;
    margin: 12px 0;
}

.message-content code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 13px;
}

.message-content pre code {
    background: none;
    padding: 0;
}

/* Image Lightbox Modal */
.image-lightbox-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-lightbox-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.image-lightbox-container {
    position: relative;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 95vw;
    max-height: 95vh;
}

.image-lightbox-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    background: var(--bg-secondary);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.lightbox-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.lightbox-btn .material-symbols-rounded {
    font-size: 24px;
}

/* Reasoning/Thinking block styles */
.reasoning-block {
    margin: 16px 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    overflow: hidden;
}

.reasoning-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(255, 107, 107, 0.1);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 14px;
    color: var(--mtc-red);
}

.reasoning-header .material-symbols-rounded {
    font-size: 20px;
}

.reasoning-content {
    padding: 16px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary);
}

.reasoning-content p:last-child {
    margin-bottom: 0;
}

.answer-block {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 2px solid var(--border-color);
}

/* Mobile reasoning styles */
@media (max-width: 768px) {
    .reasoning-block {
        margin: 12px 0;
    }
    
    .reasoning-header {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .reasoning-content {
        padding: 12px;
        font-size: 13px;
    }
}

.image-lightbox-content {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: calc(95vh - 80px);
    overflow: auto;
}

.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.2s ease;
    cursor: grab;
}

.lightbox-image:active {
    cursor: grabbing;
}

/* Audio Modal */
.audio-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.audio-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

.audio-modal-container {
    position: relative;
    background: var(--bg-primary);
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 1001;
}

.audio-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.audio-modal-header .material-symbols-rounded {
    font-size: 28px;
    color: var(--mtc-red);
}

.audio-modal-title {
    flex: 1;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.audio-modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.audio-modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.audio-modal-content {
    display: flex;
    justify-content: center;
}

.audio-player {
    width: 100%;
    border-radius: 8px;
}

/* Video Modal */
.video-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(4px);
}

.video-modal-container {
    position: relative;
    background: var(--bg-primary);
    border-radius: 16px;
    overflow: hidden;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 1001;
}

.video-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.video-modal-header .material-symbols-rounded {
    font-size: 28px;
    color: var(--mtc-red);
}

.video-modal-title {
    flex: 1;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.video-modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.video-modal-content {
    display: flex;
    justify-content: center;
    background: #000;
}

.video-player {
    width: 100%;
    max-height: 70vh;
}

/* Message attached files */
.message-files {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    margin-top: 8px;
    margin-bottom: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.message-files::-webkit-scrollbar {
    height: 4px;
}

.message-files::-webkit-scrollbar-track {
    background: transparent;
}

.message-files::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.message-file-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--text-secondary);
}

.message-file-item.clickable {
    cursor: pointer;
    transition: all 0.2s ease;
}

.message-file-item.clickable:hover {
    background: var(--bg-hover);
    border-color: var(--mtc-red);
}

.message-file-item .material-symbols-rounded {
    font-size: 18px;
    color: var(--mtc-red);
}

/* Custom Audio Player */
.custom-audio-player {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    width: 100%;
    min-width: 400px;
}

.audio-play-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--mtc-red);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(227, 6, 19, 0.3);
}

.audio-play-btn:hover {
    background: #ff1a2e;
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(227, 6, 19, 0.4);
}

.audio-play-btn:active {
    transform: scale(0.95);
}

.audio-play-btn .material-symbols-rounded {
    font-size: 32px;
    color: white;
}

.audio-progress-container {
    flex: 1;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.audio-progress-bar {
    height: 100%;
    background: var(--mtc-red);
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s linear;
}

.audio-time {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    min-width: 100px;
    justify-content: center;
}

.audio-volume {
    width: 80px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-tertiary);
    border-radius: 2px;
    cursor: pointer;
}

.audio-volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--mtc-red);
    cursor: pointer;
    transition: all 0.2s ease;
}

.audio-volume::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.audio-volume::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--mtc-red);
    cursor: pointer;
    border: none;
}

/* Text Modal */
.text-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.text-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

.text-modal-container {
    position: relative;
    background: var(--bg-primary);
    border-radius: 16px;
    overflow: hidden;
    width: 90%;
    max-width: 900px;
    max-height: 80vh;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 1001;
    display: flex;
    flex-direction: column;
}

.text-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.text-modal-header .material-symbols-rounded {
    font-size: 28px;
    color: var(--mtc-red);
}

.text-modal-title {
    flex: 1;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.text-modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.text-modal-content {
    flex: 1;
    overflow: auto;
    padding: 20px;
}

.text-loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 14px;
}

.text-viewer {
    margin: 0;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: calc(80vh - 140px);
    overflow: auto;
}

.message-file-name {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-file-image {
    max-width: 200px;
    max-height: 150px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

.message-file-image:hover {
    border-color: var(--border-hover);
}

/* Code toolbar with language and actions */
.code-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    padding: 8px 12px;
    font-size: 12px;
}

.code-language {
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.code-actions {
    display: flex;
    gap: 4px;
}

.code-action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.code-action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.code-action-btn .material-symbols-rounded {
    font-size: 16px;
}

/* Adjust pre to connect with toolbar */
.code-toolbar + pre {
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    margin-top: 0;
}

/* Message body wrapper (for vertical layout) */
.message-body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.message.user .message-body {
    align-items: flex-end;
}

/* Message action buttons with meta inline */
.message-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

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

.message-meta-inline {
    font-size: 12px;
    color: var(--text-muted);
    margin-right: auto;
    display: flex;
    align-items: center;
    gap: 4px;
}

.message-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}

.message-action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.message-action-btn .material-symbols-rounded {
    font-size: 18px;
}

/* Voice chat mode - hide edit/regenerate buttons */
.voice-chat-active .message-action-btn:not([title="Копировать"]) {
    display: none;
}

/* Toast notification */
.toast-notification {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translate(-50%, 10px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: translate(-50%, 0); }
    to { opacity: 0; transform: translate(-50%, -10px); }
}

.message-content img {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--radius-sm);
    margin: 12px 0;
    cursor: pointer;
    object-fit: contain;
}

/* Image Viewer Modal */
.image-viewer-modal {
display: none;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.9);
z-index: 2000;
justify-content: center;
align-items: center;
}

.image-viewer-modal.active {
display: flex;
}

.image-viewer-content {
position: relative;
max-width: 90vw;
max-height: 90vh;
display: flex;
flex-direction: column;
align-items: center;
}

.image-viewer-content img {
max-width: 100%;
max-height: 85vh;
object-fit: contain;
border-radius: var(--radius-md);
}

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

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

.image-viewer-controls {
position: absolute;
bottom: -50px;
display: flex;
gap: 12px;
}

.image-viewer-btn {
width: 40px;
height: 40px;
border: none;
background: rgba(255, 255, 255, 0.2);
color: white;
border-radius: 50%;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s;
}

.image-viewer-btn:hover {
background: rgba(255, 255, 255, 0.3);
}

/* Chat Memory Modal */
.memory-modal {
display: none;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.7);
z-index: 2000;
justify-content: center;
align-items: center;
}

.memory-modal.active {
display: flex;
}

.memory-content {
background: var(--bg-primary);
border: 1px solid var(--border-color);
border-radius: var(--radius-lg);
width: 90%;
max-width: 600px;
max-height: 80vh;
display: flex;
flex-direction: column;
box-shadow: var(--shadow-lg);
}

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

.memory-header h3 {
margin: 0;
font-size: 18px;
font-weight: 600;
color: var(--text-primary);
}

.memory-close {
width: 32px;
height: 32px;
border: none;
background: none;
color: var(--text-muted);
border-radius: var(--radius-sm);
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s;
}

.memory-close:hover {
background: var(--bg-hover);
color: var(--text-primary);
}

.memory-body {
padding: 20px;
flex: 1;
overflow-y: auto;
}

#memory-text {
width: 100%;
min-height: 150px;
max-height: 300px;
padding: 12px;
border: 1px solid var(--border-color);
border-radius: var(--radius-md);
background: var(--bg-secondary);
color: var(--text-primary);
font-size: 14px;
font-family: inherit;
resize: vertical;
outline: none;
}

#memory-text:focus {
border-color: var(--mtc-red);
}

.memory-info {
margin-top: 12px;
padding: 12px;
background: var(--bg-secondary);
border-radius: var(--radius-md);
border-left: 3px solid var(--mtc-red);
}

.memory-info p {
margin: 0;
font-size: 13px;
color: var(--text-secondary);
line-height: 1.5;
}

.memory-footer {
display: flex;
gap: 12px;
padding: 16px 20px;
border-top: 1px solid var(--border-color);
justify-content: flex-end;
}

.memory-btn {
display: flex;
align-items: center;
gap: 8px;
padding: 10px 20px;
border: none;
border-radius: var(--radius-md);
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: all 0.2s;
}

.memory-btn .material-symbols-rounded {
font-size: 18px;
}

.memory-btn-primary {
background: var(--mtc-red);
color: white;
}

.memory-btn-primary:hover {
background: var(--mtc-red-light);
transform: translateY(-1px);
}

.memory-btn-secondary {
background: var(--bg-secondary);
color: var(--text-primary);
}

.memory-btn-secondary:hover {
background: var(--bg-hover);
}

/* Long-term Memory Modal */
.long-term-memory-modal {
display: none;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.7);
z-index: 2000;
justify-content: center;
align-items: center;
}

.long-term-memory-modal.active {
display: flex;
}

.long-term-memory-content {
background: var(--bg-primary);
border: 1px solid var(--border-color);
border-radius: var(--radius-lg);
width: 90%;
max-width: 700px;
max-height: 80vh;
display: flex;
flex-direction: column;
box-shadow: var(--shadow-lg);
}

.modal-header-actions {
display: flex;
align-items: center;
gap: 12px;
position: absolute;
top: 20px;
right: 20px;
z-index: 10;
}

.memory-clear-all-btn {
display: flex;
align-items: center;
gap: 6px;
padding: 8px 16px;
background: rgba(255, 107, 107, 0.1);
border: 1px solid rgba(255, 107, 107, 0.3);
border-radius: var(--radius-md);
color: var(--mtc-red);
font-size: 14px;
cursor: pointer;
transition: all 0.2s ease;
}

.memory-clear-all-btn:hover {
background: rgba(255, 107, 107, 0.2);
border-color: var(--mtc-red);
}

.memory-clear-all-btn .material-symbols-rounded {
font-size: 18px;
}

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

.long-term-memory-header h2 {
margin: 0;
font-size: 20px;
font-weight: 600;
color: var(--text-primary);
}

.long-term-memory-body {
flex: 1;
overflow-y: auto;
padding: 20px;
}

.long-term-memory-info {
background: rgba(255, 107, 107, 0.1);
border: 1px solid rgba(255, 107, 107, 0.3);
border-radius: var(--radius-md);
padding: 16px;
margin-bottom: 20px;
}

.long-term-memory-info p {
margin: 0;
color: var(--text-primary);
font-size: 14px;
}

.long-term-memory-info .memory-clear-all-btn {
margin-top: 12px;
align-self: flex-start;
}

.long-term-memory-list {
display: flex;
flex-direction: column;
gap: 12px;
}

.memory-empty {
text-align: center;
color: var(--text-secondary);
padding: 40px 20px;
font-size: 16px;
}

.long-term-memory-item {
background: var(--bg-secondary);
border: 1px solid var(--border-color);
border-radius: var(--radius-md);
padding: 16px;
display: flex;
align-items: flex-start;
gap: 12px;
transition: all 0.2s;
}

.long-term-memory-item:hover {
border-color: var(--mtc-red);
}

.memory-item-content {
flex: 1;
}

.memory-item-key {
font-weight: 600;
color: var(--text-primary);
margin-bottom: 8px;
font-size: 15px;
}

.memory-item-value {
color: var(--text-secondary);
font-size: 14px;
line-height: 1.5;
}

.memory-item-delete {
width: 36px;
height: 36px;
border: none;
background: rgba(255, 107, 107, 0.1);
color: #ff6b6b;
border-radius: var(--radius-sm);
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s;
}

.memory-item-delete:hover {
background: rgba(255, 107, 107, 0.2);
transform: scale(1.05);
}

.settings-action-btn {
width: 40px;
height: 40px;
border: none;
background: var(--bg-secondary);
color: var(--text-primary);
border-radius: var(--radius-sm);
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s;
}

.settings-action-btn:hover {
background: var(--mtc-red);
color: white;
}

/* Lists styling with proper indentation */
.message-content ol,
.message-content ul {
padding-left: 24px;
margin: 12px 0;
}

.message-content ol li,
.message-content ul li {
margin-bottom: 8px;
line-height: 1.6;
    margin-bottom: 8px;
    line-height: 1.6;
}

.message-content ol {
    list-style-type: decimal;
}

.message-content ul {
    list-style-type: disc;
}

/* Attachment Preview - Compact Design */
.attachment-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 6px 0;
    margin-bottom: 6px;
    max-height: 80px;
    overflow-y: auto;
}

.attachment-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-size: 13px;
}

.attachment-item.too-large {
    border-color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
}

.attachment-warning {
    font-size: 11px;
    color: #ff6b6b;
    font-weight: 500;
}

.attachment-item .material-symbols-rounded {
    font-size: 14px;
    color: var(--mtc-red);
    flex-shrink: 0;
}

.attachment-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
    max-width: 120px;
}

.attachment-size {
    color: var(--text-muted);
    font-size: 10px;
    flex-shrink: 0;
}

.attachment-remove {
    width: 16px;
    height: 16px;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 50%;
    transition: all 0.2s;
    flex-shrink: 0;
}

.attachment-remove:hover {
    background: rgba(227, 6, 19, 0.1);
}

.attachment-remove .material-symbols-rounded {
    font-size: 12px;
    color: var(--text-muted);
}

.attachment-remove:hover .material-symbols-rounded {
    color: var(--mtc-red);
}

/* Editing preview */
.editing-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    margin: 0 20px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--mtc-red);
}

.editing-preview.hidden {
    display: none !important;
}

.editing-preview-content {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    overflow: hidden;
}

.editing-preview-content .material-symbols-rounded {
    font-size: 18px;
    color: var(--mtc-red);
    flex-shrink: 0;
}

.editing-text {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 30px);
}

.editing-cancel {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.editing-cancel:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.editing-cancel .material-symbols-rounded {
    font-size: 18px;
}

/* Mobile editing preview */
@media (max-width: 768px) {
    .editing-preview {
        margin: 0 12px 8px;
        padding: 6px 12px;
    }
    
    .editing-text {
        font-size: 12px;
    }
}

/* Input Area */
.input-area {
    padding: 12px 20px 20px;
    background: var(--bg-primary);
}

.input-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 10px 12px;
    transition: all 0.2s;
    min-height: 52px;
    flex-wrap: nowrap;
}

.input-container:focus-within {
    border-color: var(--mtc-red);
    box-shadow: 0 0 0 2px rgba(227, 6, 19, 0.1);
}

/* Voice chat button */
.voice-chat-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.voice-chat-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.voice-chat-btn .material-symbols-rounded {
    font-size: 20px;
}

.voice-chat-btn.hidden {
    display: none;
}

/* Attach button */
.attach-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
}

.attach-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.attach-btn .material-symbols-rounded {
    font-size: 22px;
}

#message-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.5;
    resize: none;
    padding: 6px 0;
    min-height: 22px;
    max-height: 200px;
    font-family: inherit;
}

#message-input:focus {
    outline: none;
}

#message-input::placeholder {
    color: var(--text-muted);
}

/* Input layout */
.input-left {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* Attachment Preview - Compact Design */
.attachment-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 6px 0;
    margin-bottom: 6px;
    max-height: 80px;
    overflow-y: auto;
}

/* Model selector button */
.model-selector-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    position: relative;
}

.model-selector-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.model-selector-btn .material-symbols-rounded {
    font-size: 20px;
}

/* Input model menu */
.input-model-menu {
    position: relative;
}

.model-dropdown {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    min-width: 220px;
    max-height: 70vh;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    padding: 6px 0;
}

.model-dropdown.active {
    display: block;
}

/* Tools toggle button */
.tools-toggle-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.tools-toggle-btn:hover {
    background: var(--bg-hover);
    color: var(--mtc-red);
}

.tools-toggle-btn .material-symbols-rounded {
    font-size: 22px;
}

/* Input tools menu */
.input-tools-menu {
    position: relative;
}

.tools-dropdown {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    min-width: 260px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    padding: 12px 0;
    max-height: 400px;
    overflow-y: auto;
}

.tools-dropdown.active {
    display: block;
}

.tools-section {
    padding: 0 8px;
}

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

.tools-divider {
    height: 1px;
    background: var(--border-color);
    margin: 12px 8px;
}

/* Model options */
.model-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 13px;
    color: var(--text-primary);
    border-radius: var(--radius-sm);
}

.model-option:hover {
    background: var(--bg-hover);
}

.model-option.active {
    background: rgba(227, 6, 19, 0.1);
    color: var(--mtc-red);
}

.model-option .material-symbols-rounded,
.model-option span:first-child {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.check-icon {
    margin-left: auto;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--mtc-red);
    display: none;
}

.model-option.active .check-icon {
    display: block;
}

.model-done-btn {
    background: var(--mtc-red);
    color: white !important;
    justify-content: center;
    margin: 4px 8px;
}

.model-done-btn:hover {
    background: var(--mtc-red-dark);
}

.model-done-btn .check-icon {
    display: none !important;
}

/* Tool options */
.tool-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.15s;
    border-radius: var(--radius-sm);
}

.tool-option:hover {
    background: var(--bg-hover);
}

.tool-option .material-symbols-rounded {
    font-size: 18px;
    color: var(--text-muted);
}

.tool-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 2px;
}

.tool-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.tool-desc {
    font-size: 11px;
    color: var(--text-muted);
}

.tool-toggle {
    margin-left: auto;
    width: 36px;
    height: 20px;
    border-radius: 10px;
    background: var(--bg-tertiary);
    position: relative;
    transition: background 0.2s;
}

.tool-toggle::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    top: 2px;
    left: 2px;
    transition: transform 0.2s;
}

.tool-option.active .tool-toggle {
    background: var(--mtc-red);
}

.tool-option.active .tool-toggle::after {
    transform: translateX(16px);
}

/* Active tools indicators */
.active-tools {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 4px;
}

.active-tool-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(227, 6, 19, 0.15);
    color: var(--mtc-red);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    animation: popIn 0.2s ease;
}

@keyframes popIn {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

/* Action buttons (voice/send) */
.action-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    position: relative;
}

.action-btn .material-symbols-rounded {
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Voice button */
.voice-btn {
    background: transparent;
    color: var(--text-muted);
}

.voice-btn:hover {
background: var(--bg-hover);
color: var(--text-primary);
}

/* Send button */
.send-btn {
background: var(--mtc-red);
color: white;
transform: scale(1);
opacity: 1;
}

.send-btn:hover {
background: var(--mtc-red-light);
transform: scale(1.05);
}

/* Stop button */
.stop-btn {
    background: var(--bg-tertiary);
    color: var(--mtc-red);
    border: 2px solid var(--mtc-red);
    animation: pulse 1.5s ease-in-out infinite;
}

.stop-btn:hover {
    background: var(--mtc-red);
    color: white;
    transform: scale(1.05);
}

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

.send-btn.hidden, .voice-btn.hidden, .stop-btn.hidden, .input-container.hidden {
    display: none;
}

/* Mode Badge */
.chat-badges {
    display: flex;
    align-items: center;
    gap: 6px;
}

.mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(227, 6, 19, 0.15);
    color: var(--mtc-red);
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Mode Menu Dropdown */
.mode-menu-container {
    position: relative;
}

.mode-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    padding: 8px 0;
}

.mode-dropdown.active {
    display: block;
}

.mode-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 14px;
    color: var(--text-primary);
}

.mode-option:hover {
    background: var(--bg-hover);
}

.mode-option.active {
    background: rgba(227, 6, 19, 0.1);
    color: var(--mtc-red);
}

.mode-option .material-symbols-rounded {
    font-size: 20px;
    color: var(--text-muted);
}

.mode-option.active .material-symbols-rounded {
    color: var(--mtc-red);
}

/* Touch-friendly adjustments */
@media (max-width: 768px) {
    .input-area {
        padding: 8px 12px 12px;
    }

    .input-container {
        min-height: 48px;
        padding: 10px 12px;
    }

    .action-btn, .attach-btn {
        width: 40px;
        height: 40px;
    }

    .action-btn .material-symbols-rounded,
    .attach-btn .material-symbols-rounded {
        font-size: 24px;
    }

    #message-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .mode-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        min-width: auto;
        border-radius: var(--radius-md) var(--radius-md) 0 0;
        padding: 16px 0;
        max-height: 60vh;
        overflow-y: auto;
    }
    
    .mode-option {
        padding: 14px 20px;
        font-size: 16px;
    }
    
    .mode-option .material-symbols-rounded {
        font-size: 24px;
    }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    position: relative;
}

.modal-content textarea:focus {
    border-color: var(--mtc-red);
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-buttons button {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-buttons button:first-child {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.modal-buttons button:first-child:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-buttons button.primary {
    background: var(--mtc-red);
    border: none;
    color: white;
}

.modal-buttons button.primary:hover {
    background: var(--mtc-red-light);
}

/* Profile Modal Styles */
.profile-content {
    padding: 24px;
}

.profile-header {
    text-align: center;
    margin-bottom: 32px;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    background: var(--mtc-red);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.profile-avatar .material-symbols-rounded {
    font-size: 40px;
    color: white;
}

.profile-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.profile-body {
    margin-bottom: 24px;
}

.profile-section {
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.profile-section:last-child {
    border-bottom: none;
}

.profile-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.profile-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.profile-input {
    width: 100%;
    height: 40px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-secondary);
    transition: all 0.2s;
    box-sizing: border-box;
}

.profile-input:focus {
    outline: none;
    border-color: var(--mtc-red);
    background: var(--bg-primary);
}

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

.profile-field {
    position: relative;
}

.profile-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    animation: fadeIn 0.3s ease;
}

.profile-edit {
    display: none;
    gap: 8px;
    animation: slideDown 0.3s ease;
}

.profile-field.editing .profile-display {
    display: none;
}

.profile-field.editing .profile-edit {
    display: flex;
    align-items: center;
}

.profile-edit-actions {
    display: flex;
    gap: 8px;
}

.profile-edit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.profile-edit-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.profile-edit-actions {
    display: flex;
    gap: 8px;
}

.profile-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.profile-cancel-btn {
    background: var(--bg-secondary);
    color: var(--text-muted);
}

.profile-cancel-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.profile-save-btn {
    background: var(--mtc-red);
    color: white;
}

.profile-save-btn:hover {
    background: #c90413;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

.profile-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.profile-btn:hover {
    background: var(--bg-hover);
    border-color: var(--mtc-red);
}

/* Modal Close Button */
.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-secondary);
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-close .material-symbols-rounded {
    font-size: 20px;
}

/* Settings Modal Styles */
.settings-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.settings-modal.active {
    display: flex;
}

.settings-content {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.settings-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.settings-body {
    padding: 20px 24px;
    overflow-y: auto;
}

.settings-section {
    margin-bottom: 24px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
}

.settings-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.settings-info .material-symbols-rounded {
    font-size: 20px;
    color: var(--text-muted);
}

.settings-label {
    font-weight: 500;
    color: var(--text-primary);
}

.message-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}

.message-sources {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.sources-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.sources-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.source-link {
    font-size: 13px;
    color: var(--mtc-red);
    text-decoration: none;
    transition: opacity 0.2s;
    word-break: break-all;
}

.source-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.settings-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.settings-status {
    display: flex;
    align-items: center;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.enabled {
    background: var(--mtc-red);
    color: white;
}

.version-section {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.version-info {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.version-logo {
    width: 48px;
    height: 48px;
    background: var(--mtc-red);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.version-logo .material-symbols-rounded {
    font-size: 28px;
    color: white;
}

.version-text h3 {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.version-text p {
    margin: 0;
    font-size: 14px;
    color: var(--text-muted);
}

.settings-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.settings-btn:hover {
    background: var(--bg-hover);
    border-color: var(--mtc-red);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 48px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-tertiary);
    transition: 0.3s;
    border-radius: 24px;
    border: 1px solid var(--border-color);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background: var(--text-muted);
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--mtc-red);
    border-color: var(--mtc-red);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
    background: white;
}

/* Desktop: hide mobile back button, show close button, center titles */
.mobile-back-btn {
    display: none;
}

.profile-header h2,
.settings-header h2 {
    text-align: center;
    flex: 1;
}

.settings-header {
    justify-content: center;
}

/* Mobile: Profile and Settings - Full Screen Mode */
@media (max-width: 768px) {
    .profile-modal,
    .settings-modal {
        padding: 0;
    }

    .profile-content,
    .settings-content {
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
        height: 100vh;
        overflow-y: auto;
        padding: 0;
    }

    /* Hide close button on mobile, show back button */
    .modal-close {
        display: none;
    }

    .mobile-back-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border: none;
        background: transparent;
        color: var(--text-muted);
        cursor: pointer;
        border-radius: var(--radius-sm);
        padding: 0;
    }

    .mobile-back-btn:hover {
        background: var(--bg-hover);
        color: var(--text-primary);
    }

    .mobile-back-btn .material-symbols-rounded {
        font-size: 24px;
    }

    .profile-header,
    .settings-header {
        padding: 12px 16px;
        background: var(--bg-primary);
        border-bottom: 1px solid var(--border-color);
        position: sticky;
        top: 0;
        z-index: 10;
        display: flex;
        align-items: center;
        gap: 12px;
        min-height: 56px;
        justify-content: flex-start;
    }

    .profile-header h2,
    .settings-header h2 {
        font-size: 18px;
        margin: 0;
        flex: 1;
        text-align: left;
    }

    /* Smaller avatar for mobile appbar */
    .profile-header .profile-avatar {
        width: 40px;
        height: 40px;
        margin: 0;
    }

    .profile-header .profile-avatar .material-symbols-rounded {
        font-size: 24px;
    }

    .profile-body,
    .settings-body {
        padding: 16px;
    }

    .profile-footer,
    .settings-footer {
        padding: 16px;
        border-top: 1px solid var(--border-color);
        position: sticky;
        bottom: 0;
        background: var(--bg-primary);
    }
}

/* Voice Chat Mode (Full Screen) */
.voice-chat-mode {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    z-index: 3000;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.voice-chat-mode.active {
    display: flex;
}

.voice-chat-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 10;
}

.voice-chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.voice-chat-visualizer {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-orb {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--mtc-red) 0%, transparent 70%);
    opacity: 0.3;
    transition: transform 0.1s ease-out, opacity 0.3s ease;
    will-change: transform;
}

.voice-orb.speaking {
    opacity: 0.8;
    animation: user-pulse 0.5s ease-in-out infinite;
}

.voice-orb.ai-speaking {
    opacity: 0.8;
    background: radial-gradient(circle, #00c853 0%, #64dd17 40%, transparent 70%);
    box-shadow: 0 0 60px rgba(0, 200, 83, 0.4);
    animation: ai-pulse 0.8s ease-in-out infinite;
}

.voice-orb-inner {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    margin: 40px auto;
}

@keyframes user-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.6;
    }
    50% {
        transform: scale(1.15);
        opacity: 1;
    }
}

@keyframes ai-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 40px rgba(0, 200, 83, 0.3);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 80px rgba(0, 200, 83, 0.6);
    }
}

.voice-chat-divider {
    text-align: center;
    padding: 20px;
    margin: 20px 0;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    font-weight: 500;
}

.voice-chat-start {
    margin-top: 10px;
}

.voice-chat-end {
    margin-bottom: 10px;
}

.voice-chat-divider::before,
.voice-chat-divider::after {
    content: '';
    display: inline-block;
    width: 30px;
    height: 2px;
    background: rgba(255, 255, 255, 0.3);
    vertical-align: middle;
    margin: 0 15px;
}

.voice-chat-status {
    color: white;
    font-size: 18px;
    margin-bottom: 20px;
    text-align: center;
}

.voice-chat-subtitles {
    color: rgba(255, 255, 255, 0.8);
    font-size: 16px;
    margin-bottom: 40px;
    text-align: center;
    max-width: 80%;
    min-height: 24px;
}

.voice-chat-controls {
    margin-bottom: 40px;
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: center;
    position: relative;
    height: 80px;
}

.voice-chat-record-btn {
    width: 80px;
    height: 80px;
    border: none;
    border-radius: 50%;
    background: var(--mtc-red);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(227, 6, 19, 0.4);
    position: relative;
    z-index: 2;
}

.voice-chat-record-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(227, 6, 19, 0.6);
}

.voice-chat-record-btn.recording {
    background: linear-gradient(135deg, #ff4444 0%, #ff6666 100%);
    animation: recording-pulse 1s ease-in-out infinite;
}

.voice-chat-record-btn .material-symbols-rounded {
    font-size: 36px;
    transition: transform 0.3s ease;
}

.voice-chat-stop-btn {
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #333 0%, #444 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    transform: scale(1);
    position: relative;
    z-index: 1;
}

.voice-chat-stop-btn:hover {
    background: linear-gradient(135deg, #444 0%, #555 100%);
    transform: scale(1.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.voice-chat-send-btn {
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--mtc-red) 0%, #ff4444 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    transform: scale(1);
    position: relative;
    z-index: 1;
}

.voice-chat-send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 20px rgba(227, 6, 19, 0.4);
}

.voice-chat-record-btn.hidden {
    display: none !important;
}

.voice-chat-send-btn.hidden {
    display: none !important;
}

.voice-chat-stop-btn.hidden {
    display: none !important;
}

/* Button visibility transitions */
.voice-chat-record-btn,
.voice-chat-send-btn,
.voice-chat-stop-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes recording-pulse {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(255, 68, 68, 0.4);
    }
    50% {
        box-shadow: 0 4px 40px rgba(255, 68, 68, 0.8);
    }
}

/* Button entrance animations */
@keyframes btn-pop-in {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    70% {
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.voice-chat-stop-btn:not(.hidden) {
    animation: btn-pop-in 0.3s ease-out;
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -100%;
        height: 100vh;
        z-index: 100;
        transition: left 0.3s;
    }

    .sidebar.open {
        left: 0;
    }

    .messages {
        padding: 16px;
    }

    .message {
        max-width: 95%;
    }

    .message-sources {
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid var(--border-color);
        width: 100%;
        margin-left: 0;
    }
    
    .sources-list {
        width: 100%;
    }
    
    .source-link {
        display: flex;
        align-items: center;
        gap: 6px;
    }
    
    .source-link .material-symbols-rounded {
        font-size: 16px;
        flex-shrink: 0;
    }

    .sources-list {
        gap: 8px;
    }

    .source-item {
        padding: 10px 12px;
    }

    .source-item-title {
        font-size: 13px;
    }

    .source-item-url {
        font-size: 11px;
    }

    .welcome-message {
        height: auto;
        min-height: auto;
        padding: 20px 0;
    }
    
    .welcome-logo {
        margin-bottom: 12px;
    }
    
    .welcome-logo img {
        width: 48px;
        height: 48px;
    }
    
    .welcome-logo-text {
        font-size: 24px;
    }
    
    .welcome-message h2 {
        font-size: 20px;
    }
    
    .welcome-subtitle {
        font-size: 14px;
        margin-bottom: 20px;
    }
    
    .mode-selector {
        grid-template-columns: 1fr;
        gap: 8px;
        max-width: 300px;
    }
    
    .mode-btn {
        padding: 12px;
    }
    
    .mode-label {
        font-size: 14px;
    }
    
    .mode-desc {
        font-size: 12px;
    }
}

/* Typing indicator - animated three dots */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 16px;
}

.typing-indicator span {
    width: 10px;
    height: 10px;
    background: var(--mtc-red);
    border-radius: 50%;
    animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(1) {
    animation-delay: 0s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Loading animation */
.loading {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    padding: 8px 16px;
}

.loading span {
    width: 8px;
    height: 8px;
    background: var(--mtc-red);
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite both;
}

.loading span:nth-child(1) { animation-delay: -0.32s; }
.loading span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Loading indicator for image generation */
.loading-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    color: var(--text-secondary);
    font-size: 14px;
}

.loading-indicator .material-symbols-rounded {
    font-size: 24px;
    color: var(--mtc-red);
    animation: pulse 1.5s ease-in-out infinite;
}

.stop-research-btn {
    background: var(--bg-hover);
    border: none;
    color: var(--mtc-red);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    transition: all 0.2s ease;
    margin-left: auto;
}

.stop-research-btn:hover {
    background: rgba(255, 107, 107, 0.2);
}

.stop-research-btn .material-symbols-rounded {
    font-size: 18px;
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; transform: scale(0.95); }
    50% { opacity: 1; transform: scale(1.05); }
}

/* Error message */
.error-message {
    background: rgba(227, 6, 19, 0.1);
    border: 1px solid rgba(227, 6, 19, 0.3);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    color: var(--mtc-red);
    font-size: 14px;
    margin: 8px 0;
}

/* File attachment */
.file-attachment {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.file-attachment .material-symbols-rounded {
    font-size: 18px;
    color: var(--mtc-red);
}

/* Regenerate Modal */
.regenerate-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.regenerate-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
}

.regenerate-modal-content {
    position: relative;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 24px;
    min-width: 320px;
    max-width: 400px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.regenerate-modal-content h3 {
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 500;
}

/* Scroll to bottom button */
.scroll-to-bottom-btn {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 100;
}

.scroll-to-bottom-btn:hover {
    background: var(--bg-tertiary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.scroll-to-bottom-btn.hidden {
    display: none !important;
}

.scroll-to-bottom-btn .material-symbols-rounded {
    font-size: 24px;
    color: var(--text-secondary);
}

.regenerate-model-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
    max-height: 300px;
    overflow-y: auto;
}

.regenerate-model-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.2s;
}

.regenerate-model-option:hover {
    background: var(--bg-hover);
}

.regenerate-model-option .material-symbols-rounded {
    font-size: 20px;
}

.regenerate-cancel-btn {
    width: 100%;
    padding: 12px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.regenerate-cancel-btn:hover {
    background: var(--bg-hover);
}

/* Document tool with submenu */
.tool-option.document-tool {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
}

.tool-option.document-tool .tool-main {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    cursor: pointer;
}

/* Document type submenu - animated slide down */
.doc-type-submenu {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-tertiary);
    border-top: 1px solid var(--bg-hover);
}

.doc-type-submenu.show {
    max-height: 60px;
    opacity: 1;
    transform: translateY(0);
    padding: 10px 12px;
}

/* Toggle button group */
.toggle-button-group {
    display: flex;
    gap: 4px;
    background: var(--bg-primary);
    padding: 4px;
    border-radius: var(--radius-md);
}

.toggle-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    justify-content: center;
}

.toggle-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.toggle-btn.active {
    background: var(--mtc-red);
    color: white;
    box-shadow: 0 2px 8px rgba(227, 6, 19, 0.3);
}

.toggle-btn .material-symbols-rounded {
    font-size: 18px;
}
