/* Modern CSS Variables for Theme System */
:root {
    /* Dark theme (default) - Modern palette */
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2d2d2d;
    --bg-quaternary: #3a3a3a;
    --text-primary: #ffffff;
    --text-secondary: #e0e0e0;
    --text-tertiary: #9ca3af;
    --accent-color: #006EAC;
    --accent-hover: #005a8b;
    --accent-light: rgba(0, 110, 172, 0.1);
    --border-color: #374151;
    --border-light: #4b5563;
    --message-bg: rgba(0, 110, 172, 0.05);
    --code-bg: #111827;
    --scrollbar-track: #1f2937;
    --scrollbar-thumb: #4b5563;
    --scrollbar-thumb-hover: #6b7280;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --sidebar-width: 280px;
    --mobile-header-height: 80px;
    --animation-fast: 0.15s;
    --animation-normal: 0.3s;
    --animation-slow: 0.5s;
    --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
}

[data-theme="light"] {
    /* Light theme - Modern palette */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-quaternary: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #334155;
    --text-tertiary: #64748b;
    --accent-color: #006EAC;
    --accent-hover: #005a8b;
    --accent-light: rgba(0, 110, 172, 0.1);
    --border-color: #e2e8f0;
    --border-light: #cbd5e1;
    --message-bg: rgba(0, 110, 172, 0.05);
    --code-bg: #f8fafc;
    --scrollbar-track: #f1f5f9;
    --scrollbar-thumb: #cbd5e1;
    --scrollbar-thumb-hover: #94a3b8;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Modern Reset and Base Styles */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
    -moz-tab-size: 4;
    tab-size: 4;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    font-weight: 400;
    line-height: 1.6;
    transition: background-color var(--animation-normal) ease, color var(--animation-normal) ease;
}

/* New centered layout for modern design */
body.centered-layout {
    display: block;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    min-height: 100vh;
    padding: 0;
    margin: 0;
}

/* Modern sidebar in centered layout */
body.centered-layout #sidebar {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    width: min(300px, 85vw) !important;
    max-width: 300px !important;
    height: 100vh !important;
    background: rgba(30, 30, 30, 0.95) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.1) !important;
    transform: translateX(-100%) !important;
    transition: transform 0.3s ease !important;
    z-index: 9999 !important;
    overflow-y: auto !important;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.3) !important;
    box-sizing: border-box !important;
    padding: 1.5rem !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Sidebar close button */
body.centered-layout #sidebar .sidebar-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s ease;
}

body.centered-layout #sidebar .sidebar-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

body.centered-layout #sidebar.open,
body.centered-layout #sidebar.active {
    transform: translateX(0) !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Modern sidebar toggle button */
body.centered-layout .sidebar-toggle {
    position: fixed !important;
    top: 20px !important;
    left: 20px !important;
    z-index: 10000 !important;
    width: 48px !important;
    height: 48px !important;
    background: rgba(45, 45, 45, 0.9) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 12px !important;
    color: var(--text-primary) !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 18px !important;
    transition: all 0.2s ease !important;
}

body.centered-layout .sidebar-toggle:hover {
    background: rgba(55, 55, 55, 0.9) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    transform: scale(1.05) !important;
}

body.centered-layout .sidebar-toggle:active {
    transform: scale(0.95) !important;
}

/* Sidebar overlay for centered layout */
body.centered-layout .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

body.centered-layout .sidebar-overlay.active {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* Main container for centered layout */
body.centered-layout #main {
    width: 100% !important;
    max-width: 1200px !important;
    margin: 0 auto !important;
    padding: 0 20px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    height: 100vh !important;
    position: relative !important;
    transition: margin-left var(--animation-normal) ease, margin-right var(--animation-normal) ease !important;
}

/* Main si sposta quando la sidebar è aperta nel centered layout */
body.centered-layout #sidebar.active ~ #main,
body.centered-layout #sidebar.open ~ #main {
    margin-left: calc((100vw - 1200px) / 2 + 140px) !important; /* Sposta verso destra di metà sidebar */
    margin-right: calc((100vw - 1200px) / 2 - 140px) !important; /* Compensa riducendo margine destro */
}

/* Default messages container */
body.centered-layout #messages {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    flex: 1 !important;
    padding: 40px 20px !important;
    background: none !important;
}

/* When only welcome message (no messages) */
body.centered-layout #messages.welcome-only {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 100% !important;
}

/* When there are messages */
body.centered-layout #messages.has-messages {
    position: static !important;
    transform: none !important;
    height: auto !important;
    flex: 1 !important;
    overflow-y: auto !important;
    justify-content: flex-start !important;
}

body.centered-layout #messages h2 {
    font-size: 2.5rem !important;
    font-weight: 300 !important;
    color: var(--text-primary) !important;
    margin-bottom: 40px !important;
    opacity: 0.9 !important;
    letter-spacing: -0.5px !important;
    text-align: center !important;
    width: 100% !important;
    display: none !important;
}

/* Show welcome message only when explicitly needed */
body.centered-layout #messages.welcome-only h2 {
    display: block !important;
}

/* Modern input container */
body.centered-layout #user-input {
    position: fixed !important;
    bottom: 40px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 90% !important;
    max-width: 1200px !important;
    background: rgba(45, 45, 45, 0.95) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border-radius: 24px !important;
    padding: 20px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    z-index: 100 !important;
    box-sizing: border-box !important;
}

/* Modern input field */
body.centered-layout #message {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.5;
    padding: 12px 0;
    resize: none;
    min-height: 24px;
    max-height: 120px;
    overflow-y: auto;
    font-family: inherit;
}

body.centered-layout #message::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* Input controls container */
body.centered-layout .input-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    gap: 16px;
}

/* Modern tools button */
body.centered-layout .tools-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(0, 110, 172, 0.15);
    border: 1px solid rgba(0, 110, 172, 0.3);
    border-radius: 12px;
    color: #006EAC;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

body.centered-layout .tools-button:hover {
    background: rgba(0, 110, 172, 0.25);
    border-color: rgba(0, 110, 172, 0.5);
    color: #005a8b;
    transform: translateY(-1px);
}

body.centered-layout .tools-button.active {
    background: rgba(0, 110, 172, 0.3);
    border-color: rgba(0, 110, 172, 0.6);
    color: #004a73;
}

/* Modern action buttons */
body.centered-layout .action-buttons {
    display: flex;
    gap: 12px;
    align-items: center;
}

body.centered-layout .voice-button,
body.centered-layout .send-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #006EAC, #005a8b);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 110, 172, 0.3);
}

body.centered-layout .voice-button:hover,
body.centered-layout .send-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(0, 110, 172, 0.5);
    background: linear-gradient(135deg, #005a8b, #004a73);
}

