* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-dark: #050505;
    --bg-page: #0a0a0a;
    --glass-surface: rgba(20, 20, 20, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.03);
    --text-primary: #ededed;
    --text-secondary: #a1a1a1;
    --text-muted: #525252;
    --accent-primary: #fff;
    --accent-glow: rgba(255, 255, 255, 0.15);
    --accent-blue: #60a5fa;
    --accent-green: #22c55e;
    --accent-red: #ef4444;
    --accent-yellow: #f59e0b;
    --accent-color: #60a5fa;
    --font-sans: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --input-bg: rgba(255, 255, 255, 0.05);
    --hover-bg: rgba(255, 255, 255, 0.1);
    --border-color: rgba(255, 255, 255, 0.1);
}

/* Light Theme */
[data-theme="light"] {
    --bg-dark: #ffffff;
    --bg-page: #f5f5f5;
    --glass-surface: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(0, 0, 0, 0.1);
    --glass-highlight: rgba(0, 0, 0, 0.03);
    --text-primary: #1a1a1a;
    --text-secondary: #525252;
    --text-muted: #a1a1a1;
    --accent-glow: rgba(0, 0, 0, 0.1);
    --accent-color: #3b82f6;
    --input-bg: #f5f5f5;
    --hover-bg: #e5e5e5;
    --border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .main {
    background: var(--bg-page);
}

/* ==================== */
/* Toast Notification System */
/* ==================== */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    min-width: 320px;
    max-width: 420px;
    background: linear-gradient(145deg, #1a1a1a 0%, #0f0f0f 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    backdrop-filter: blur(20px);
    pointer-events: auto;
    animation: toastSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: top right;
}

.toast.hiding {
    animation: toastSlideOut 0.3s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(100%) scale(0.8);
    }
}

.toast-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toast-icon i,
.toast-icon svg {
    width: 14px;
    height: 14px;
}

.toast.success .toast-icon {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.3);
}

.toast.error .toast-icon {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
}

.toast.warning .toast-icon {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-yellow);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
}

.toast.info .toast-icon {
    background: rgba(96, 165, 250, 0.15);
    color: var(--accent-blue);
    box-shadow: 0 0 12px rgba(96, 165, 250, 0.3);
}

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.3;
}

.toast-message {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.toast-close {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    margin: -4px -4px -4px 0;
}

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

.toast-close i,
.toast-close svg {
    width: 14px;
    height: 14px;
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--accent-color);
    border-radius: 0 0 14px 14px;
    animation: toastProgress linear forwards;
}

.toast.success .toast-progress { background: var(--accent-green); }
.toast.error .toast-progress { background: var(--accent-red); }
.toast.warning .toast-progress { background: var(--accent-yellow); }
.toast.info .toast-progress { background: var(--accent-blue); }

@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}

/* Light mode toast */
[data-theme="light"] .toast {
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.12),
        0 0 0 1px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .toast-close:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* ==================== */
/* Custom Confirm Modal */
/* ==================== */
#customConfirmModal {
    z-index: 99999;
}

.custom-confirm-box {
    width: 400px;
    max-width: 90vw;
    text-align: center;
    padding: 32px 28px 24px;
    background: linear-gradient(145deg, #1a1a1a 0%, #0f0f0f 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

.custom-confirm-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: var(--accent-yellow);
}

.custom-confirm-icon i,
.custom-confirm-icon svg {
    width: 28px;
    height: 28px;
}

.custom-confirm-icon.danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
}

.custom-confirm-icon.info {
    background: rgba(96, 165, 250, 0.1);
    border-color: rgba(96, 165, 250, 0.2);
    color: var(--accent-blue);
}

.custom-confirm-icon.success {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.2);
    color: var(--accent-green);
}

.custom-confirm-box .dialog-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.custom-confirm-box .dialog-message {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.5;
}

.custom-confirm-box .dialog-actions {
    justify-content: center;
    gap: 12px;
}