/* Hide logout container in centered layout */
body.centered-layout #logout-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 200;
    background: rgba(45, 45, 45, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 12px;
    padding: 8px 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Message list in centered layout */
body.centered-layout #message-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
    max-width: 1200px !important;
    margin: 0 auto !important;
    padding: 100px 40px 200px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Messages in centered layout */
body.centered-layout .message {
    max-width: 100%;
    background: rgba(45, 45, 45, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    text-align: left;
}

body.centered-layout .message .message-content {
    text-align: left;
}

body.centered-layout .message .message-text {
    text-align: left;
}

body.centered-layout .message-human {
    background: linear-gradient(135deg, #006EAC, #005a8b);
    margin-left: auto;
    margin-right: 0;
}

body.centered-layout .message-ai {
    background: rgba(45, 45, 45, 0.9);
    margin-left: 0;
    margin-right: auto;
}

/* Left controls for tools */
body.centered-layout .left-controls {
    position: relative;
}

/* Tools dropdown container */
body.centered-layout .tools-dropdown {
    position: relative;
}

/* Tools dropdown in centered layout */
body.centered-layout .tools-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    min-width: 300px;
    width: auto;
    background: rgba(35, 35, 35, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 12px;
    border: 2px solid rgba(0, 110, 172, 0.6);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    display: none;
    z-index: 10000;
    max-height: 400px;
    overflow-y: auto;
    padding: 8px 0;
}

body.centered-layout .tools-menu.show {
    display: block;
    animation: slideUp 0.2s ease-out;
}

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

body.centered-layout .tool-item {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 2px 6px;
    border-radius: 8px;
    position: relative;
    min-height: 48px;
}

body.centered-layout .tool-item:last-child {
    border-bottom: none;
}

body.centered-layout .tool-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(4px);
}

body.centered-layout .tool-item.selected {
    background: rgba(0, 110, 172, 0.15);
    border-left: 3px solid #006EAC;
    box-shadow: 0 2px 8px rgba(0, 110, 172, 0.2);
}

body.centered-layout .tool-item .tool-icon {
    width: 20px;
    height: 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

body.centered-layout .tool-item .tool-name {
    flex: 1;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 14px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.centered-layout .tool-item .tool-checkmark {
    color: #006EAC;
    opacity: 0;
    transition: opacity 0.2s ease;
    font-size: 14px;
    flex-shrink: 0;
}

body.centered-layout .tool-item.selected .tool-checkmark {
    opacity: 1;
}

/* Tools loading state */
body.centered-layout .tools-loading {
    padding: 20px 16px;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-style: italic;
}

/* Attachments preview in centered layout */
body.centered-layout .attachments-preview {
    margin-bottom: 12px;
}

body.centered-layout .attachment-item {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-primary);
}

/* Mobile responsive for centered layout */
@media (max-width: 768px) {
    body.centered-layout #user-input {
        bottom: 20px;
        width: 95%;
        padding: 16px;
    }
    
    body.centered-layout #messages h2 {
        font-size: 2rem;
    }
    
    body.centered-layout #sidebar {
        width: min(280px, 80vw) !important;
        max-width: 280px !important;
    }
    
    body.centered-layout .sidebar-toggle {
        width: 44px !important;
        height: 44px !important;
        top: 16px !important;
        left: 16px !important;
    }
    
    body.centered-layout .tools-menu {
        min-width: 280px;
        max-width: 320px;
    }
    
    body.centered-layout .tool-item {
        padding: 12px 14px;
        gap: 12px;
        min-height: 44px;
    }
    
    body.centered-layout .input-controls {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
}

/* Additional responsiveness for very small screens or high zoom */
@media (max-width: 480px) {
    body.centered-layout #sidebar {
        width: min(250px, 75vw) !important;
        max-width: 250px !important;
    }
    
    body.centered-layout .sidebar-toggle {
        width: 40px !important;
        height: 40px !important;
        top: 12px !important;
        left: 12px !important;
    }
    
    body.centered-layout #user-input {
        bottom: 16px;
        width: 96%;
        padding: 12px;
    }
    
    body.centered-layout #message-list {
        padding: 80px 20px 180px;
    }
    
    body.centered-layout .action-buttons {
        justify-content: center;
    }
}

/* Modern Layout - Sidebar */
#sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem;
    overflow-y: auto;
    overflow-x: hidden;
    position: static;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    transition: width var(--animation-normal) ease, padding var(--animation-normal) ease;
    flex-shrink: 0;
}

/* Sidebar chiusa - riduci larghezza a 0 */
#sidebar.closed {
    width: 0;
    padding: 0;
    border-right-width: 0;
    min-width: 0;
}

#main {
    flex: 1;
    min-width: 0; /* Permette al flex item di ridursi sotto la sua dimensione minima */
    height: 100vh;
    margin-left: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Mobile styles */
@media (max-width: 768px) {
    #sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        width: 85%;
        max-width: 300px;
        z-index: 1001;
        transition: transform 0.3s ease;
    }

    #sidebar.active {
        transform: translateX(0);
    }

    #main {
        width: 100%;
    }

    body.no-scroll {
        overflow: hidden;
    }
}

/* Desktop styles */
@media (min-width: 769px) {
    #mobile-menu-btn {
        display: none;
    }

    #sidebar {
        position: static;
        transform: none !important;
    }

    .sidebar-overlay {
        display: none !important;
    }
}

/* Aggiungiamo lo stile per il theme toggle */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
    height: 16px; /* Altezza fissa per il wrapper */
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 16px;
    margin: 0; /* Rimuove eventuali margini */
}

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

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

.slider:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 2px;
    bottom: 2px;
    background-color: var(--text-primary);
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent-color);
}

input:checked + .slider:before {
    transform: translateX(16px);
}

/* Aggiorna tutti gli altri elementi per usare le variabili */
#message {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.message-content code {
    background-color: var(--code-bg);
}

/* ... aggiorna gli altri selettori CSS esistenti per usare le variabili ... */
#user-info {
    display: flex;
    align-items: center;
    height: 100%; /* Occupa tutta l'altezza del container */
    line-height: 1; /* Previene problemi di line-height */
}

#user-email {
    color: var(--accent-color);
    margin: 0; /* Rimuove eventuali margini */
}

#logout-form {
    margin: 0; /* Rimuove eventuali margini */
    display: flex;
    align-items: center;
    height: 100%;
}

#logout-btn {
    padding: 6px 12px;
    border: none;
    background-color: transparent;
    color: var(--text-primary);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--border-color);
}

#logout-btn:hover {
    color: #dc3545;
    background-color: rgba(220, 53, 69, 0.1);
    border-color: rgba(220, 53, 69, 0.2);
}

#sidebar {
    background-color: var(--bg-secondary);
    width: 250px;
    height: 100vh;
    padding: 20px;
    overflow-y: auto;
    border-right: 2px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

#new-thread-btn {
    padding: 0.75rem 1.25rem;
    border: none;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    color: white;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--animation-fast) ease;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

#new-thread-btn:hover {
    background: linear-gradient(135deg, var(--accent-hover), var(--accent-color));
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

#new-thread-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

#sidebar h2, #sidebar h3 {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 500;
    margin: 0 0 15px 0;
    padding: 0;
}

#main {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

#messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 100px 20px 20px 20px; /* Ridotto il padding-top da 60px a 20px */
    background-color: var(--bg-primary);

    @media (max-width: 768px) {
        padding: 10px;
    }
}

#message-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
    gap: 20px;
    -webkit-overflow-scrolling: touch; /* Per iOS */
}

.message {
    display: flex;
    gap: 1rem;
    padding: 1.25rem;
    border-radius: var(--radius-xl);
    max-width: 85%;
    animation: fadeIn var(--animation-normal) ease-out;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

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

.message-human {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    margin-left: auto;
    border-bottom-right-radius: var(--radius-md);
    flex-direction: row-reverse;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.message-ai {
    background: var(--bg-secondary);
    margin-right: auto;
    border-bottom-left-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: all var(--animation-fast) ease;
}

.message-ai:hover {
    background: var(--bg-tertiary);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.message-icon {
    width: 2.25rem;
    height: 2.25rem;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    margin-right: 1rem;
    transition: all var(--animation-fast) ease;
    position: relative;
    overflow: hidden;

    @media (max-width: 768px) {
        margin-right: 0;
        width: 2rem;
        height: 2rem;
    }
}

.message-icon svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
    stroke: currentColor;
    stroke-width: 0.5;
}

.message-human .message-icon {
    background: linear-gradient(135deg, #ffffff, #f8fafc);
    color: var(--accent-color);
    box-shadow: var(--shadow-md);
    border: 2px solid rgba(255, 255, 255, 0.8);
}

.message-ai .message-icon {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    color: white;
    padding: 0.375rem;
    box-shadow: var(--shadow-lg);
    border: 2px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.message-ai .message-icon::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border-radius: 50%;
    pointer-events: none;
}

.message-ai .message-icon svg {
    width: 32px;
    height: 32px;
}

.message-content {
    flex: 1;
    line-height: 1.6;
    font-size: 15px;
    color: var(--text-primary);
}

.message-human .message-content {
    color: var(--text-secondary);
}

.message-content code {
    background-color: var(--code-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.message-content pre {
    background-color: var(--code-bg);
    padding: 15px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 10px 0;
}

.message-content p {
    margin: 0 0 10px 0;
}

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

.message-content a {
    color: var(--accent-color);
    text-decoration: none;
    border-bottom: 1px solid rgba(30, 148, 166, 0.3);
    transition: all 0.2s;
}

.message-content a:visited {
    color: var(--accent-hover);
    border-bottom-color: rgba(22, 125, 140, 0.3);
}

.message-content a:hover {
    color: #25b5cc;
    border-bottom-color: #25b5cc;
}

.message-content a:active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

#user-input {
    padding: 20px;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
    border-top: 2px solid var(--border-color);
    display: flex;
    gap: 12px;
    align-items: flex-end;
    position: relative;
    z-index: 1;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

#message {
    flex: 1;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    transition: all var(--animation-fast) ease;
    box-shadow: var(--shadow-sm);
    resize: vertical;
    min-height: 42px;
    max-height: 120px;
}

#message:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px var(--accent-light);
    background: var(--bg-primary);
}

#message::placeholder {
    color: var(--text-tertiary);
    opacity: 0.8;
}

button {
    padding: 0.75rem 1.25rem;
    border: none;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    color: white;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--animation-fast) ease;
    font-weight: 600;
    font-size: 0.875rem;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left var(--animation-normal) ease;
}

button:hover::before {
    left: 100%;
}

button:hover {
    background: linear-gradient(135deg, var(--accent-hover), var(--accent-color));
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

button:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: var(--shadow-sm);
}

#thread-list {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
}

#thread-list .thread-item {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    margin: 0.375rem 0.5rem;
    cursor: pointer;
    border-radius: var(--radius-lg);
    transition: all var(--animation-fast) ease;
    font-size: 0.875rem;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1;
}

#thread-list .thread-item:hover {
    background: linear-gradient(135deg, var(--accent-light), var(--bg-quaternary));
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-color);
}

#thread-list .thread-item.selected {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-hover);
}

#thread-list .thread-item.selected .thread-name {
    color: white;
    font-weight: 600;
}

.thread-options {
    position: relative;
    display: inline-block;
    z-index: 10001;
}

.thread-options-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 4px 8px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.thread-options-btn:hover {
    opacity: 1;
    background: transparent;
}

.thread-options-menu {
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    display: none;
    z-index: 99999;
    min-width: 150px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    margin-top: 0.25rem;
}

.thread-options-menu.show {
    display: block;
    animation: slideDown var(--animation-fast) ease-out;
}

/* Ensure thread item with open menu has higher z-index */
#thread-list .thread-item:has(.thread-options-menu.show) {
    z-index: 10002;
}

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

.thread-options-menu button {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    text-align: left;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--animation-fast) ease;
    border-radius: var(--radius-md);
    margin: 0.125rem;
    font-weight: 500;
}

.thread-options-menu button:hover {
    background: var(--bg-tertiary);
    transform: translateX(2px);
}

.thread-options-menu button.delete {
    color: var(--danger-color);
}

.thread-options-menu button.delete:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.loading-spinner {
    display: none;
    width: 2rem;
    height: 2rem;
    position: relative;
    animation: spin 1s linear infinite;
}

.loading-spinner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--accent-color);
    border-radius: 50%;
    animation: inherit;
}

.loading-spinner::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    right: 4px;
    bottom: 4px;
    border: 2px solid transparent;
    border-top: 2px solid var(--accent-hover);
    border-radius: 50%;
    animation: spin 0.8s linear infinite reverse;
}

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

/* Pulse animation for typing indicator */
@keyframes pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

#assistants {
    margin-bottom: 30px;
}

/* Modern Select Dropdown */
.select-wrapper {
    position: relative;
    width: 100%;
}

.select-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
    border-radius: var(--radius-lg);
    pointer-events: none;
    z-index: -1;
}

#assistant-select {
    width: 100%;
    padding: 1rem 3rem 1rem 1.25rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    transition: all var(--animation-fast) ease;
    box-shadow: var(--shadow-sm);
    font-weight: 500;
}

/* Modern Select Arrow */
.select-wrapper::after {
    content: '';
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 0.375rem solid transparent;
    border-right: 0.375rem solid transparent;
    border-top: 0.5rem solid var(--text-primary);
    pointer-events: none;
    transition: all var(--animation-fast) ease;
}

/* Stile per le opzioni del select */
#assistant-select option {
    padding: 8px 12px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

/* Focus and Hover States */
#assistant-select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px var(--accent-light);
    background: var(--bg-secondary);
}

#assistant-select:focus + .select-wrapper::after {
    transform: translateY(-50%) rotate(180deg);
    border-top-color: var(--accent-color);
}

#assistant-select:hover {
    border-color: var(--accent-color);
    background: var(--bg-secondary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Supporto per Firefox */
#assistant-select {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

/* Supporto per Webkit (Chrome, Safari, ecc.) */
#assistant-select::-webkit-scrollbar {
    width: 8px;
}

#assistant-select::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

#assistant-select::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}

#assistant-select::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

.logo-container-small {
    text-align: center;
    margin-bottom: 30px;
}

.logo-container-small img {
    max-width: 120px;
    height: auto;
}

h2, h3 {
    color: var(--text-primary);
    margin: 0 0 15px 0;
    text-align: left;
}

.code-wrapper {
    position: relative;
    margin: 1em 0;
    background: var(--code-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.code-wrapper pre {
    margin: 0;
    padding: 16px;
    overflow-x: auto;
}

.code-wrapper code {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
}

.copy-button {
    position: absolute;
    top: 4px;
    right: 4px;
    background: transparent;
    border: none;
    padding: 2px;
    cursor: pointer;
    opacity: 0.4;
    transition: opacity 0.2s ease;
    border-radius: 3px;
}

.copy-button:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

.copy-button svg {
    fill: var(--text-primary);
    width: 12px;
    height: 12px;
}

/* Stile per la scrollbar orizzontale */
.code-wrapper pre::-webkit-scrollbar {
    height: 8px;
}

.code-wrapper pre::-webkit-scrollbar-track {
    background: var(--code-bg);
}

.code-wrapper pre::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.code-wrapper pre::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

.thread-name {
    padding: 2px 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
    color: var(--text-primary);
}

.thread-name.editing {
    background-color: var(--bg-tertiary);
    outline: 1px solid var(--accent-color);
}

.thread-name-input {
    background: var(--bg-tertiary);
    border: none;
    color: var(--text-primary);
    font-size: inherit;
    font-family: inherit;
    width: 100%;
    padding: 0;
    margin: 0;
    outline: none;
}

.thread-name-input:focus {
    outline: none;
}

/* Aggiorniamo anche lo stile generale dei thread per sicurezza */
.thread-item {
    padding: 12px 16px;
    margin: 4px 0;
    border-radius: 8px;
    transition: all 0.2s ease;
}

/* Dark theme */
[data-theme="dark"] .thread-item {
    background-color: #2d2d2d;
}

[data-theme="dark"] .thread-item:hover {
    background-color: #363636;
}

/* Light theme */
[data-theme="light"] .thread-item {
    background-color: #ffffff;
}

[data-theme="light"] .thread-item:hover {
    background-color: #f0f0f0;
}

/* Regole specifiche per la rinomina dei thread */
#thread-list .thread-item .thread-name.editing {
    background-color: var(--bg-primary) !important;
    outline: 1px solid var(--accent-color) !important;
}

/* Tools dropdown styles */
.tools-dropdown {
    position: relative;
    display: inline-block;
}

.tools-toggle-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-quaternary));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--animation-fast) ease;
    font-size: 14px;
    font-weight: 500;
    min-width: 120px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.tools-toggle-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left var(--animation-normal) ease;
}

.tools-toggle-btn:hover::before {
    left: 100%;
}

.tools-toggle-btn:hover {
    background: linear-gradient(135deg, var(--bg-quaternary), var(--bg-tertiary));
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.tools-toggle-btn.active {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    color: white;
    border-color: var(--accent-color);
    box-shadow: var(--shadow-lg);
}

.tools-toggle-btn i.fa-tools {
    font-size: 16px;
    transition: transform var(--animation-fast) ease;
}

.tools-toggle-btn.active i.fa-tools {
    transform: rotate(15deg);
}

.tools-toggle-btn i.fa-chevron-down {
    font-size: 12px;
    transition: transform var(--animation-fast) ease;
    margin-left: auto;
}

.tools-toggle-btn.active i.fa-chevron-down {
    transform: rotate(180deg);
}

.tools-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    max-height: 320px;
    overflow-y: auto;
    display: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: slideDown var(--animation-fast) ease-out;
}

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

/* Tools menu scrollbar */
.tools-menu::-webkit-scrollbar {
    width: 6px;
}

.tools-menu::-webkit-scrollbar-track {
    background: transparent;
}

.tools-menu::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: var(--radius-lg);
    transition: all var(--animation-fast) ease;
}

.tools-menu::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

.tools-menu {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) transparent;
}

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

.tools-loading {
    padding: 20px;
    text-align: center;
    color: var(--text-tertiary);
    font-style: italic;
    font-size: 14px;
}

.tool-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: all var(--animation-fast) ease;
    position: relative;
    overflow: hidden;
}

.tool-item:last-child {
    border-bottom: none;
}

.tool-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: var(--accent-color);
    transform: scaleY(0);
    transition: transform var(--animation-fast) ease;
}