.custom-confirm-box .dialog-btn {
    min-width: 100px;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.custom-confirm-box .dialog-btn.cancel {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.custom-confirm-box .dialog-btn.cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.custom-confirm-box .dialog-btn.confirm {
    background: linear-gradient(135deg, var(--accent-color) 0%, #3b82f6 100%);
    border: none;
    box-shadow: 0 4px 12px rgba(96, 165, 250, 0.3);
}

.custom-confirm-box .dialog-btn.confirm:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(96, 165, 250, 0.4);
}

.custom-confirm-box .dialog-btn.confirm.danger {
    background: linear-gradient(135deg, var(--accent-red) 0%, #dc2626 100%);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.custom-confirm-box .dialog-btn.confirm.danger:hover {
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
}

/* Light mode confirm modal */
[data-theme="light"] .custom-confirm-box {
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .custom-confirm-box .dialog-btn.cancel {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .custom-confirm-box .dialog-btn.cancel:hover {
    background: rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.15);
}



/* Light mode dropdown fixes */
[data-theme="light"] .dropdown-menu {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .dropdown-search {
    background: #ffffff;
}

[data-theme="light"] .dropdown-search input {
    background: #f5f5f5;
    border-color: rgba(0, 0, 0, 0.1);
    color: #1a1a1a;
}

[data-theme="light"] .dropdown-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .dropdown-item.selected {
    background: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .dropdown-group-label {
    border-top-color: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .model-select {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .dropdown-selected {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .dropdown-selected:hover {
    background: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .dropdown-selected::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%231a1a1a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

/* Light mode web search button */
[data-theme="light"] .input-action-btn.web-search-active {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
}

[data-theme="light"] .web-search-badge {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
}

[data-theme="light"] .search-source-link {
    background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .search-source-link:hover {
    background: rgba(0, 0, 0, 0.06);
}

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

/* Hide Scrollbar */
::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

* {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* Loading Screen */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    transition: opacity 0.8s ease-in-out;
}

.loading-content {
    opacity: 0;
    animation: fadeInLogo 1.5s ease-out forwards;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.loading-logo {
    width: 160px;
    height: 160px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 20px;
    object-fit: contain;
}

[data-theme="light"] .loading-logo {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.loading-text {
    color: white;
    font-family: 'Inter', sans-serif;
    font-size: 24px;
    letter-spacing: 8px;
    font-weight: 300;
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
}

.loading-text::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
    animation: shine 2s infinite 1s;
}

.loading-bar-container {
    width: 200px;
    height: 2px;
    background: rgba(255, 255, 255, 0.2);
    margin-top: 20px;
    position: relative;
    overflow: hidden;
}

.loading-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: white;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    animation: loadProgress 2.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes fadeInLogo {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }

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

@keyframes shine {
    0% {
        left: -100%;
    }

    50%,
    100% {
        left: 100%;
    }
}

@keyframes loadProgress {
    0% {
        width: 0%;
    }

    50% {
        width: 70%;
    }

    100% {
        width: 100%;
    }
}

body.loaded #loading-screen {
    opacity: 0;
    pointer-events: none;
}

body.loaded {
    overflow: auto;
}

/* Light mode loading screen */
[data-theme="light"] #loading-screen {
    background: #ffffff;
}

[data-theme="light"] .loading-text {
    color: #1a1a1a;
}

[data-theme="light"] .loading-text::after {
    background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.3), transparent);
}

[data-theme="light"] .loading-bar-container {
    background: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .loading-bar {
    background: #1a1a1a;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .loading-logo {
    filter: none;
}

/* Sidebar */
.sidebar {
    width: 60px;
    background: var(--glass-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    position: relative;
}

.sidebar:hover {
    width: 280px;
}





.sidebar-header {
    padding: 0;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    min-height: 60px;
}

.sidebar:hover .sidebar-header {
    width: auto;
    justify-content: flex-start;
    min-width: 280px;
    padding: 1.5rem;
    gap: 0.75rem;
}

.sidebar .logo-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
    transition: opacity 0.2s, width 0.3s;
}

.sidebar:hover .logo-text {
    opacity: 1;
    width: auto;
}

/* Logo mark always visible */
.sidebar .logo-mark {
    flex-shrink: 0;
}

/* Center logo when collapsed - remove gap */
.sidebar .logo {
    gap: 0;
}

.sidebar:hover .logo {
    gap: 0.75rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-mark {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass-highlight);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 6px;
}

.logo-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: transparent;
}

.logo-text {
    font-weight: 500;
    font-size: 1.125rem;
    letter-spacing: 0.05em;
    color: var(--text-primary);
}

.new-chat-btn {
    width: 32px;
    height: 32px;
    background: var(--glass-highlight);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.new-chat-btn:hover {
    background: var(--glass-border);
    transform: scale(1.05);
}

.sidebar-nav {
    padding: 0.75rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 8px;
}

.nav-header:hover {
    background: var(--glass-highlight);
    color: var(--text-secondary);
}

.nav-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.nav-content.collapsed {
    max-height: 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.6rem 0.75rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
}

.sidebar-nav a:hover {
    background: var(--glass-highlight);
    color: var(--text-primary);
}

.sidebar-nav a.active {
    background: var(--accent-glow);
    color: var(--text-primary);
}

/* Sidebar collapsed state - hide text, show only icons */
.sidebar .sidebar-search {
    opacity: 0;
    visibility: hidden;
    height: 0;
    overflow: hidden;
    transition: opacity 0.2s, visibility 0.2s, height 0.3s;
}

.sidebar:hover .sidebar-search {
    opacity: 1;
    visibility: visible;
    height: auto;
}

/* Hide nav header (Features text) when collapsed */
.sidebar .nav-header {
    display: none;
}

.sidebar:hover .nav-header {
    display: flex;
}

/* Show nav-content (feature links) when collapsed */
.sidebar .nav-content {
    display: flex !important;
    max-height: none !important;
}

/* Style nav-section links when collapsed */
.sidebar .nav-section .nav-content a {
    justify-content: center;
    padding: 0.75rem;
    width: 42px;
    height: 42px;
    margin: 0 auto;
    gap: 0;
}

.sidebar:hover .nav-section .nav-content a {
    justify-content: flex-start;
    padding: 0.6rem 0.75rem;
    width: auto;
    height: auto;
    margin: 0;
    gap: 12px;
}

/* Nav links - center icons when collapsed */
.sidebar .sidebar-nav>a {
    justify-content: center;
    padding: 0.75rem;
    width: 42px;
    height: 42px;
    margin: 0 auto;
    gap: 0;
}

.sidebar:hover .sidebar-nav>a {
    justify-content: flex-start;
    padding: 0.6rem 0.75rem;
    width: auto;
    height: auto;
    margin: 0;
    gap: 12px;
}

/* Hide nav link text when collapsed */
.sidebar .sidebar-nav a .nav-text,
.sidebar .sidebar-nav a .shortcut-hint {
    display: none;
}

.sidebar:hover .sidebar-nav a .nav-text {
    display: inline;
}

.sidebar:hover .sidebar-nav a .shortcut-hint {
    display: inline;
}

/* Make icons visible and centered when collapsed */
.sidebar .sidebar-nav a i,
.sidebar .sidebar-nav a svg {
    width: 20px !important;
    height: 20px !important;
    flex-shrink: 0;
    color: inherit;
}

.sidebar:hover .sidebar-nav a i,
.sidebar:hover .sidebar-nav a svg {
    width: 18px !important;
    height: 18px !important;
}

.account-status {
    padding: 0.75rem;
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.75rem;
}

.account-status .status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.account-status .user-info {
    color: var(--gray-600);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gray-400);
}

.account-status .status-dot.online {
    background: #22c55e;
}

.account-status button {
    font-family: inherit;
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.375rem 0.6rem;
    border: 1px solid var(--glass-border);
    background: transparent;
    color: var(--text-primary);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.account-status button:hover {
    background: var(--glass-highlight);
}

.history-label {
    padding: 1.5rem 1.5rem 0.75rem;
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 600;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.history-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    border-radius: 8px;
    margin: 0 0.5rem;
    color: var(--text-secondary);
    transition: background 0.2s;
}

.history-item:hover {
    background: var(--glass-highlight);
}

.history-item.active {
    background: var(--glass-highlight);
    color: var(--text-primary);
}

.history-item-content {
    flex: 1;
    min-width: 0;
}

.history-item-title {
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Right Sidebar - Memory/History */
.sidebar-right {
    width: 60px;
    background: var(--glass-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    position: relative;
}

.sidebar-right:hover {
    width: 280px;
}

.sidebar-right-header {
    padding: 0;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    min-height: 60px;
}

.sidebar-right:hover .sidebar-right-header {
    width: auto;
}

.sidebar-right:hover .sidebar-right-header {
    justify-content: space-between;
    min-width: 280px;
    padding: 1rem 1.5rem;
}

.sidebar-right .history-label {
    opacity: 0;
    width: 0;
    overflow: hidden;
    white-space: nowrap;
    transition: opacity 0.2s, width 0.3s;
    padding: 0;
    margin: 0;
}

.sidebar-right:hover .history-label {
    opacity: 1;
    width: auto;
}

.sidebar-right .new-chat-btn {
    flex-shrink: 0;
}

.sidebar-right .sidebar-search {
    opacity: 0;
    visibility: hidden;
    height: 0;
    overflow: hidden;
    transition: opacity 0.2s, visibility 0.2s, height 0.3s;
}

.sidebar-right:hover .sidebar-search {
    opacity: 1;
    visibility: visible;
    height: auto;
}

.sidebar-right .history-list {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.sidebar-right:hover .history-list {
    opacity: 1;
    visibility: visible;
}

/* Visual Polish (Round 11 & 12) */

/* 1. Light Mode Profile Icon - Force Black */
/* 1. Light Mode Profile Icon - Glass Style */
/* 1. Light Mode Profile Icon - Glass Style (Standardized) */
[data-theme="light"] .profile-avatar {
    /* Match theme-toggle in light mode */
    background: var(--glass-highlight);
    border-color: var(--glass-border);
    color: var(--text-secondary);
}

/* 2. Comparison +/- Button Professional Style */
#addModel3Btn {
    width: 38px;
    height: 38px;
    /* Matches dropdown height approx (14.4px font + 16px padding + 2px border = 32.4px? No. Default line-height 1.5 * 14.4 = 21.6 + 16 = 37.6. So ~38px is closest.) */
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass-highlight);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

#addModel3Btn:hover {
    background: var(--glass-border);
    color: var(--text-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 3. Fix Comparison Dropdown Sizing to Match Main Dropdown */
#compareControls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: -4px;
}

#compareControls .custom-dropdown {
    min-width: 180px;
}

#compareControls #model3Dropdown {
    min-width: 200px;
}

/* VS text styling */
.compare-vs-text {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1;
}

/* Ensure text doesn't overflow */
#compareControls .dropdown-selected-text,
#compareControls .dropdown-selected {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


.history-item-date {
    font-size: 0.625rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.history-item-delete {
    opacity: 0;
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1rem;
}

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

.history-item-delete:hover {
    color: var(--black);
}

/* History Item 3-Dot Menu */
.history-item-menu {
    position: relative;
    opacity: 0;
    transition: opacity 0.2s;
}

.history-item:hover .history-item-menu {
    opacity: 1;
}

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

.history-menu-btn:hover {
    background: var(--glass-border);
    color: var(--text-primary);
}

.history-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 140px;
    background: var(--glass-surface);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 4px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(20px);
}

.history-menu-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(4px);
}

.history-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s;
}

.history-menu-item:hover {
    background: var(--glass-highlight);
    color: var(--text-primary);
}

.history-menu-item.delete {
    color: var(--accent-red);
}

.history-menu-item.delete:hover {
    background: rgba(239, 68, 68, 0.1);
}

.history-menu-divider {
    height: 1px;
    background: var(--glass-border);
    margin: 4px 0;
}

/* Light mode menu styles */
[data-theme="light"] .history-menu-dropdown {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .history-menu-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Main content */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-page);
}

header {
    background: transparent;
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    z-index: 10;
}

.model-select {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(20, 20, 20, 0.6);
    padding: 6px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.status-refresh-btn {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-right: 4px;
}

.status-refresh-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.1);
}

.status-refresh-btn i {
    width: 14px;
    height: 14px;
}

.status-refresh-btn.spinning i {
    animation: spin 1s linear infinite;
}

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

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

.auth-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(20, 20, 20, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(12px);
}

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

.auth-pill.connected {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

.auth-pill.connected:hover {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.5);
}

.auth-pill i {
    width: 14px;
    height: 14px;
}

@media (max-width: 768px) {
    .auth-text {
        display: none;
    }

    .auth-pill {
        padding: 8px;
        border-radius: 8px;
    }
}

/* Checkmark */
.dropdown-item.selected::after {
    content: '✓';
    font-size: 0.75rem;
    color: #22c55e;
    margin-left: auto;
    flex-shrink: 0;
}

.dropdown-search {
    padding: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    position: sticky;
    top: 0;
    background: #141414;
    z-index: 1;
}

.dropdown-search input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-family: inherit;
    font-size: 0.875rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--text-primary);
    outline: none;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #141414;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    /* No scrolling X */
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
}

.custom-dropdown.open .dropdown-menu,
.custom-dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    /* Reset gap, using margin on dot */
    white-space: nowrap;
    /* Single line */
}

.dropdown-selected {
    font-family: inherit;
    font-size: 0.9rem;
    padding: 0.5rem 2.5rem 0.5rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    user-select: none;
    white-space: nowrap;
}

.model-select label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    padding-left: 4px;
    font-weight: 600;
}

.model-select select {
    font-family: inherit;
    font-size: 0.9rem;
    padding: 0.5rem 2.5rem 0.5rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
    border-radius: 8px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23ededed' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: all 0.2s;
}

.model-select select:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.model-select select:focus {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.model-select select option {
    background: #1a1a1a;
    color: var(--text-primary);
}

/* Custom Dropdown */
.custom-dropdown {
    position: relative;
    min-width: 200px;
}

.dropdown-selected {
    font-family: inherit;
    font-size: 0.9rem;
    padding: 0.5rem 2.5rem 0.5rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    user-select: none;
}

.dropdown-selected::after {
    content: '';
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23ededed' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    transition: transform 0.2s;
    position: absolute;
    right: 10px;
}

.custom-dropdown.open .dropdown-selected::after,
.custom-dropdown.active .dropdown-selected::after {
    transform: rotate(180deg);
}

.dropdown-selected:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #141414;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
}

.custom-dropdown.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-group-label {
    padding: 0.75rem 1rem 0.5rem;
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 600;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.dropdown-group-label:first-child {
    border-top: none;
}

.dropdown-item {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.dropdown-item.selected {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.dropdown-item.selected::after {
    content: '✓';
    font-size: 0.75rem;
    color: #22c55e;
    margin-left: auto;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #525252;
    /* Default: Unknown (Gray) */
    flex-shrink: 0;
    transition: background-color 0.3s;
    margin-right: 12px;
    /* Distinct spacing */
}

.status-indicator.online {
    background: #22c55e;
    box-shadow: 0 0 5px rgba(34, 197, 94, 0.4);
}

.status-indicator.offline {
    background: #ef4444;
}

.status-indicator.checking {
    background: #eab308;
    animation: pulse-check 1s infinite;
}

@keyframes pulse-check {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

.dropdown-search {
    padding: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    position: sticky;
    top: 0;
    background: #141414;
    z-index: 1;
    display: flex;
    gap: 8px;
    align-items: center;
}

.dropdown-search input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    font-family: inherit;
    font-size: 0.875rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--text-primary);
    outline: none;
}

.status-refresh-btn {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

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

.status-refresh-btn i {
    width: 14px;
    height: 14px;
}

.status-refresh-btn.spinning i {
    animation: spin 1s linear infinite;
}

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

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

.dropdown-search input:focus {
    border-color: rgba(255, 255, 255, 0.2);
}

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

.content {
    flex: 1;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 0 2rem 2rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    transition: max-width 0.3s ease;
}

/* Expand content area when compare mode is active */
.chat-container.compare-mode~.input-area,
.chat-container.compare-mode {
    max-width: none;
}

.main:has(.chat-container.compare-mode) .content {
    max-width: 1400px;
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 1rem;
    padding-bottom: 2rem;
}

.message {
    margin-bottom: 2rem;
    animation: fadeIn 0.4s ease;
    position: relative;
}

/* Message content wrapper */
.message-wrapper {
    position: relative;
    padding-bottom: 8px;
}

.message.assistant .message-wrapper {
    background: var(--glass-highlight);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem 1.25rem 1.25rem;
}

/* Copy button - on bottom border, right side */
.message-copy-btn {
    position: absolute;
    bottom: -12px;
    right: 16px;
    opacity: 0;
    transition: all 0.2s;
    background: var(--bg-page);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    border-radius: 6px;
    padding: 5px 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.7rem;
    font-family: inherit;
    z-index: 1;
}

.message:hover .message-copy-btn {
    opacity: 1;
}

.message-copy-btn:hover {
    color: var(--text-primary);
    background: var(--glass-surface);
    border-color: var(--text-muted);
}

.message-copy-btn.copied {
    color: #22c55e;
    border-color: #22c55e;
    background: var(--bg-page);
}

/* Collapse button */
.message-collapse-btn {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0.7;
    transition: all 0.2s;
    background: var(--bg-page);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.65rem;
    font-family: inherit;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.message:hover .message-collapse-btn,
.message-collapse-btn:hover {
    opacity: 1;
}

.message-collapse-btn:hover {
    color: var(--text-primary);
    background: var(--glass-surface);
    border-color: var(--text-muted);
    transform: translateX(-50%) translateY(-1px);
}

/* Collapsed message state - smooth transition */
.message-wrapper .message-content {
    overflow: hidden;
    position: relative;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.message-wrapper.collapsed .message-content {
    max-height: 80px !important;
}

.message-wrapper .message-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: linear-gradient(to bottom, transparent, var(--glass-highlight));
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.message-wrapper.collapsed .message-content::after {
    opacity: 1;
}

.message.user .message-wrapper.collapsed .message-content::after {
    background: linear-gradient(to bottom, transparent, var(--bg-page));
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

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

.message-label {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.message-label-text {
    display: flex;
    align-items: center;
    gap: 8px;
}

.model-tag {
    font-size: 0.625rem;
    background: var(--glass-highlight);
    border: 1px solid var(--glass-border);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.message-content {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-primary);
}

.message.assistant .message-content {
    background: transparent;
    padding: 0;
    border: none;
}

.message.user {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.message.user .message-label {
    justify-content: flex-end;
}

.message.user .message-label-text {
    color: #60a5fa;
}

.message.user .message-wrapper {
    background: transparent;
    border: none;
    padding: 0;
    max-width: 80%;
}

.message.user .message-content {
    background: var(--glass-highlight);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 1rem 1.5rem;
    border-radius: 20px 20px 4px 20px;
    backdrop-filter: blur(10px);
}

.message.user .message-copy-btn {
    right: auto;
    left: 16px;
}

/* Compact Mode - Reduced spacing */
body.compact-mode .message {
    margin-bottom: 1rem;
}

body.compact-mode .message.assistant .message-wrapper {
    padding: 0.75rem 1rem 1rem;
}

body.compact-mode .message.user .message-content {
    padding: 0.75rem 1rem;
}

body.compact-mode .message-content {
    font-size: 0.9rem;
    line-height: 1.6;
}

body.compact-mode .message-label {
    margin-bottom: 0.5rem;
}

body.compact-mode .chat-container {
    padding: 1rem 1.5rem;
}

/* Math rendering styles */
.math-display {
    overflow-x: auto;
    padding: 1rem 0;
    text-align: center;
}

.math-error {
    color: var(--accent-red);
    font-family: var(--font-mono);
}

.katex {
    font-size: 1.1em;
}

.katex-display {
    margin: 0.5em 0;
}

/* Reasoning/Thinking block styles */
.reasoning-block {
    margin-bottom: 1rem;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(96, 165, 250, 0.05);
}

.reasoning-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.6rem 1rem;
    background: rgba(96, 165, 250, 0.1);
    cursor: pointer;
    user-select: none;
    font-size: 0.8rem;
    color: var(--accent-blue);
    font-weight: 500;
    transition: background 0.2s;
}

.reasoning-header:hover {
    background: rgba(96, 165, 250, 0.15);
}

.reasoning-header i {
    transition: transform 0.2s;
}

.reasoning-block.collapsed .reasoning-header i {
    transform: rotate(-90deg);
}

.reasoning-content {
    padding: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    border-top: 1px solid var(--glass-border);
    max-height: 300px;
    overflow-y: auto;
}

.reasoning-block.collapsed .reasoning-content {
    display: none;
}

.reasoning-content p {
    margin: 0.5rem 0;
}

.thinking-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 1rem 0;
    padding-left: 4px;
}

.thinking-orb {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #333 0%, #1a1a1a 100%);
    position: relative;
    animation: pulse-orb 2s ease-in-out infinite;
}

.thinking-orb::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: spin-ring 1.5s linear infinite;
}

.thinking-orb::after {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #444, #1a1a1a);
}

.thinking-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.thinking-status {
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 500;
}

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

.thinking-dots span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: dot-bounce 1.4s ease-in-out infinite;
}

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

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

@keyframes pulse-orb {

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

    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

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

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

@keyframes dot-bounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

/* Shimmer effect for streaming text */
.streaming-cursor::after {
    content: '▊';
    animation: blink 1s step-end infinite;
    color: var(--text-primary);
    margin-left: 2px;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }

    50% {
        opacity: 0;
    }
}

/* File Attachment Collapsible */
details.file-attachment {
    background: var(--glass-highlight);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    margin-top: 1rem;
    overflow: hidden;
}

details.file-attachment summary {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--accent-blue);
    font-weight: 500;
    user-select: none;
    background: rgba(0, 0, 0, 0.2);
}

details.file-attachment summary:hover {
    background: rgba(255, 255, 255, 0.05);
}

details.file-attachment pre {
    margin: 0 !important;
    border: none !important;
    border-top: 1px solid var(--glass-border) !important;
    border-radius: 0 !important;
}

/* Light mode file attachment */
[data-theme="light"] details.file-attachment {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] details.file-attachment summary {
    background: rgba(0, 0, 0, 0.06);
    color: #2563eb;
}

[data-theme="light"] details.file-attachment summary:hover {
    background: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] details.file-attachment pre {
    background: #f8f9fa !important;
    color: #1a1a1a !important;
    border-top-color: rgba(0, 0, 0, 0.1) !important;
}

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

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

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

.input-area {
    background: var(--glass-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 10px 16px;
    margin-bottom: 1rem;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    position: relative;
}

.input-area:focus-within {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 32px rgba(0, 0, 0, 0.3);
}

.input-area.drag-over {
    border-color: var(--accent-blue);
    background: rgba(96, 165, 250, 0.08);
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2);
}

.input-area.drag-over::after {
    content: 'Drop images or files here';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(96, 165, 250, 0.1);
    border-radius: 24px;
    color: var(--accent-blue);
    font-size: 0.9rem;
    font-weight: 500;
    pointer-events: none;
    z-index: 10;
}

/* Main input row */
.input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-actions-left,
.input-actions-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.input-action-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.input-action-btn:hover {
    background: var(--glass-highlight);
    color: var(--text-primary);
}

.input-action-btn i {
    width: 20px;
    height: 20px;
}

.input-action-btn.recording {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
    animation: pulse-recording 1.5s infinite;
}

@keyframes pulse-recording {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* Web Search Toggle */
.input-action-btn.web-search-active {
    background: rgba(96, 165, 250, 0.2);
    color: var(--accent-blue);
    border: 1px solid rgba(96, 165, 250, 0.3);
}

.input-action-btn.web-search-active:hover {
    background: rgba(96, 165, 250, 0.3);
    border-color: rgba(96, 165, 250, 0.5);
}

.input-action-btn.searching {
    pointer-events: none;
    opacity: 0.7;
}

/* Prompt Optimizer Button */
.input-action-btn.optimizing {
    background: rgba(168, 85, 247, 0.2);
    color: #a855f7;
    pointer-events: none;
}

.input-action-btn.optimizing i {
    animation: sparkle-spin 1s linear infinite;
}

@keyframes sparkle-spin {
    0% {
        transform: rotate(0deg) scale(1);
    }

    50% {
        transform: rotate(180deg) scale(1.1);
    }

    100% {
        transform: rotate(360deg) scale(1);
    }
}

.input-action-btn.deep-optimizing {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(59, 130, 246, 0.2), rgba(34, 197, 94, 0.2));
    color: #a855f7;
    pointer-events: none;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.input-action-btn.deep-optimizing i {
    animation: sparkle-pulse 0.8s ease-in-out infinite;
}

@keyframes sparkle-pulse {

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

    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
}

/* Optimizer Loading Ring Animation */
.input-action-btn.optimizer-loading {
    position: relative;
    overflow: visible;
}

.input-action-btn.optimizer-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 10px;
    border: 2px solid var(--text-muted);
    border-right-color: transparent;
    border-bottom-color: transparent;
    border-left-color: transparent;
    animation: optimizer-ring-spin 1.2s linear infinite;
    pointer-events: none;
}

.input-action-btn.optimizer-loading.deep::after {
    border-top-color: var(--text-secondary);
    animation: optimizer-ring-spin 1s linear infinite;
}

@keyframes optimizer-ring-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Web Search Results Badge */
.web-search-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(96, 165, 250, 0.1);
    border: 1px solid rgba(96, 165, 250, 0.3);
    border-radius: 12px;
    font-size: 0.7rem;
    color: var(--accent-blue);
    margin-bottom: 8px;
}

.web-search-badge i {
    width: 12px;
    height: 12px;
}

/* Search Sources */
.search-sources {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--glass-border);
}

.search-sources-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.search-source-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--glass-highlight);
    border-radius: 8px;
    margin-bottom: 4px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    transition: all 0.15s;
}

.search-source-link:hover {
    background: var(--glass-border);
    color: var(--text-primary);
}

.search-source-link i {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

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

/* Textarea wrapper */
.input-textarea-wrapper {
    flex: 1;
    min-width: 0;
}

.input-textarea-wrapper textarea {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.5;
    resize: none;
    min-height: 36px;
    max-height: 200px;
    padding: 8px 0;
    outline: none;
    display: flex;
    align-items: center;
}

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

/* Send button */
.input-area .send-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: var(--text-primary);
    color: var(--bg-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.input-area .send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.2);
}

.input-area .send-btn:disabled {
    background: var(--glass-border);
    color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.input-area .send-btn i {
    width: 18px;
    height: 18px;
}

/* Stop button state */
.input-area .stop-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: var(--accent-red);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.input-area .stop-btn:hover {
    background: #dc2626;
}

/* File Preview Area */
.file-preview-area {
    display: none;
    flex-wrap: wrap;
    gap: 8px;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--glass-border);
}

.file-preview-area.has-files {
    display: flex;
}

.file-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--glass-highlight);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: 10px;
    font-size: 0.8rem;
    transition: all 0.15s ease;
}

.file-chip:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.file-chip i {
    color: var(--text-secondary);
    width: 16px;
    height: 16px;
}