.tool-item:hover::before {
    transform: scaleY(1);
}

.tool-item:hover {
    background: var(--bg-tertiary);
    transform: translateX(2px);
    padding-left: 20px;
}

.tool-item.selected {
    background: linear-gradient(135deg, var(--accent-light), rgba(0, 110, 172, 0.05));
    color: var(--accent-color);
    border-left: 3px solid var(--accent-color);
    padding-left: 15px;
}

.tool-item.selected::before {
    transform: scaleY(1);
}

.tool-item .tool-icon {
    font-size: 18px;
    width: 18px;
    text-align: center;
    color: var(--text-secondary);
    transition: all var(--animation-fast) ease;
}

.tool-item:hover .tool-icon {
    color: var(--accent-color);
    transform: scale(1.1);
}

.tool-item.selected .tool-icon {
    color: var(--accent-color);
    transform: scale(1.1);
}

.tool-item .tool-name {
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
    transition: color var(--animation-fast) ease;
}

.tool-item:hover .tool-name {
    color: var(--accent-color);
}

.tool-item.selected .tool-name {
    color: var(--accent-color);
    font-weight: 600;
}

.tool-item .tool-checkmark {
    margin-left: auto;
    color: var(--accent-color);
    font-size: 16px;
    font-weight: bold;
    opacity: 0;
    transform: scale(0);
    transition: all var(--animation-fast) ease;
}

.tool-item.selected .tool-checkmark {
    opacity: 1;
    transform: scale(1);
}

/* File attachment styles */
.input-with-attachments {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex: 1;
    flex-direction: column;
}

.input-with-attachments > div:first-child {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.attachment-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-quaternary));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--animation-fast) ease;
    min-width: 42px;
    min-height: 42px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.attachment-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left var(--animation-normal) ease;
}

.attachment-btn:hover::before {
    left: 100%;
}

.attachment-btn:hover {
    background: linear-gradient(135deg, var(--bg-quaternary), var(--bg-tertiary));
    color: var(--accent-color);
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.attachment-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.attachment-btn i {
    font-size: 16px;
    transition: transform var(--animation-fast) ease;
}

.attachment-btn:hover i {
    transform: rotate(15deg) scale(1.1);
}

.attachments-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-quaternary));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 14px;
    max-width: 220px;
    box-shadow: var(--shadow-sm);
    transition: all var(--animation-fast) ease;
    position: relative;
    overflow: hidden;
}

.attachment-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
    background: var(--accent-color);
    opacity: 0;
    transition: opacity var(--animation-fast) ease;
}

.attachment-item:hover::before {
    opacity: 1;
}

.attachment-item:hover {
    background: linear-gradient(135deg, var(--bg-quaternary), var(--bg-tertiary));
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.attachment-item .attachment-name {
    color: var(--text-primary);
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    flex: 1;
    font-weight: 500;
    transition: color var(--animation-fast) ease;
}

.attachment-item:hover .attachment-name {
    color: var(--accent-color);
}

.attachment-item i:first-child {
    color: var(--accent-color);
    font-size: 16px;
    transition: transform var(--animation-fast) ease;
}

.attachment-item:hover i:first-child {
    transform: scale(1.1);
}

.attachment-item .attachment-remove {
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    border-radius: 50%;
    transition: all var(--animation-fast) ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.attachment-item .attachment-remove:hover {
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.1);
    transform: scale(1.1);
}

#thread-list .thread-item .thread-name-input {
    background-color: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    border: none;
    font-size: inherit;
    font-family: inherit;
    width: 100%;
    padding: 0;
    margin: 0;
    outline: none;
}

#thread-list .thread-item {
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    transition: background-color 0.2s ease;
}

#thread-list .thread-item:hover {
    background-color: var(--bg-tertiary);
}

#thread-list .thread-item.selected {
    background-color: var(--accent-color);
}

#thread-list .thread-item.selected .thread-name {
    color: var(--text-secondary);
}

/* Stili base per i link nei messaggi - tema dark */
.message-content a,
.message-content a:visited {
    color: #66d9ef !important;
    text-decoration: underline !important;
    border-bottom: none !important;
    font-weight: normal !important;
}

.message-content a:hover {
    color: #99e6f2 !important;
}

/* Link nei messaggi dell'utente - tema dark */
.message-human .message-content a,
.message-human .message-content a:visited {
    color: #ffffff !important;
    text-decoration: underline !important;
    border-bottom: none !important;
    font-weight: normal !important;
}

.message-human .message-content a:hover {
    color: #e0e0e0 !important;
}

/* Tema light - stili specifici */
[data-theme="light"] .message-content a {
    color: #0645AD;
    text-decoration: underline;
    font-weight: normal;
}

[data-theme="light"] .message-content a:hover {
    color: #0B0080;
}

/* Messaggi dell'utente nel tema light */
[data-theme="light"] .message-human {
    color: #ffffff !important;
}

[data-theme="light"] .message-human .message-content {
    color: #ffffff !important;
}

[data-theme="light"] .message-human .message-content a {
    color: #ffffff;
    text-decoration: underline;
    font-weight: normal;
}

[data-theme="light"] .message-human .message-content a:hover {
    color: #e0e0e0;
}

/* Pulsante Nuova Chat nel tema light */
[data-theme="light"] #sidebar #new-thread-btn {
    color: #ffffff !important;
}

/* Thread list nel tema light */
[data-theme="light"] #sidebar #thread-list .thread-item {
    color: #ffffff !important;
    background-color: #1e94a6 !important;
}

[data-theme="light"] #sidebar #thread-list .thread-item:hover {
    background-color: #0f5964 !important;
}

[data-theme="light"] #sidebar #thread-list .thread-item.selected {
    background-color: #0a3f47 !important;
}

[data-theme="light"] #sidebar #thread-list .thread-item .thread-name {
    color: #ffffff !important;
}

[data-theme="light"] #sidebar #thread-list .thread-item .thread-name-input {
    color: #ffffff !important;
    background-color: #1e94a6 !important;
}

/* Puntini del menu contestuale nel tema light */
[data-theme="light"] .thread-options-btn {
    color: #ffffff !important;
}

/* Contenitore dei thread */
#threads-container {
    overflow-y: auto;
    overflow-x: visible;
    max-height: calc(100vh - 180px);
    display: flex;
    flex-direction: column;
    padding: 6px 8px 60px 8px;
    margin-right: -8px;
    box-sizing: border-box;
    background-color: var(--bg-secondary);
    position: relative;
}

#thread-list {
    flex-grow: 1;
    margin: 0;
    padding: 0;
    width: 100%;
    overflow: visible;
}

#thread-list .thread-item {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    margin: 6px 0; /* Rimuoviamo il margin laterale */
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.2s;
    font-size: 14px;
    color: var(--text-primary);
}

/* Stili per i gruppi di thread */
.thread-group {
    overflow: visible;
    position: relative;
}

.thread-group-header {
    padding: 12px 20px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 2;
    margin-top: 16px;
    overflow: hidden;
}

/* Dark theme */
[data-theme="dark"] .thread-group-header {
    color: #8e8e8e;
    background-color: var(--bg-secondary);  /* Usiamo la variabile del tema */
}

/* Light theme */
[data-theme="light"] .thread-group-header {
    color: #666666;
    background-color: var(--bg-secondary);  /* Usiamo la variabile del tema */
}

/* Scrollbar personalizzata per threads-container */
#threads-container::-webkit-scrollbar {
    width: 8px;
}

#threads-container::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

#threads-container::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}

#threads-container::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* Load more container */
#load-more-container {
    padding: 10px 0;
    text-align: center;
}

#load-more-container button {
    color: #ffffff !important;  /* Forziamo il colore bianco */
}

/* Assicuriamoci che rimanga bianco anche nel tema light */
[data-theme="light"] #load-more-container button {
    color: #ffffff !important;
}

/* Aggiungi questi nuovi stili per il mobile menu e overlay */
#mobile-menu-btn {
    display: none;
    position: fixed;
    top: 1.25rem;
    left: 1.25rem;
    z-index: 1002;
    width: 3rem;
    height: 3rem;
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    border: none;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    transition: all var(--animation-fast) ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#mobile-menu-btn:hover {
    background: linear-gradient(135deg, var(--accent-hover), var(--accent-color));
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

#mobile-menu-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-lg);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

#sidebar {
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100%;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    z-index: 1001;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;

    @media (max-width: 768px) {
        position: fixed
    }

}

#main {
    flex: 1;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
}

#messages {
    flex: 1;
    overflow-y: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