.file-chip-name {
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.8rem;
}

.file-chip-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 2px;
    border-radius: 4px;
    transition: all 0.15s;
}

.file-chip-remove:hover {
    color: var(--accent-red);
    background: rgba(239, 68, 68, 0.1);
}

.file-chip-thumb {
    width: 28px;
    height: 28px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

/* Image preview chip - larger for images */
.file-chip.image-chip {
    padding: 4px;
    padding-right: 8px;
}

.file-chip.image-chip .file-chip-thumb {
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

.vision-warning {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    background: rgba(234, 179, 8, 0.08);
    border: 1px solid rgba(234, 179, 8, 0.2);
    border-radius: 10px;
    color: #eab308;
    font-size: 0.75rem;
    line-height: 1.4;
}

.vision-warning i {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

/* Image Gallery for attached images in messages */
.attached-images-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--glass-border);
}

.attached-image-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    background: var(--glass-highlight);
    border: 1px solid var(--glass-border);
}

.attached-image-item:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.attached-image-item img {
    display: block;
    max-width: 200px;
    max-height: 150px;
    object-fit: cover;
    border-radius: 8px;
}

.attached-image-item .image-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 4px 8px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Image Modal for full-size view */
.image-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

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

.image-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.image-modal-content img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

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

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

/* Legacy textarea and send-btn styles removed - now using .input-area styles */

.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--gray-400);
}

.empty-state h2 {
    font-size: 2rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.03em;
}

.empty-state p {
    font-size: 1rem;
    color: var(--text-secondary);
}

pre {
    background: #1e1e1e;
    padding: 0;
    overflow-x: auto;
    font-size: 0.875rem;
    margin: 0;
    border-radius: 0 0 8px 8px;
    border: 1px solid var(--glass-border);
    border-top: none;
}

code {
    font-family: 'JetBrains Mono', 'SF Mono', Monaco, monospace;
    font-size: 0.875em;
}

pre code {
    display: block;
    padding: 1rem;
    background: transparent;
}

.code-block {
    margin: 1rem 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
}

.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem 1rem;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--glass-border);
}

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

.copy-btn:hover {
    color: var(--text-primary);
}

.message-content code:not(pre code) {
    background: var(--glass-highlight);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    border: 1px solid var(--glass-border);
    color: #d4d4d4;
}

.message.user .message-content code:not(pre code) {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Markdown styles */
.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4 {
    margin: 1rem 0 0.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.message-content h1 {
    font-size: 1.5rem;
}

.message-content h2 {
    font-size: 1.25rem;
}

.message-content h3 {
    font-size: 1.125rem;
}

.message-content h4 {
    font-size: 1rem;
}

.message-content p {
    margin: 0.5rem 0;
}

.message-content ul,
.message-content ol {
    margin: 0.5rem 0;
    padding-left: 2.5rem;
    list-style-position: outside;
}

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

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

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

.message-content li {
    margin: 0.25rem 0;
}

.message-content blockquote {
    border-left: 3px solid var(--text-muted);
    margin: 0.75rem 0;
    padding-left: 1rem;
    color: var(--text-secondary);
}

.message-content hr {
    border: none;
    border-top: 1px solid var(--glass-border);
    margin: 1rem 0;
}

.message-content a {
    color: #60a5fa;
    text-decoration: none;
}

.message-content a:hover {
    text-decoration: underline;
}

.message.user .message-content a {
    color: var(--white);
}

/* Table styles */
.message-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75rem 0;
    font-size: 0.875rem;
}

.message-content th,
.message-content td {
    border: 1px solid var(--glass-border);
    padding: 0.75rem 1rem;
    text-align: left;
    color: var(--text-secondary);
}

.message-content th {
    background: var(--glass-highlight);
    font-weight: 600;
    color: var(--text-primary);
}

.message.user .message-content th,
.message.user .message-content td {
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.message.user .message-content th {
    background: rgba(255, 255, 255, 0.1);
}

.no-history {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Suggestion Cards */
.suggestion-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    width: 100%;
    margin-top: 2rem;
}

.suggestion-card {
    background: var(--glass-highlight);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.suggestion-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.suggestion-card:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

.suggestion-card:hover::before {
    opacity: 1;
}

.animate-fade-in {
    animation: fadeIn 0.6s ease-out forwards;
}

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

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


.suggestion-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--glass-highlight);
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--accent-blue);
}