#message-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 80px;
}

#user-input {
    position: relative;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px;
    background-color: var(--bg-primary);
    border-top: 1px solid var(--border-color);
}

/* Mobile styles */
@media (max-width: 768px) {
    body.no-scroll {
        overflow: hidden;
    }

    #mobile-menu-btn {
        display: flex;
    }

    #sidebar {
        transform: translateX(-100%);
        width: 85%;
        max-width: 300px;
    }

    #sidebar.active {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: block;
    }

    .sidebar-overlay.active {
        opacity: 1;
    }

    #main {
        margin-left: 0;
        width: 100%;
        height: 100%;
        padding-top: var(--mobile-header-height);
    }

    #messages {
        height: calc(100% - var(--mobile-header-height));
    }

    #message-list {
        padding-bottom: 150px;
    }

    #user-input {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 15px;
        background: var(--bg-primary);
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        z-index: 100;
    }

    #logout-container {
        position: fixed;
        top: 20px;
        right: 20px;
        width: auto;
        z-index: 1001;
    }
}

/* Desktop styles */
@media (min-width: 769px) {
    #mobile-menu-btn {
        display: none;
    }

    #sidebar {
        transform: none !important;
    }

    .sidebar-overlay {
        display: none !important;
    }
}

/* Assicurati che questi stili esistano per il layout del form di input */
#user-input {
    display: flex;
    gap: 10px;
    padding: 15px;
}

#user-input input {
    flex: 1;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

#user-input button {
    padding: 10px 20px;
    border-radius: 4px;
    border: none;
    background-color: var(--accent-color);
    color: white;
    cursor: pointer;
}

#user-input button:hover {
    background-color: var(--accent-hover);
}

/* Modern Scrollbar Styling */
#message-list::-webkit-scrollbar,
#sidebar::-webkit-scrollbar,
#threads-container::-webkit-scrollbar,
#thread-list::-webkit-scrollbar {
    width: 6px;
}

#message-list::-webkit-scrollbar-track,
#sidebar::-webkit-scrollbar-track,
#threads-container::-webkit-scrollbar-track,
#thread-list::-webkit-scrollbar-track {
    background: transparent;
}

#message-list::-webkit-scrollbar-thumb,
#sidebar::-webkit-scrollbar-thumb,
#threads-container::-webkit-scrollbar-thumb,
#thread-list::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: var(--radius-lg);
    border: 2px solid transparent;
    background-clip: padding-box;
    transition: all var(--animation-fast) ease;
}

#message-list::-webkit-scrollbar-thumb:hover,
#sidebar::-webkit-scrollbar-thumb:hover,
#threads-container::-webkit-scrollbar-thumb:hover,
#thread-list::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
    background-clip: padding-box;
}

/* Firefox scrollbar styling */
#message-list,
#sidebar,
#threads-container,
#thread-list {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) transparent;
}

/* Stili base per il logout container */
#logout-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background-color: var(--bg-secondary);
    gap: 20px;
}

/* Top Navigation Menu */
.top-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.top-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-lg);
    transition: all var(--animation-fast) ease;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
}

.top-nav .nav-link:hover {
    color: var(--accent-color);
    background: rgba(30, 148, 166, 0.1);
}

.top-nav .nav-link i {
    font-size: 1rem;
}

.container-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

#user-info {
    display: flex;
    margin-right: .5rem;
    align-items: center;
}

#user-email {
    color: var(--accent-color);
    margin: 0;
    font-size: 14px;
}

#logout-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-primary);
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all var(--animation-fast) ease;
    font-weight: 500;
    font-size: 0.875rem;
    position: relative;
    overflow: hidden;
}

#logout-btn:hover {
    color: var(--danger-color);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(220, 53, 69, 0.05));
    border-color: var(--danger-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Mobile styles */
@media (max-width: 768px) {
    #logout-container {
        position: fixed;
        top: 20px;
        right: 20px;
        width: auto;
        z-index: 1001;
        flex-wrap: wrap;
    }

    .top-nav {
        display: none; /* Hide on mobile to save space */
    }

    #user-email {
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* Desktop styles */
@media (min-width: 769px) {
    #logout-container {
        position: fixed;
        top: 20px;
        right: 20px;
        width: auto;
        z-index: 1001;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
}

/* Modern Theme Switch */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 3rem;
    height: 1.5rem;
    margin: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-tertiary);
    transition: all var(--animation-normal) ease;
    border-radius: var(--radius-xl);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
}

.slider:before {
    position: absolute;
    content: '';
    height: 1.125rem;
    width: 1.125rem;
    left: 0.125rem;
    bottom: 0.125rem;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    transition: all var(--animation-normal) ease;
    border-radius: 50%;
    box-shadow: var(--shadow-md);
}

input:checked + .slider {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    border-color: var(--accent-color);
}

input:checked + .slider:before {
    transform: translateX(1.5rem);
    background: linear-gradient(135deg, #ffffff, #f8fafc);
}

.slider:hover {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1), var(--shadow-md);
}

/* Aggiungi queste regole dopo gli stili dei messaggi */
.message-timestamp {
    font-size: 0.8em;
    color: var(--text-secondary);
    margin-bottom: 4px;
    opacity: 0.8;
}

.message-text {
    width: 100%;
}

.message-content {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* Gestione specifica per elementi pre e code */
.message-content pre {
    white-space: pre-wrap;
    max-width: 100%;
    overflow-x: auto;
}

.message-content code {
    white-space: pre-wrap;
    word-wrap: break-word;
    max-width: 100%;
}

/* Gestione delle immagini nei messaggi */
.message-content img {
    max-width: 100%;
    height: auto;
}

/* Gestione delle tabelle */
.message-content table {
    max-width: 100%;
    overflow-x: auto;
    display: block;
}

/* Aggiustamenti per mobile */
@media screen and (max-width: 768px) {
    #message-container {
        padding: 15px;
        padding-bottom: 120px;
        padding-top: 80px;
        width: 100%;
        box-sizing: border-box;
    }

    .message {
        max-width: 100%;
        box-sizing: border-box;
    }

    .message-content {
        padding-right: 10px; /* Aggiunge un po' di spazio per evitare che il testo tocchi il bordo */
    }
}

.message-feedback {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.feedback-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.stars-container {
    display: flex;
    gap: 4px;
}

.star {
    cursor: pointer;
    font-size: 20px;
    color: var(--text-tertiary);
    transition: color 0.2s ease;
}

/* Citation icon styles */
.citation-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    cursor: pointer;
    color: var(--accent-color);
    opacity: 0.8;
    transition: all 0.2s ease;
    vertical-align: middle;
    background-color: transparent;
    padding: 3px;
    border-radius: 3px;
}

.citation-icon:hover {
    opacity: 1;
    background-color: rgba(30, 148, 166, 0.1);
    transform: scale(1.1);
}

.citation-icon:active {
    opacity: 0.9;
    background-color: rgba(30, 148, 166, 0.15);
    transform: scale(1);
}

.citation-icon svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* No need to adjust message-feedback as it already has display: flex */

/* Citation sidebar styles */
#citation-sidebar {
    position: fixed;
    top: 0;
    right: -350px; /* Start off-screen */
    width: 350px;
    height: 100vh;
    background-color: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    z-index: 1002;
    transition: right 0.3s ease;
    overflow-y: auto;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    box-sizing: border-box;
}

#citation-sidebar.active {
    right: 0;
}

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

.citation-sidebar-title {
    font-size: 18px;
    font-weight: bold;
    color: var(--text-primary);
}

.citation-sidebar-close {
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 20px;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    transition: background-color 0.2s ease;
}

.citation-sidebar-close:hover {
    background-color: var(--bg-tertiary);
}

.citation-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.citation-sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Styles for sources section */
.message-sources {
    font-size: 14px;
}

.sources-title {
    font-weight: bold;
    margin-bottom: 15px;
    color: var(--accent-color);
    font-size: 16px;
}

.sources-list {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
}

.sources-list li {
    margin-bottom: 20px;
    padding-left: 15px;
    position: relative;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

.sources-list li:last-child {
    border-bottom: none;
}

.sources-list li:before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--accent-color);
}

.sources-list a {
    color: var(--accent-color);
    text-decoration: none;
    word-break: break-all;
    font-weight: 500;
}

.sources-list a:hover {
    text-decoration: underline;
}