.suggestion-icon i {
    width: 20px;
    height: 20px;
}

.suggestion-text {
    flex: 1;
    min-width: 0;
}

.suggestion-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

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

.suggestion-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 13px;
    background: linear-gradient(135deg, transparent 40%, rgba(255, 255, 255, 0.1) 50%, transparent 60%);
    background-size: 200% 200%;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s;
}

.suggestion-card:hover::before {
    opacity: 1;
    animation: shimmer 2s linear infinite;
}

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

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

[data-theme="light"] .suggestion-icon {
    color: #3b82f6;
}

[data-theme="light"] .suggestion-card:hover {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .suggestion-card::before {
    background: linear-gradient(135deg, transparent 40%, rgba(0, 0, 0, 0.05) 50%, transparent 60%);
}

/* Message timestamp */
.message-time {
    font-size: 0.625rem;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.2s;
    margin-left: 8px;
}

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

/* Stop button */
.stop-btn {
    background: var(--accent-red);
    color: white;
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin: 5px;
    animation: pulse-stop 1.5s infinite;
}

@keyframes pulse-stop {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
    }
}

/* Voice input button - now uses .input-action-btn with .recording modifier */

/* Theme toggle */
.theme-toggle {
    background: var(--glass-highlight);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

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

/* Search in sidebar */
.sidebar-search {
    padding: 0.75rem;
    border-bottom: 1px solid var(--glass-border);
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-wrapper .search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 14px;
    height: 14px;
    pointer-events: none;
    z-index: 1;
}

.sidebar-search input {
    width: 100%;
    padding: 0.6rem 0.75rem 0.6rem 2.25rem;
    background: var(--glass-highlight);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.875rem;
    outline: none;
    transition: all 0.2s;
}

.sidebar-search input:focus {
    border-color: var(--text-muted);
    background: var(--glass-surface);
}

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

/* History Section Headers */
.history-section-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px 6px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 4px;
}

.history-section-header:first-child {
    margin-top: 0;
}

.history-section-header i {
    opacity: 0.7;
}

/* Pin indicator on item */
.pin-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-blue);
    flex-shrink: 0;
    margin-right: 2px;
}

/* Pinned item styling */
.history-item.pinned {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.08), rgba(96, 165, 250, 0.03));
    border-left: 2px solid var(--accent-blue);
    position: relative;
}

.history-item.pinned::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, rgba(96, 165, 250, 0.05), transparent);
    pointer-events: none;
    border-radius: inherit;
}

.history-item.pinned:hover {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.12), rgba(96, 165, 250, 0.06));
}

.history-item.pinned .history-item-title {
    color: var(--text-primary);
}

/* Light mode pinned styles */
[data-theme="light"] .history-item.pinned {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.1), rgba(96, 165, 250, 0.04));
}

[data-theme="light"] .history-item.pinned:hover {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.15), rgba(96, 165, 250, 0.08));
}

[data-theme="light"] .history-item.pinned::before {
    background: linear-gradient(90deg, rgba(96, 165, 250, 0.08), transparent);
}

.pin-btn {
    opacity: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    transition: all 0.2s;
}

.history-item:hover .pin-btn {
    opacity: 1;
}

.pin-btn:hover {
    color: var(--accent-blue);
}

.history-item.pinned .pin-btn {
    opacity: 1;
    color: var(--accent-blue);
}

/* Retry button */
.retry-btn {
    background: var(--glass-highlight);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
}

.retry-btn:hover {
    color: var(--text-primary);
    background: var(--glass-border);
}

/* Regenerate button */
.regenerate-btn {
    opacity: 0;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 4px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.message:hover .regenerate-btn {
    opacity: 1;
}

.regenerate-btn:hover {
    color: var(--text-primary);
    background: var(--glass-highlight);
}

.regenerate-btn.loading i,
.action-btn.loading i {
    animation: spin 1s linear infinite;
}

/* Regeneration Navigation */
.regen-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 0;
    margin-top: 8px;
    border-top: 1px solid var(--glass-border);
}

.regen-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--glass-highlight);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.regen-nav-btn:hover:not(:disabled) {
    background: var(--glass-border);
    color: var(--text-primary);
}

.regen-nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.regen-counter {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    min-width: 50px;
    text-align: center;
    padding: 4px 10px;
    background: var(--glass-highlight);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

[data-theme="light"] .regen-navigation {
    border-top-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .regen-nav-btn {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .regen-nav-btn:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .regen-counter {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.1);
}

/* Regeneration Transition Animations */
.message-content.regen-transitioning {
    transition: transform 0.15s ease-out, opacity 0.15s ease-out;
}

.message-content.slide-left {
    transform: translateX(-20px);
    opacity: 0;
}

.message-content.slide-right {
    transform: translateX(20px);
    opacity: 0;
}

.message-content.slide-in-right {
    animation: slideInFromRight 0.25s ease-out forwards;
}

.message-content.slide-in-left {
    animation: slideInFromLeft 0.25s ease-out forwards;
}

@keyframes slideInFromRight {
    0% {
        transform: translateX(20px);
        opacity: 0;
    }

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

@keyframes slideInFromLeft {
    0% {
        transform: translateX(-20px);
        opacity: 0;
    }

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

/* Confirmation dialog */
.dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.2s;
}

.dialog-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.dialog-box {
    background: var(--glass-surface);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 400px;
    width: 90%;
    backdrop-filter: blur(20px);
}

.dialog-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.dialog-message {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.dialog-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.dialog-btn {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.dialog-btn.cancel {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
}

.dialog-btn.confirm {
    background: var(--accent-red);
    border: none;
    color: white;
}

.dialog-btn:hover {
    opacity: 0.8;
}

/* Rename Dialog */
.rename-input-wrapper {
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rename-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-family: inherit;
    font-size: 0.9rem;
    background: var(--glass-highlight);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-primary);
    outline: none;
    transition: all 0.2s;
}

.rename-input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
}

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

#renameDialog .dialog-btn.confirm {
    background: var(--accent-blue);
}

/* Smart Rename Button */
.smart-rename-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    font-family: inherit;
    font-size: 0.8rem;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(59, 130, 246, 0.15));
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 6px;
    color: #a855f7;
    cursor: pointer;
    transition: all 0.2s;
    align-self: flex-start;
}

.smart-rename-btn:hover {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.25), rgba(59, 130, 246, 0.25));
    border-color: rgba(168, 85, 247, 0.5);
    transform: translateY(-1px);
}

.smart-rename-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.smart-rename-btn.loading {
    pointer-events: none;
}

.smart-rename-btn.loading i {
    animation: spin 1s linear infinite;
}

@keyframes sparkle-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

[data-theme="light"] .smart-rename-btn {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.1), rgba(59, 130, 246, 0.1));
    border-color: rgba(168, 85, 247, 0.25);
}

[data-theme="light"] .smart-rename-btn:hover {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(59, 130, 246, 0.2));
}

[data-theme="light"] .rename-input {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .rename-input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

/* ==================== CUSTOM TOOLTIP SYSTEM ==================== */
/* Hide default browser tooltips */
[title] {
    position: relative;
}

/* Custom Tooltip Container */
.custom-tooltip {
    position: fixed;
    z-index: 999999;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease, transform 0.15s ease;
    transform: translateY(4px);
}

.custom-tooltip.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-tooltip-content {
    background: linear-gradient(135deg, rgba(30, 30, 35, 0.98), rgba(20, 20, 25, 0.98));
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    max-width: 280px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.custom-tooltip-content::before {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, rgba(30, 30, 35, 0.98), rgba(20, 20, 25, 0.98));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-right: none;
    border-bottom: none;
    transform: rotate(45deg);
}

/* Arrow positions */
.custom-tooltip.top .custom-tooltip-content::before {
    bottom: -5px;
    left: 50%;
    margin-left: -4px;
    transform: rotate(-135deg);
}

.custom-tooltip.bottom .custom-tooltip-content::before {
    top: -5px;
    left: 50%;
    margin-left: -4px;
    transform: rotate(45deg);
}

.custom-tooltip.left .custom-tooltip-content::before {
    right: -5px;
    top: 50%;
    margin-top: -4px;
    transform: rotate(135deg);
}

.custom-tooltip.right .custom-tooltip-content::before {
    left: -5px;
    top: 50%;
    margin-top: -4px;
    transform: rotate(-45deg);
}

/* Light theme tooltip */
[data-theme="light"] .custom-tooltip-content {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(245, 245, 245, 0.98));
    color: #1a1a1a;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .custom-tooltip-content::before {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(245, 245, 245, 0.98));
    border-color: rgba(0, 0, 0, 0.08);
}

/* Legacy data-tooltip support (enhanced) */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: linear-gradient(135deg, rgba(30, 30, 35, 0.98), rgba(20, 20, 25, 0.98));
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.15s ease;
    z-index: 999999;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
    pointer-events: none;
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-4px);
}