.source-quote {
    margin-top: 10px;
    padding: 12px 15px;
    background-color: var(--bg-tertiary);
    border-left: 3px solid var(--accent-color);
    border-radius: 0 4px 4px 0;
    font-style: italic;
    color: var(--text-primary);
    line-height: 1.5;
}

/* Mobile styles for citation sidebar */
@media (max-width: 768px) {
    #citation-sidebar {
        width: 85%;
        max-width: 350px;
    }
}

/* Effetto hover progressivo */
.stars-container .star:hover,
.stars-container .star:has(~ .star:hover) {
    color: #ffd700;
}

/* Gestione stelle selezionate */
.stars-container .star.selected,
.stars-container .star:has(~ .star.selected) {
    color: #ffd700;
}


/* Modern Utility Classes */
.glass {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.gradient-text {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
}

.animate-fade-in {
    animation: fadeIn var(--animation-normal) ease-out;
}

.animate-slide-up {
    animation: slideUp var(--animation-normal) ease-out;
}

/* Modern Loading States */
.loading-shimmer {
    animation: shimmer 2s infinite;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    background-size: 1000px 100%;
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* Modern Card Component */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: all var(--animation-fast) ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Modern Badge Component */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-xl);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-primary {
    background: var(--accent-light);
    color: var(--accent-color);
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

/* Responsive Design Improvements */
@media (max-width: 640px) {
    .message {
        max-width: 95%;
        padding: 1rem;
    }
    
    .message-icon {
        width: 2rem;
        height: 2rem;
    }
    
    #user-input {
        padding: 1rem;
    }
    
    .card {
        padding: 1rem;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Tools Panel Styling */
.tools-panel {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    max-height: 300px;
    overflow: hidden;
    transition: all var(--animation-normal) ease;
    position: relative;
    z-index: 10;
}

.tools-panel.collapsed {
    max-height: 50px;
}

.tools-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: all var(--animation-fast) ease;
}

.tools-header:hover {
    background: var(--bg-quaternary);
}

.tools-header h3 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.tools-toggle-btn {
    background: transparent;
    border: none;
    color: var(--accent-color);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-md);
    transition: all var(--animation-fast) ease;
}

.tools-toggle-btn:hover {
    background: var(--accent-light);
    transform: scale(1.1);
}

.tools-toggle-btn i {
    font-size: 1rem;
}

.tools-content {
    padding: 1rem;
    max-height: 250px;
    overflow-y: auto;
    transition: all var(--animation-normal) ease;
}

.tools-panel.collapsed .tools-content {
    max-height: 0;
    padding: 0 1rem;
    overflow: hidden;
}

.tools-categories {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.category-btn {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--animation-fast) ease;
    font-size: 0.75rem;
    font-weight: 500;
}

.category-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-color);
}

.category-btn.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.tools-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 0.75rem;
}

.tool-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
    cursor: pointer;
    transition: all var(--animation-fast) ease;
    position: relative;
    overflow: hidden;
}

.tool-item:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.tool-item.selected {
    background: var(--accent-light);
    border-color: var(--accent-color);
    box-shadow: var(--shadow-md);
}

.tool-item.selected::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--accent-color);
}

.tool-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

.tool-description {
    color: var(--text-tertiary);
    font-size: 0.75rem;
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.tool-category {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    background: var(--bg-quaternary);
    color: var(--text-tertiary);
    border-radius: var(--radius-xl);
    font-size: 0.625rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tool-category.search {
    background: rgba(0, 110, 172, 0.1);
    color: var(--accent-color);
}

.tool-category.retrieval {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.tool-category.method {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.tool-category.general {
    background: rgba(107, 114, 128, 0.1);
    color: var(--text-tertiary);
}

.tools-loading {
    text-align: center;
    color: var(--text-tertiary);
    padding: 2rem;
    font-style: italic;
}

.tools-empty {
    text-align: center;
    color: var(--text-tertiary);
    padding: 2rem;
    font-style: italic;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .tools-toggle-btn {
        min-width: 100px;
        font-size: 13px;
        padding: 8px 12px;
    }
    
    .tools-menu {
        max-height: 280px;
        border-radius: var(--radius-lg);
    }
    
    .tool-item {
        padding: 12px 16px;
        gap: 12px;
    }
    
    .tool-item .tool-icon {
        font-size: 16px;
    }
    
    .tool-item .tool-name {
        font-size: 14px;
    }
    
    .attachment-btn {
        min-width: 38px;
        min-height: 38px;
        padding: 8px;
    }
    
    .attachment-btn i {
        font-size: 14px;
    }
    
    .attachment-item {
        max-width: 180px;
        padding: 6px 12px;
        font-size: 13px;
    }
    
    #user-input {
        padding: 15px;
        gap: 10px;
    }
    
    #message {
        font-size: 16px; /* Prevent zoom on iOS */
        min-height: 38px;
    }
}

/* ========================================
   CONFIGURATION PAGES STYLES
   ======================================== */

/* Sidebar Navigation */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 2rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all var(--animation-fast);
    font-weight: 500;
}

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

.nav-item.active {
    background-color: var(--accent-color);
    color: white;
}

.nav-item i {
    font-size: 1.1rem;
    width: 1.5rem;
}

/* Configuration Pages - Override centered layout constraints */
body.centered-layout.config-page {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    height: 100vh !important;
}

body.centered-layout.config-page #main {
    height: auto !important;
    min-height: 100vh !important;
    overflow: visible !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
    padding: 0 !important;
}

/* Configuration Container */
.config-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
    min-height: 100vh;
}

.config-header {
    margin-bottom: 2rem;
}

.config-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.config-header .subtitle {
    color: var(--text-tertiary);
    font-size: 1rem;
}

/* Agents List */
.agents-list {
    margin-top: 2rem;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.list-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.list-header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex: 1;
    justify-content: flex-end;
}

/* Search Box */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.5rem 1rem;
    min-width: 300px;
    transition: border-color var(--animation-fast) ease;
}

.search-box:focus-within {
    border-color: var(--accent-color);
}

.search-box i {
    color: var(--text-tertiary);
    margin-right: 0.5rem;
}

.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.875rem;
}

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

.search-box .btn-icon {
    background: transparent;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--text-tertiary);
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: background-color var(--animation-fast) ease, color var(--animation-fast) ease;
}

.search-box .btn-icon:hover {
    background-color: var(--bg-quaternary);
    color: var(--text-primary);
}

.search-box.has-text .btn-icon {
    display: flex;
}

/* Pagination */
.pagination-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    padding: 1.5rem 0;
}

.pagination-info {
    color: var(--text-tertiary);
    font-size: 0.875rem;
    margin: 0;
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
    gap: 1.5rem;
    width: 100%;
}

/* For smaller screens, adjust grid */
@media (max-width: 1200px) {
    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    }
}

@media (max-width: 900px) {
    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    }
}

.agent-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: all var(--animation-normal);
}

.agent-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-color);
}

.agent-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.agent-card-header > div {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.agent-logo, .agent-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    object-fit: cover;
}

.agent-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-light);
    color: var(--accent-color);
    font-size: 1.5rem;
}

.agent-card-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.agent-card-body {
    margin-bottom: 1rem;
}

.agent-id {
    color: var(--text-tertiary);
    font-size: 0.875rem;
    font-family: var(--font-mono);
    margin-bottom: 0.5rem;
}

.agent-model {
    color: var(--text-secondary);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.agent-card-actions {
    display: flex;
    gap: 0.5rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    max-width: 900px;
    width: calc(100% - 2rem);
    max-height: calc(100vh - 4rem);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-content.large {
    max-width: 1200px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: color var(--animation-fast);
}

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

/* Form */
.config-form {
    padding: 2rem;
    overflow-y: auto;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
    overflow: hidden; /* Hide scrollbar - not needed */
}

.tab-btn {
    background: none;
    border: none;
    padding: 0.75rem 1.5rem;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--animation-fast);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.tab-btn.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Form Groups */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="file"],
.form-group select,
.form-group textarea {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all var(--animation-fast);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.form-group textarea {
    resize: vertical;
    font-family: var(--font-mono);
    line-height: 1.6;
}

.form-group small {
    display: block;
    color: var(--text-tertiary);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.form-group.checkbox {
    margin-bottom: 1rem;
}

.form-group.checkbox label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-weight: 400;
}

.form-group.checkbox input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}

/* Checkbox Grid */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    max-height: 300px;
    overflow-y: auto;
}

/* Tools and Retrievers Config Lists */
.tools-config-list,
.retrievers-config-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    max-height: 500px;
    overflow-y: auto;
}

.tool-config-item,
.retriever-config-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: border-color var(--animation-fast) ease;
}

.tool-config-item.selected,
.retriever-config-item.selected {
    border-color: var(--accent-color);
    background: var(--accent-light);
}

.tool-config-header,
.retriever-config-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.tool-config-header input[type="checkbox"],
.retriever-config-header input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}

.tool-config-header label,
.retriever-config-header label {
    flex: 1;
    margin: 0;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-primary);
}

.tool-config-body,
.retriever-config-body {
    display: none;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.tool-config-item.selected .tool-config-body,
.retriever-config-item.selected .retriever-config-body {
    display: block;
}

.tool-config-body textarea,
.retriever-config-body textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: var(--font-mono);
    resize: vertical;
}

.tool-config-body textarea:focus,
.retriever-config-body textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}

.tool-config-body small,
.retriever-config-body small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-tertiary);
    font-size: 0.75rem;
}

.info-text {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-tertiary);
    font-size: 0.875rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: background var(--animation-fast);
}

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

.checkbox-item input[type="checkbox"] {
    cursor: pointer;
}

/* Form Actions */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    margin-top: 2rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--animation-fast);
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent-color);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

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

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Empty/Error States */
.empty-state, .error-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-tertiary);
    font-size: 1rem;
}

.error-state {
    color: var(--danger-color);
}

/* Responsive */
@media (max-width: 768px) {
    .config-container {
        padding: 1rem;
    }

    .config-header h1 {
        font-size: 1.5rem;
    }

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

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
    }

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

/* Language Selector Styles */
#language-selector {
    margin-right: 15px;
}

.language-select {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 6px 32px 6px 12px;
    font-size: 14px;
    cursor: pointer;
    transition: all var(--animation-fast) ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
}

.language-select:hover {
    background-color: var(--bg-quaternary);
    border-color: var(--border-light);
}

.language-select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-light);
}

/* Profile Selector Styles */
#profile-selector {
    margin-right: 15px;
}

.profile-select {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 6px 32px 6px 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: all var(--animation-fast) ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
}

.profile-select:hover {
    background-color: var(--bg-quaternary);
    border-color: var(--border-light);
}

.profile-select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-light);
}

#profile-display {
    margin-right: 15px;
}

.profile-badge {
    background-color: var(--accent-color);
    color: white;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tools Management Styles */
.selected-tools-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 15px;
}

.selected-tool-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 15px;
}

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

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

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

.tool-config-input {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: 'Courier New', monospace;
    font-size: 13px;
    background: var(--bg-primary);
    color: var(--text-primary);
    resize: vertical;
}

.tool-config-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-light);
}

.available-tools-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
}

.available-tool-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.available-tool-item:hover {
    border-color: var(--accent-color);
    background: var(--bg-hover);
}

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

.tool-description {
    font-size: 13px;
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-style: italic;
}

/* Stores Management Styles */
.selected-stores-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 15px;
}

.selected-store-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 15px;
}

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

.store-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

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

.store-info-input {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: 'Courier New', monospace;
    font-size: 13px;
    background: var(--bg-primary);
    color: var(--text-primary);
    resize: vertical;
}

.store-info-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-light);
}

.available-stores-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
}

.available-store-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.available-store-item:hover {
    border-color: var(--accent-color);
    background: var(--bg-hover);
}

.store-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.store-description {
    font-size: 13px;
    color: var(--text-secondary);
}

.store-item-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group-actions {
    margin-bottom: 10px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* Store Configuration Styles */
.store-type-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

.store-type-tab {
    background: none;
    border: none;
    padding: 1rem 2rem;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--animation-fast);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.store-type-tab:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.store-type-tab.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

.store-section {
    display: none;
}

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

.stores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.store-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: all var(--animation-fast);
}

.store-card:hover {
    border-color: var(--accent-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.store-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 1rem;
}

.store-card-header > div {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0; /* Allow text truncation */
}

.store-card-header i {
    font-size: 1.5rem;
    color: var(--accent-color);
    flex-shrink: 0; /* Prevent icon from shrinking */
}

.store-card-header h3 {
    margin: 0;
    font-size: 1.125rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0; /* Prevent badge from shrinking */
}

.status-badge.enabled {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success-color);
}

.status-badge.disabled {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger-color);
}

.store-card-body {
    margin-bottom: 1rem;
}

.store-card-body p {
    margin: 0.5rem 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.store-card-body strong {
    color: var(--text-primary);
}

.store-card-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.modal-large {
    max-width: 900px;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

.error-message {
    text-align: center;
    padding: 2rem;
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--radius-lg);
    margin: 1rem 0;
}

/* ============================================
   THREAD MANAGEMENT STYLES
   ============================================ */

.threads-list {
    margin-top: 2rem;
}

.threads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.thread-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: all var(--animation-normal);
}

.thread-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-color);
}