[data-theme="light"] [data-tooltip]::after {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(245, 245, 245, 0.98));
    color: #1a1a1a;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08);
}

/* Mobile Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        z-index: 100;
        transform: translateX(-100%);
        width: 280px;
    }

    .sidebar.open {
        transform: translateX(0);
    }

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

    .sidebar-overlay.show {
        display: block;
    }

    header {
        padding: 1rem;
    }

    .content {
        padding: 0 1rem 1rem;
    }

    .model-select {
        flex: 1;
    }

    .custom-dropdown {
        min-width: 140px;
    }

    .dropdown-selected {
        font-size: 0.8rem;
        padding: 0.4rem 2rem 0.4rem 0.75rem;
    }

    .suggestion-grid {
        grid-template-columns: 1fr;
    }

    .message.user .message-wrapper {
        max-width: 95%;
    }

    .empty-state h2 {
        font-size: 1.5rem;
    }

    /* Input area mobile adjustments */
    .input-area {
        padding: 10px 12px;
        border-radius: 20px;
        margin-bottom: 0.5rem;
    }

    .input-action-btn {
        width: 32px;
        height: 32px;
    }

    .input-action-btn i {
        width: 18px;
        height: 18px;
    }

    .input-area .send-btn {
        width: 32px;
        height: 32px;
    }

    .input-area .send-btn i {
        width: 16px;
        height: 16px;
    }

    .input-textarea-wrapper textarea {
        font-size: 0.9rem;
    }

    .file-chip-name {
        max-width: 80px;
    }
}

/* Keyboard shortcut hints */
.shortcut-hint {
    font-size: 0.625rem;
    color: var(--text-muted);
    background: var(--glass-highlight);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: auto;
}


.auth-box {
    max-width: 360px;
    width: 100%;
}

.auth-inputs {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1.5rem 0;
}

.auth-input {
    background: var(--glass-highlight);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
}

.auth-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: rgba(255, 255, 255, 0.05);
}

.auth-error {
    color: var(--accent-red);
    font-size: 0.85rem;
    margin-bottom: 1rem;
    text-align: center;
    min-height: 20px;
}

.dialog-actions.vertical {
    flex-direction: column;
    gap: 0.75rem;
}

.full-width {
    width: 100%;
    justify-content: center;
}

.dialog-btn.outline {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
}

.dialog-btn.outline:hover {
    background: var(--glass-highlight);
    border-color: var(--text-secondary);
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin: 0.5rem 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--glass-border);
}

.divider span {
    padding: 0 10px;
}

.text-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0.5rem;
}

.text-btn:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

/* Token Badge */
.token-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.65rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    border: 1px solid var(--glass-border);
    cursor: help;
    transition: all 0.2s;
}

.token-badge:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    border-color: rgba(255, 255, 255, 0.2);
}

.model-tag {
    font-size: 0.65rem;
    background: var(--glass-highlight);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    color: var(--accent-blue);
    border: 1px solid var(--glass-border);
}


/* Message Hover Actions */
.message-actions-hover {
    position: absolute;
    top: -12px;
    right: 12px;
    background: var(--glass-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 4px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(10px) scale(0.95);
    pointer-events: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.message-wrapper:hover .message-actions-hover {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.action-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.action-btn:hover {
    background: var(--glass-highlight);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.action-btn.active {
    color: var(--accent-green);
    background: rgba(34, 197, 94, 0.1);
}

.action-btn.dislike.active {
    color: var(--accent-red);
    background: rgba(239, 68, 68, 0.1);
}

.action-btn i {
    width: 14px;
    height: 14px;
}


/* In-Chat Search */
.in-chat-search {
    display: none;
    align-items: center;
    background: var(--glass-highlight);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 2px 8px;
    margin-right: 10px;
}

.in-chat-search.active {
    display: flex;
}

.in-chat-search input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.8rem;
    padding: 6px;
    width: 150px;
    outline: none;
}

.in-chat-search button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 4px;
}

.search-match {
    background: rgba(250, 204, 21, 0.3);
    color: #fef08a;
    border-radius: 2px;
}


/* Compare Mode */
.response-row {
    display: flex;
    gap: 12px;
    width: 100%;
    margin-top: 8px;
}

.response-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.compare-header {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 4px;
    background: var(--glass-highlight);
    border-radius: 4px;
    padding: 4px 8px;
}


/* Message Footer Actions */
.message-actions-footer {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--glass-border);
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

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

/* Hide actions and collapse button during streaming */
.message.streaming .message-actions-footer,
.message.streaming .message-collapse-btn {
    display: none !important;
}

/* Remove old hover actions styles if needed, or keeping them won't hurt */


/* Active Search Match */
.search-match-active {
    background: #eab308;
    color: black;
    box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.4);
    font-weight: bold;
}


/* Small Reaction Buttons */
.message-actions-footer .action-btn {
    width: 20px;
    height: 20px;
    padding: 0;
}

.message-actions-footer .action-btn i {
    width: 12px;
    height: 12px;
}

/* User Message Actions */
.message.user .message-actions-footer {
    justify-content: flex-end;
    /* Align right for user */
}

/* Ensure custom dropdowns in Header control area fit well */
#compareControls .dropdown-container {
    width: 140px;
    margin: 0;
}

#compareControls .dropdown-header {
    background: transparent;
    border: 1px solid var(--glass-border);
    padding: 4px 8px;
    height: 28px;
    font-size: 0.75rem;
}

#compareControls .dropdown-content {
    top: 32px;
    left: 0;
    width: 220px;
    /* Wider popup than partial button */
}

/* Profile Dropdown */
.profile-dropdown {
    position: relative;
}

.profile-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    border-radius: 8px;
    transition: all 0.2s;
}

.profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--glass-highlight);
    color: var(--text-secondary);
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.profile-avatar i {
    width: 18px;
    height: 18px;
}

.profile-avatar.large {
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
}

.profile-avatar.large i {
    width: 24px;
    height: 24px;
}

.profile-btn:hover .profile-avatar {
    color: var(--text-primary);
    background: var(--glass-border);
}

.profile-menu {
    position: absolute;
    top: calc(100% + 16px);
    right: 0;
    width: 280px;
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(30px);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.98);
    transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.profile-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    margin-bottom: 6px;
}

.profile-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.profile-settings-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-left: auto;
}

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

.profile-settings-btn:hover i {
    animation: spin-settings 0.5s ease;
}

.profile-settings-btn i {
    width: 16px;
    height: 16px;
}

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

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

[data-theme="light"] .profile-settings-btn {
    background: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .profile-settings-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

.profile-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.profile-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.profile-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 6px 4px;
}

.profile-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.profile-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    transform: translateX(2px);
}

.profile-item i {
    width: 18px;
    height: 18px;
}

.profile-item-text {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.profile-item-status {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.profile-item.connected .profile-item-status {
    color: var(--accent-green);
}

/* Dialog Close Button */
.dialog-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.dialog-close-btn i {
    width: 20px;
    height: 20px;
}

/* Light Mode Fixes for Profile Dropdown */
[data-theme="light"] .profile-menu {
    background: var(--glass-surface);
    border-color: var(--glass-border);
}

[data-theme="light"] .profile-header {
    background: rgba(0, 0, 0, 0.05);
    /* Slightly darker for contrast in light mode */
}

[data-theme="light"] .profile-divider {
    background: var(--glass-border);
}

[data-theme="light"] .profile-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .profile-menu {
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
}

/* Generic token fixes for Profile Menu (applied to default dark too) */
.profile-menu {
    background: var(--glass-surface);
    border-color: var(--glass-border);
}

.profile-header {
    background: var(--glass-highlight);
}

.profile-divider {
    background: var(--glass-border);
}

.profile-item:hover {
    background: var(--glass-highlight);
}


/* Chat Navigation Button */
.chat-nav-btn {
    position: fixed;
    right: 100px;
    bottom: 120px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--glass-surface);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
}

.chat-nav-btn.visible {
    opacity: 1;
    pointer-events: auto;
}

.chat-nav-btn:hover {
    background: var(--glass-highlight);
    color: var(--text-primary);
    transform: scale(1.1);
    border-color: var(--text-muted);
}

.chat-nav-btn i,
.chat-nav-btn svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.chat-nav-btn.at-bottom i,
.chat-nav-btn.at-bottom svg {
    transform: rotate(180deg);
}

@media (max-width: 768px) {
    .chat-nav-btn {
        right: 16px;
        bottom: 100px;
    }
}

/* Bulk Delete UI */
.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.bulk-action-toggle {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: none;
    /* Hidden by default */
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.sidebar-right:hover .bulk-action-toggle {
    display: flex;
    /* Show only on hover */
}

.bulk-action-toggle:hover,
.bulk-action-toggle.active {
    color: var(--text-primary);
    background: var(--glass-highlight);
}

.bulk-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: rgba(59, 130, 246, 0.1);
    border-bottom: 1px solid var(--glass-border);
}

#selectedCount {
    font-size: 0.8rem;
    color: var(--text-primary);
    font-weight: 500;
}