.thread-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.thread-card-header > div {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.thread-card-header i {
    font-size: 1.5rem;
    color: var(--accent-color);
}

.thread-card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.thread-card-body {
    margin-bottom: 1rem;
}

.thread-card-body p {
    margin: 0.5rem 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.thread-card-body strong {
    color: var(--text-primary);
}

.thread-card-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Thread Detail Modal */
.modal-xlarge {
    max-width: 1200px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
}

.thread-detail-container {
    padding: 1.5rem 0;
}

.thread-info-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    padding: 1.5rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
}

.thread-info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.thread-info-item label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.thread-info-item span {
    font-size: 0.875rem;
    color: var(--text-primary);
}

/* Messages Section */
.messages-section {
    margin-bottom: 2rem;
}

.messages-section h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.messages-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 400px;
    overflow-y: auto;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.message-item {
    padding: 1rem;
    border-radius: var(--radius-md);
    border-left: 4px solid;
}

.message-item.ai-message {
    background: rgba(59, 130, 246, 0.1);
    border-left-color: var(--accent-color);
}

.message-item.user-message {
    background: rgba(16, 185, 129, 0.1);
    border-left-color: var(--success-color);
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.message-role {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.message-role i {
    font-size: 1rem;
}

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

.message-content {
    color: var(--text-primary);
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.message-actions {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

/* Suggested Answers Section */
.suggested-answers-section {
    margin-bottom: 1rem;
}

.suggested-answers-section h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.suggested-answers-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
    max-height: 200px;
    overflow-y: auto;
}

.suggested-answer-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.answer-text {
    flex: 1;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.suggested-answer-form {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.suggested-answer-form input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.suggested-answer-form input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.btn-remove-answer {
    background: transparent;
    border: none;
    color: var(--danger-color);
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    transition: all var(--animation-fast);
}

.btn-remove-answer:hover {
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--radius-sm);
}

/* Feedback Modal */
.rating-selector {
    display: flex;
    gap: 1rem;
    justify-content: space-around;
    margin: 1rem 0;
}

.rating-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--animation-fast);
    font-size: 0.875rem;
}

.rating-btn i {
    font-size: 1.5rem;
}

.rating-btn:hover {
    border-color: var(--accent-color);
    background: var(--accent-light);
    color: var(--accent-color);
}

.rating-btn.selected {
    border-color: var(--accent-color);
    background: var(--accent-color);
    color: white;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.filter-group select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.filter-group select:focus {
    outline: none;
    border-color: var(--accent-color);
}

/* ============================================
   DATA VISUALIZATION STYLES
   ============================================ */

.data-section {
    display: none;
}

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

.data-list {
    margin-top: 2rem;
}

.data-table-container {
    margin-top: 1.5rem;
    overflow-x: auto;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table thead {
    background: var(--bg-tertiary);
    border-bottom: 2px solid var(--border-color);
}

.data-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background var(--animation-fast);
}

.data-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.data-table td {
    padding: 1rem;
    color: var(--text-secondary);
}

.data-table td code {
    background: var(--bg-tertiary);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.8em;
    color: var(--accent-color);
}

.data-table td strong {
    color: var(--text-primary);
}

.data-table td a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color var(--animation-fast);
}

.data-table td a:hover {
    color: var(--accent-light);
    text-decoration: underline;
}

.empty-cell,
.error-cell {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
    font-style: italic;
}

.error-cell {
    color: var(--danger-color);
}

.content-preview {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Detail Modal */
.detail-modal-body {
    padding: 1.5rem 0;
}

.detail-section {
    margin-bottom: 2rem;
}

.detail-section h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1.25rem;
}

.detail-section h4 {
    margin: 1.5rem 0 0.75rem 0;
    color: var(--text-primary);
    font-size: 1rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    padding: 1.5rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.detail-item label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}

.detail-item span {
    color: var(--text-primary);
    font-size: 0.875rem;
}

.detail-item code {
    background: var(--bg-primary);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.8em;
    color: var(--accent-color);
    word-break: break-all;
}

.detail-section pre {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    overflow-x: auto;
    color: var(--text-primary);
    font-size: 0.875rem;
    line-height: 1.5;
}

.content-display {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    color: var(--text-primary);
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 400px;
    overflow-y: auto;
}

/* ========================================
   SUB-AGENTS UI (Supervisor Configuration)
   ======================================== */

.sub-agents-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.sub-agent-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    transition: all var(--animation-fast) ease;
}

.sub-agent-item:hover {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 1px var(--accent-color);
}

.sub-agent-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.sub-agent-header i.fa-robot {
    color: var(--accent-color);
    font-size: 1.25rem;
    flex-shrink: 0;
}

.sub-agent-select {
    flex: 1;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    font-size: 0.9375rem;
    transition: all var(--animation-fast) ease;
}

.sub-agent-select:hover {
    border-color: var(--border-light);
}

.sub-agent-select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.sub-agent-body {
    margin-top: 0.75rem;
}

.sub-agent-description {
    width: 100%;
    min-height: 60px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.625rem;
    font-size: 0.875rem;
    line-height: 1.5;
    resize: vertical;
    font-family: inherit;
    transition: all var(--animation-fast) ease;
}

.sub-agent-description:hover {
    border-color: var(--border-light);
}

.sub-agent-description:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.sub-agent-description::placeholder {
    color: var(--text-tertiary);
    opacity: 0.7;
}

.btn-remove-sub-agent {
    background: transparent;
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--animation-fast) ease;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.btn-remove-sub-agent:hover {
    background: var(--danger-color);
    color: white;
}

.btn-remove-sub-agent i {
    font-size: 0.875rem;
}

/* Empty state for sub-agents */
.sub-agents-list:empty::before {
    content: "No sub-agents configured. Click 'Add Sub-Agent' to get started.";
    display: block;
    text-align: center;
    padding: 2rem;
    color: var(--text-tertiary);
    font-style: italic;
}

/* Section description */
.section-description {
    color: var(--text-tertiary);
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-left: 3px solid var(--accent-color);
    border-radius: var(--radius-sm);
}

/* Thread preview in cards */
.thread-preview {
    color: var(--text-tertiary);
    font-size: 0.875rem;
    font-style: italic;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

/* ============================================
   Store Test Results Visualization Styles
   ============================================ */

/* Results container */
.results-section {
    margin-top: 2rem;
}

.results-section h3 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
}

/* Result cards */
.result-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.result-card:hover {
    border-color: var(--accent-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* Result header */
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.result-index {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--accent-color);
}

.result-index i {
    font-size: 1.1rem;
}

.result-index .index-number {
    font-size: 1.1rem;
}

.result-id {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-tertiary);
    font-family: 'Courier New', monospace;
}

.result-id i {
    color: var(--text-tertiary);
    opacity: 0.6;
}

.result-id .id-value {
    background: var(--bg-primary);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

/* Result body */
.result-body {
    padding: 1.25rem;
}

.result-content {
    margin-bottom: 1.5rem;
}

.content-preview {
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 0.95rem;
    padding: 1rem;
    background: var(--bg-primary);
    border-left: 3px solid var(--accent-color);
    border-radius: var(--radius-sm);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.btn-text-link {
    background: none;
    border: none;
    color: var(--accent-color);
    cursor: pointer;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    padding: 0.25rem 0;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.2s ease;
}

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

.btn-text-link i {
    font-size: 0.75rem;
}

/* Metadata section */
.result-metadata {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.metadata-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
}

.metadata-header i {
    color: var(--accent-color);
}

.metadata-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 0.75rem;
}

.metadata-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.metadata-key {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metadata-value {
    font-size: 0.875rem;
    color: var(--text-primary);
    word-break: break-word;
}

/* Special formatting for URLs in metadata */
.metadata-item .metadata-value[title*="http"] {
    color: var(--accent-color);
    cursor: pointer;
}

/* Result actions */
.result-actions {
    padding: 1rem 1.25rem;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Loading spinner for results */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--accent-color);
    font-size: 1rem;
}

.loading-spinner i {
    margin-right: 0.75rem;
    font-size: 1.5rem;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-tertiary);
}

.empty-state p {
    font-size: 1rem;
    margin: 0;
}

/* Error message */
.error-message {
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.3);
    color: #dc3545;
    padding: 1rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.error-message i {
    font-size: 1.25rem;
}

/* Document detail modal body */
.doc-modal-body {
    max-height: 70vh;
    overflow-y: auto;
}

.document-detail {
    padding: 1rem;
}

.detail-section {
    margin-bottom: 2rem;
}

.detail-section h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--accent-color);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-item label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-tertiary);
}

.detail-item span {
    color: var(--text-primary);
}

.id-badge {
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    background: var(--bg-tertiary);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.content-display {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.6;
    color: var(--text-primary);
}

.detail-section pre {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    overflow-x: auto;
    font-size: 0.875rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

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

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

/* Tool Calls Accordion Styles */
.tool-calls-accordion {
    margin-top: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    background-color: var(--bg-tertiary);
}

.accordion-toggle {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--bg-quaternary);
    border: none;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color var(--animation-fast) ease;
}

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

.accordion-icon {
    transition: transform var(--animation-normal) ease;
    font-size: 0.75rem;
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--animation-normal) ease;
    padding: 0 1rem;
}

.tool-call-item {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.tool-call-item:last-child {
    border-bottom: none;
    padding-bottom: 1rem;
}

.tool-call-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    color: var(--accent-color);
}

.tool-call-header i {
    font-size: 0.875rem;
}

.tool-call-header strong {
    font-size: 0.875rem;
    font-weight: 600;
}

.tool-call-args {
    background-color: var(--code-bg);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 0;
}

.tool-call-args code {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

/* Suggested Answer Display Styles */
.suggested-answer-display {
    margin-top: 1rem;
    padding: 1rem;
    background-color: var(--accent-light);
    border-left: 3px solid var(--accent-color);
    border-radius: var(--radius-md);
}

.suggested-answer-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    color: var(--accent-color);
}

.suggested-answer-header i {
    font-size: 1rem;
}

.suggested-answer-header strong {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.suggested-answer-content {
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
}


/* Store Test Results Enhancement */
.results-summary {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
}

.summary-item i {
    color: var(--accent-color);
    font-size: 1rem;
}

.result-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    padding: 0.5rem 0.75rem;
    background-color: var(--accent-light);
    border-radius: var(--radius-sm);
}

.result-title i {
    color: var(--accent-color);
    font-size: 0.875rem;
}

.result-title span {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.content-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-tertiary);
}

.content-label i {
    font-size: 0.875rem;
}

.content-label strong {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.content-preview {
    padding: 1rem;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    line-height: 1.7;
    font-size: 0.9375rem;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
}

.content-truncated {
    color: var(--text-tertiary);
    font-style: italic;
}

.btn-expand {
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all var(--animation-fast) ease;
}

.btn-expand:hover {
    gap: 0.75rem;
}

.metadata-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.75rem;
    background-color: var(--bg-quaternary);
    border-radius: var(--radius-sm);
    transition: background-color var(--animation-fast) ease;
    user-select: none;
}

.metadata-header:hover {
    background-color: var(--bg-tertiary);
}

.metadata-toggle-icon {
    margin-left: auto;
    transition: transform var(--animation-normal) ease;
    font-size: 0.875rem;
}

.result-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-success {
    background-color: var(--success-color) !important;
    border-color: var(--success-color) !important;
}


/* Tool Output Accordion Styles */
.tool-output-accordion {
    margin-top: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    background-color: var(--bg-tertiary);
}

.tool-output-accordion .accordion-toggle {
    background-color: var(--bg-quaternary);
}

.tool-output-content {
    background-color: var(--code-bg);
    padding: 1rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.tool-output-content code {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    line-height: 1.6;
    color: var(--text-secondary);
}



/* Tool Message Styles */
.message-item.tool-message {
    background-color: rgba(245, 158, 11, 0.05);
    border-left: 3px solid var(--warning-color);
}

.message-item.tool-message .message-header .message-role {
    color: var(--warning-color);
}

.message-item.tool-message .message-icon {
    background-color: rgba(245, 158, 11, 0.1);
}