.bulk-btns {
    display: flex;
    gap: 8px;
}

.bulk-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s;
}

.bulk-btn.delete {
    color: #ef4444;
}

.bulk-btn.delete:hover {
    background: rgba(239, 68, 68, 0.1);
}

.bulk-btn.cancel {
    color: var(--text-muted);
}

.bulk-btn.cancel:hover {
    background: var(--glass-highlight);
}

.history-item.selection-mode {
    padding-left: 8px;
}

.history-item-checkbox {
    display: none;
    margin-right: 12px;
    cursor: pointer;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 2px solid var(--glass-border);
    background: transparent;
    position: relative;
    flex-shrink: 0;
}

.history-item.selection-mode .history-item-checkbox {
    display: block;
}

.history-item-checkbox.checked {
    background: #3b82f6;
    border-color: #3b82f6;
}

.history-item-checkbox.checked::after {
    content: '';
    color: white;
    font-size: 12px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.history-item.selection-mode .history-item-delete,
.history-item.selection-mode .pin-btn,
.history-item.selection-mode .history-item-menu {
    display: none;
}


/* ==================== IMPROVED ANALYTICS MODAL ==================== */
.analytics-box {
    max-width: 520px;
    width: 100%;
}

.analytics-box .dialog-title {
    display: flex;
    align-items: center;
    justify-content: center;
}

.analytics-content {
    padding: 20px 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--glass-highlight);
    padding: 14px 16px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
}

.stat-card.highlight {
    background: rgba(34, 197, 94, 0.08);
    border-color: rgba(34, 197, 94, 0.2);
}

.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.stat-icon.input {
    background: rgba(96, 165, 250, 0.1);
    color: var(--accent-blue);
}

.stat-icon.output {
    background: rgba(168, 85, 247, 0.1);
    color: #a855f7;
}

.stat-icon.cost {
    background: rgba(34, 197, 94, 0.1);
    color: var(--accent-green);
}

.stat-info {
    flex: 1;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-card.highlight .stat-value {
    color: var(--accent-green);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.analytics-section {
    margin-top: 8px;
}

.section-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.model-usage-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 240px;
    overflow-y: auto;
}

.model-usage-item {
    background: var(--glass-highlight);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 12px;
}

.model-usage-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.model-usage-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
}

.model-usage-requests {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.model-usage-stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.model-usage-tokens {
    display: flex;
    gap: 12px;
    font-size: 0.75rem;
}

.token-in {
    color: var(--accent-blue);
}

.token-out {
    color: #a855f7;
}

.model-usage-cost {
    font-size: 0.75rem;
    color: var(--accent-green);
    font-weight: 500;
}

.model-usage-bar {
    height: 4px;
    background: var(--glass-border);
    border-radius: 2px;
    overflow: hidden;
}

.model-usage-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), #a855f7);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.no-usage {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 24px;
}

/* Dialog button improvements */
.dialog-btn {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==================== LIGHT THEME - ANALYTICS ==================== */
[data-theme="light"] .stat-card {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .stat-card.highlight {
    background: rgba(34, 197, 94, 0.05);
    border-color: rgba(34, 197, 94, 0.15);
}

[data-theme="light"] .stat-icon {
    background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .model-usage-item {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .model-usage-bar {
    background: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .token-badge {
    background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .token-badge:hover {
    background: rgba(0, 0, 0, 0.08);
}


/* Token badge input/output variants */
.token-badge.input {
    color: var(--accent-blue);
    background: rgba(96, 165, 250, 0.1);
    border-color: rgba(96, 165, 250, 0.2);
}

.token-badge.output {
    color: #a855f7;
    background: rgba(168, 85, 247, 0.1);
    border-color: rgba(168, 85, 247, 0.2);
}

.token-badge.input:hover {
    background: rgba(96, 165, 250, 0.15);
}

.token-badge.output:hover {
    background: rgba(168, 85, 247, 0.15);
}

[data-theme="light"] .token-badge.input {
    background: rgba(96, 165, 250, 0.08);
    border-color: rgba(96, 165, 250, 0.15);
}

[data-theme="light"] .token-badge.output {
    background: rgba(168, 85, 247, 0.08);
    border-color: rgba(168, 85, 247, 0.15);
}

/* Settings Button */
.settings-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

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

.settings-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Settings Modal - Split Panel Design */
.settings-panel {
    display: flex;
    width: 800px;
    max-width: 95vw;
    height: 600px;
    max-height: 85vh;
    background: linear-gradient(145deg, #1a1a1a 0%, #0f0f0f 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    overflow: hidden;
    position: relative;
}

.settings-panel .dialog-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.settings-panel .dialog-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

/* Settings Navigation */
.settings-nav {
    width: 220px;
    background: rgba(0, 0, 0, 0.3);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.settings-nav-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.settings-nav-header i,
.settings-nav-header svg {
    width: 20px;
    height: 20px;
    color: var(--accent-color);
}

.settings-nav-items {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    overflow-y: auto;
}

.settings-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.settings-nav-item i,
.settings-nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.settings-nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.settings-nav-item.active {
    background: rgba(96, 165, 250, 0.15);
    color: var(--accent-color);
}

/* Settings Main Content */
.settings-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.settings-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.settings-section {
    display: none;
    padding: 28px;
    animation: settingsFadeIn 0.3s ease;
}

.settings-section.active {
    display: block;
}

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

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

.settings-section-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.settings-section-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Settings Card */
.settings-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 16px;
}

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

.settings-card-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.settings-card.danger-zone {
    border-color: rgba(239, 68, 68, 0.2);
    background: rgba(239, 68, 68, 0.03);
}

.settings-card.danger-zone .settings-card-title {
    color: var(--accent-red);
}

/* Settings Items */
.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.settings-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.settings-item:first-child {
    padding-top: 0;
}

.settings-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

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

.settings-item-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.settings-item-control {
    display: flex;
    gap: 8px;
}

.settings-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    background: rgba(96, 165, 250, 0.15);
    color: var(--accent-color);
}

/* About Card */
.about-card {
    display: flex;
    align-items: center;
    gap: 20px;
}

.about-logo {
    width: 72px;
    height: 72px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 12px;
    flex-shrink: 0;
}

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

.about-info h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.about-version {
    font-size: 0.8rem;
    color: var(--accent-color);
    margin-bottom: 8px;
}

.about-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Theme Toggle Buttons */
.settings-theme-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
}

.settings-theme-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.settings-theme-btn.active {
    background: linear-gradient(135deg, var(--accent-color) 0%, #3b82f6 100%);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 15px rgba(96, 165, 250, 0.35);
}

.settings-theme-btn i,
.settings-theme-btn svg {
    width: 16px;
    height: 16px;
}

/* Toggle Switch */
.settings-toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

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

.settings-toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 26px;
    transition: all 0.3s ease;
}

.settings-toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: linear-gradient(135deg, #ffffff 0%, #e0e0e0 100%);
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.settings-toggle input:checked + .settings-toggle-slider {
    background: linear-gradient(135deg, var(--accent-color) 0%, #3b82f6 100%);
    border-color: rgba(96, 165, 250, 0.3);
}

.settings-toggle input:checked + .settings-toggle-slider:before {
    transform: translateX(22px);
}

/* Action Buttons */
.settings-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.settings-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.settings-action-btn i,
.settings-action-btn svg {
    width: 14px;
    height: 14px;
}

.settings-action-btn.danger {
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.settings-action-btn.danger:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.5);
}

/* Settings Header Button */
.settings-btn-header {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

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

.settings-btn-header i,
.settings-btn-header svg {
    width: 20px;
    height: 20px;
}

[data-theme="light"] .settings-btn-header {
    border-color: rgba(0, 0, 0, 0.1);
    background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .settings-btn-header:hover {
    background: rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.15);
}

/* Connection Button */
.settings-connection-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.settings-connection-btn.connected {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
    color: var(--accent-green);
}

.settings-connection-btn.connected:hover {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.4);
}

.connection-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: all 0.3s ease;
}

.settings-connection-btn.connected .connection-status {
    background: var(--accent-green);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}

[data-theme="light"] .settings-connection-btn {
    border-color: rgba(0, 0, 0, 0.1);
    background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .settings-connection-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .settings-connection-btn.connected {
    background: rgba(34, 197, 94, 0.08);
    border-color: rgba(34, 197, 94, 0.25);
}

/* Light Mode Settings */
[data-theme="light"] .settings-panel {
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .settings-nav {
    background: rgba(0, 0, 0, 0.02);
    border-right-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .settings-nav-header {
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .settings-nav-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .settings-nav-item.active {
    background: rgba(59, 130, 246, 0.1);
}

[data-theme="light"] .settings-card {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .settings-card.danger-zone {
    background: rgba(239, 68, 68, 0.03);
    border-color: rgba(239, 68, 68, 0.15);
}

[data-theme="light"] .settings-item {
    border-bottom-color: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .settings-theme-btn {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .settings-toggle-slider {
    background: linear-gradient(135deg, #d1d5db 0%, #c0c4c9 100%);
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .settings-action-btn {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .settings-panel .dialog-close-btn {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .about-logo {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .settings-panel {
        flex-direction: column;
        width: 100%;
        height: 90vh;
        border-radius: 16px 16px 0 0;
    }
    
    .settings-nav {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }
    
    .settings-nav-header {
        display: none;
    }
    
    .settings-nav-items {
        flex-direction: row;
        overflow-x: auto;
        padding: 8px 12px;
        gap: 8px;
    }
    
    .settings-nav-item {
        flex-direction: column;
        padding: 10px 16px;
        gap: 6px;
        font-size: 0.7rem;
        white-space: nowrap;
    }
    
    .settings-section {
        padding: 20px;
    }
}


/* Settings Input for API Keys - Premium Design */
.settings-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 200px;
}

.settings-input {
    flex: 1;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
    transition: all 0.25s ease;
}

.settings-input:hover {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
}

.settings-input:focus {
    outline: none;
    border-color: var(--accent-color);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
}

.settings-input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.settings-toggle-visibility {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.settings-toggle-visibility:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    transform: scale(1.05);
}


/* Multi API Keys UI */
.api-keys-group {
    margin-bottom: 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.api-keys-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.api-keys-header {
    margin-bottom: 14px;
}

.api-keys-header .settings-item-label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.9rem;
    font-weight: 500;
}

.api-keys-header .settings-item-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.api-keys-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.api-key-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.api-key-row .settings-input {
    flex: 1;
}

.api-key-row .key-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.api-key-row .key-status.active {
    background: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}

.api-key-row .key-status.failed {
    background: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.remove-key-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.remove-key-btn:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
    transform: scale(1.05);
}

.add-key-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px dashed rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    width: 100%;
    justify-content: center;
}

.add-key-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: rgba(96, 165, 250, 0.08);
    border-style: solid;
}

/* API Key Notification Toast */
.api-key-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 16px;
    border-radius: 8px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 10000;
    animation: slideInRight 0.3s ease;
    max-width: 360px;
}

.api-key-toast.warning {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

.api-key-toast.error {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.api-key-toast.success {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
}

.api-key-toast-icon {
    flex-shrink: 0;
}

.api-key-toast-content {
    flex: 1;
}

.api-key-toast-title {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.api-key-toast-message {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

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


/* Loading skeleton for message content before streaming starts */
.message.streaming .message-content:empty::before {
    content: '';
    display: block;
    width: 100%;
    min-height: 60px;
    background: linear-gradient(90deg,
            var(--glass-highlight) 25%,
            rgba(255, 255, 255, 0.08) 50%,
            var(--glass-highlight) 75%);
    background-size: 200% 100%;
    animation: shimmer-loading 1.5s ease-in-out infinite;
    border-radius: 8px;
}

.message.streaming .message-content:empty::after {
    display: none;
}

/* Skeleton lines effect */
.message-loading-skeleton {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 4px 0;
}

.skeleton-line {
    height: 14px;
    background: linear-gradient(90deg,
            var(--glass-highlight) 25%,
            rgba(255, 255, 255, 0.1) 50%,
            var(--glass-highlight) 75%);
    background-size: 200% 100%;
    animation: shimmer-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

.skeleton-line:nth-child(1) {
    width: 90%;
}

.skeleton-line:nth-child(2) {
    width: 75%;
}

.skeleton-line:nth-child(3) {
    width: 85%;
}

.skeleton-line:nth-child(4) {
    width: 60%;
}

@keyframes shimmer-loading {
    0% {
        background-position: 200% 0;
    }

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

/* Light theme adjustments */
[data-theme="light"] .message.streaming .message-content:empty::before,
[data-theme="light"] .skeleton-line {
    background: linear-gradient(90deg,
            rgba(0, 0, 0, 0.06) 25%,
            rgba(0, 0, 0, 0.12) 50%,
            rgba(0, 0, 0, 0.06) 75%);
    background-size: 200% 100%;
}

/* Pulse animation for the message wrapper while loading */
.message.streaming .message-wrapper {
    position: relative;
}

.message.streaming .message-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 12px;
    background: transparent;
    pointer-events: none;
}


/* Typing cursor for typewriter effect */
.typing-cursor {
    display: inline-block;
    width: 8px;
    height: 1.2em;
    background-color: var(--accent-color);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: cursor-blink 0.7s step-end infinite;
}

@keyframes cursor-blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}


/* Light mode settings modal adjustments - Premium Design */
[data-theme="light"] .settings-box {
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    color: #1a1a1a;
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(0, 0, 0, 0.05),
        0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

[data-theme="light"] .settings-box .dialog-title {
    border-bottom-color: rgba(0, 0, 0, 0.06);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.8) 0%, transparent 100%);
}

[data-theme="light"] .settings-box .dialog-close-btn {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .settings-box .dialog-close-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .settings-section {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .settings-section:hover {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .settings-section-title {
    color: var(--accent-color);
    font-weight: 700;
    border-bottom-color: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .settings-section-title::before {
    background: var(--accent-color);
}

[data-theme="light"] .settings-item {
    border-bottom-color: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .settings-item-label {
    color: #1a1a1a;
    font-weight: 600;
}

[data-theme="light"] .settings-item-desc {
    color: #666666;
}

[data-theme="light"] .settings-theme-btn {
    border-color: rgba(0, 0, 0, 0.1);
    color: #333333;
    background: rgba(0, 0, 0, 0.03);
    font-weight: 600;
}

[data-theme="light"] .settings-theme-btn::before {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.05) 0%, transparent 50%);
}

[data-theme="light"] .settings-theme-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.15);
    color: #1a1a1a;
}

[data-theme="light"] .settings-theme-btn.active {
    background: linear-gradient(135deg, var(--accent-color) 0%, #3b82f6 100%);
    border-color: transparent;
    color: white;
    box-shadow: 
        0 4px 15px rgba(59, 130, 246, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

[data-theme="light"] .settings-toggle-slider {
    background: linear-gradient(135deg, #d1d5db 0%, #c0c4c9 100%);
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .settings-toggle-slider:before {
    background: linear-gradient(135deg, #ffffff 0%, #f5f5f5 100%);
    box-shadow: 
        0 2px 6px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .settings-toggle input:checked+.settings-toggle-slider {
    background: linear-gradient(135deg, var(--accent-color) 0%, #3b82f6 100%);
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.05),
        0 0 12px rgba(59, 130, 246, 0.2);
}

[data-theme="light"] .settings-toggle:hover .settings-toggle-slider {
    border-color: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .settings-input {
    background: #f5f5f5;
    border-color: rgba(0, 0, 0, 0.1);
    color: #1a1a1a;
}

[data-theme="light"] .settings-input:focus {
    border-color: var(--accent-color);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

[data-theme="light"] .settings-input::placeholder {
    color: #999999;
}

[data-theme="light"] .settings-toggle-visibility {
    border-color: rgba(0, 0, 0, 0.1);
    background: rgba(0, 0, 0, 0.03);
    color: #666666;
}

[data-theme="light"] .settings-toggle-visibility:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #1a1a1a;
}

[data-theme="light"] .add-key-btn {
    border-color: rgba(0, 0, 0, 0.1);
    color: #666666;
    font-weight: 500;
}

[data-theme="light"] .add-key-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: rgba(59, 130, 246, 0.05);
}

[data-theme="light"] .remove-key-btn {
    border-color: rgba(0, 0, 0, 0.1);
    background: rgba(0, 0, 0, 0.03);
    color: #666666;
}

[data-theme="light"] .remove-key-btn:hover {
    background: rgba(239, 68, 68, 0.08);
    border-color: #ef4444;
    color: #ef4444;
}

[data-theme="light"] .api-keys-group {
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .api-key-row .key-status {
    background: var(--text-muted);
}

[data-theme="light"] .api-key-row .key-status.active {
    background: #22c55e;
}

[data-theme="light"] .api-key-row .key-status.failed {
    background: #ef4444;
}


/* Light theme - Dialog Box */
[data-theme="light"] .dialog-box {
    background: #ffffff;
    border-color: #d0d0d0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .dialog-title {
    color: #1a1a1a;
    font-weight: 600;
}

[data-theme="light"] .dialog-message {
    color: #666666;
}

[data-theme="light"] .dialog-btn.cancel {
    border-color: #d0d0d0;
    color: #333333;
    background: #f5f5f5;
}

[data-theme="light"] .dialog-btn.cancel:hover {
    background: #eeeeee;
}

[data-theme="light"] .dialog-btn.confirm {
    background: var(--accent-color);
    color: white;
}

[data-theme="light"] .dialog-btn.confirm:hover {
    opacity: 0.9;
}