/* styles.css - Fixed for Private LLM Platform */

/* Base Styles */
.chat-container {
    height: calc(100vh - 200px);
}

/* Input section width constraint */
.input-section {
    max-width: 48rem; /* Same as max-w-3xl (768px) */
    margin: 0 auto;
    width: 100%;
}

/* Alternative: If your input has a different parent container */
#chatInputContainer,
.chat-input-wrapper {
    max-width: 48rem;
    margin: 0 auto;
    width: 100%;
}

/* Message Animations */
.message {
    animation: fadeIn 0.3s ease-in;
}

/* ── Chat message layout ─────────────────────────────────────── */

/* Wrappers */
.msg-wrapper {
    display: flex;
    flex-direction: column;
}
.msg-wrapper--user      { max-width: min(36rem, 82%); align-items: flex-end; }
.msg-wrapper--assistant { max-width: 48rem; width: 100%; align-items: flex-start; }

/* Role label */
.msg-role-label {
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    color: var(--color-text-muted);
    letter-spacing: var(--tracking-wide);
    margin-bottom: var(--space-1);
    padding: 0 var(--space-1);
}

/* Base bubble */
.msg-bubble {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-relaxed);
    color: var(--color-text-primary);
}

/* User bubble — distinct background, right-side radius */
.msg-bubble--user {
    background: var(--color-surface-2);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-xl) var(--radius-xl) var(--radius-sm) var(--radius-xl);
}

/* Assistant bubble — transparent, flush left */
.msg-bubble--assistant {
    background: transparent;
    padding: var(--space-1) 0;
    width: 100%;
}

/* System bubble */
.msg-bubble--system {
    background: var(--color-error-bg);
    color: var(--color-error-text);
    border: 1px solid var(--color-error-border);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    max-width: 32rem;
}

/* Timestamp */
.msg-timestamp {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin-top: var(--space-1);
    padding: 0 var(--space-1);
}

/* Turn spacing: larger gap when the role flips */
.message--user  + .message--assistant,
.message--assistant + .message--user {
    margin-top: var(--space-4);
}

/* Dark mode bubbles */
[data-theme="dark"] .msg-bubble--user {
    background: var(--color-surface-2);
}

/* ── Typing dots ─────────────────────────────────────────────── */
.typing-dots {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) 0;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: var(--radius-full);
    background: var(--color-text-muted);
    animation: typing-bounce 1.2s ease-in-out infinite;
}

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

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

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

/* Model Dropdown System */
.model-dropdown {
    max-height: 0;
    overflow: hidden; /* Keep as hidden for dropdown animation */
    transition: max-height 0.3s ease;
    z-index: 55;
    position: relative;
}

.model-dropdown.open {
    max-height: 500px;
    overflow: visible; /* Allow submenus to show outside */
}

/* FIXED: Provider Group & Submenu System */
.provider-group {
    position: relative !important;
}

.provider-main {
    position: relative;
    z-index: 1;
    cursor: pointer;
}

/* FIXED: Simplified submenu with working hover */
.provider-submenu {
    display: none !important;
    position: absolute !important;
    left: 100% !important;
    top: 0 !important;
    width: 280px !important;
    background: white !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 0.5rem !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1) !important;
    z-index: 9999 !important;
    margin-left: 8px !important;
}

.provider-group:hover .provider-submenu {
    display: block !important;
}

/* Keep submenu visible when hovering over it */
.provider-submenu:hover {
    display: block !important;
}

/* Model option hover effects */
.model-option {
    transition: all 0.2s ease;
}

.model-option:hover {
    background-color: #f8fafc !important;
    border-left-width: 3px !important;
    transform: translateX(2px);
}

/* Model Cards */
.model-card {
    transition: all 0.2s ease;
    cursor: pointer;
}

.model-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Conversation Items */
.conversation-item {
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.conversation-item:hover {
    background-color: #f3f4f6;
}

.conversation-item.active {
    background-color: var(--color-accent-muted);
    border-left: 3px solid var(--color-accent);
}

.delete-conversation {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.delete-conversation:hover {
    background-color: rgba(239, 68, 68, 0.1);
    transform: scale(1.1);
}

.conversation-item:hover .delete-conversation {
    opacity: 1 !important;
}

/* Status Indicators */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-unloaded { background-color: var(--color-text-muted); }
.status-api      { background-color: var(--color-text-muted); }
.status-loading  { background-color: var(--color-warning); animation: pulse 1s infinite; }
.status-loaded   { background-color: var(--color-success); }
.status-ready    { background-color: var(--color-success); }
.status-error    { background-color: var(--color-error); }

.progress-bar {
    transition: width 0.3s ease;
}

.provider-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 8px;
    font-weight: 500;
}

.local-badge { 
    background-color: #dcfce7; 
    color: #166534; 
}

.api-badge { 
    background-color: #dbeafe; 
    color: #1d4ed8; 
}

/* Provider actions (right panel) */
.provider-actions {
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.provider-card:hover .provider-actions {
    opacity: 1;
    visibility: visible;
}

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

/* Right Panel Styles */
.right-panel {
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 50;
}

.right-panel.open {
    transform: translateX(0);
}

/* Modal Overlay */
.modal-overlay {
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 70;
}

/* Search modal animations */
.modal-enter {
    animation: modalFadeIn 0.2s ease-out;
}

.modal-exit {
    animation: modalFadeOut 0.2s ease-in;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes modalFadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

/* Code block styling — tokens */
pre {
    background: var(--color-surface-1);
    border: 1px solid var(--color-border);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    margin: var(--space-2) 0;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
}

code {
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    padding: 2px 5px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
}

/* Loading spinner */
.spinner {
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
}

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

/* Toast notifications */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 16px;
    border-radius: 6px;
    color: white;
    font-weight: 500;
    z-index: 1000;
    animation: toastSlideIn 0.3s ease-out;
}

.toast.success {
    background-color: #10b981;
}

.toast.error {
    background-color: #ef4444;
}

.toast.info {
    background-color: var(--color-accent);
}

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

/* Typing indicator */
.typing-indicator {
    display: inline-block;
    animation: pulse 1.5s ease-in-out infinite;
}

/* Responsive Design */
@media (max-width: 768px) {
    .chat-container {
        height: calc(100vh - 250px);
    }
    
    .provider-submenu {
        width: 240px !important;
        left: auto !important;
        right: 0 !important;
    }
}

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Nuclear CSS Fix - Add this to the END of your styles.css */

/* NUCLEAR OPTION: Maximum specificity override */
div.provider-group.relative.border-b.border-gray-100:hover div.provider-submenu,
div.provider-group:hover div.provider-submenu,
.provider-group:hover .provider-submenu,
.max-h-96.overflow-y-auto .provider-group:hover .provider-submenu,
#modelDropdown .provider-group:hover .provider-submenu {
    display: block !important;
    position: absolute !important;
    left: 100% !important;
    top: 0 !important;
    width: 280px !important;
    background: white !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 0.5rem !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1) !important;
    z-index: 9999 !important;
    margin-left: 8px !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateX(0) !important;
}

/* Keep submenu visible when hovering over submenu itself */
div.provider-submenu:hover,
.provider-submenu:hover {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Ensure parent has proper positioning */
div.provider-group.relative.border-b.border-gray-100,
div.provider-group,
.provider-group {
    position: relative !important;
}

/* Reset all transitions that might interfere */
.provider-submenu {
    transition: none !important;
}

/* Code block styling */
pre {
    white-space: pre-wrap;       /* Preserve whitespace and wrap */
    word-wrap: break-word;        /* Break long lines */
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
}

pre code {
    display: block;
    padding: 0;
    background: transparent;
    white-space: pre;             /* Preserve exact formatting */
    overflow-x: auto;             /* Horizontal scroll for long lines */
}

/* Inline code */
code {
    font-family: var(--font-mono);
    font-size: 0.9em;
}

/* ── Code blocks — token-based, matches diagram-styles.css ──── */

/* Container — matches .diagram-block */
.code-block {
    margin: var(--space-3) 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--color-surface-0);
    box-shadow: var(--shadow-xs);
}

/* Legacy alias kept for any older markup */
.code-block-wrapper {
    margin: var(--space-3) 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--color-surface-0);
    box-shadow: var(--shadow-xs);
}

/* Header — matches .diagram-header */
.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) var(--space-3);
    background: var(--color-surface-1);
    border-bottom: 1px solid var(--color-border-subtle);
}

/* Language label — matches .diagram-type */
.code-language {
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
}

/* Button group — matches .diagram-actions */
.code-actions {
    display: flex;
    align-items: center;
    gap: var(--space-1-5);
}

/* Action buttons — matches .diagram-btn */
.code-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2-5);
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    color: var(--color-text-secondary);
    background: var(--color-surface-0);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-default),
                color var(--duration-fast) var(--ease-default),
                border-color var(--duration-fast) var(--ease-default),
                transform var(--duration-fast) var(--ease-default);
    white-space: nowrap;
    line-height: 1;
    user-select: none;
}

.code-btn i {
    font-size: var(--text-xs);
}

.code-btn:hover {
    background: var(--color-surface-2);
    color: var(--color-text-primary);
    border-color: var(--color-border-strong);
    transform: translateY(-1px);
}

.code-btn:active {
    transform: translateY(0);
}

.code-btn:focus-visible {
    outline: none;
    box-shadow: var(--shadow-focus);
}

.code-btn.success {
    color: var(--color-success-text);
    border-color: var(--color-success-border);
    background: var(--color-success-bg);
}

/* Code content (legacy .code-content class) */
.code-content {
    margin: 0;
    padding: var(--space-4);
    background: var(--color-surface-0);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
}

.code-content code {
    display: block;
    padding: 0;
    background: transparent;
    color: var(--color-text-primary);
    white-space: pre;
    word-wrap: normal;
}

/* Scroll-to-bottom button */
#chat-panel { position: relative; }
.scroll-to-bottom-btn {
    position: absolute;
    bottom: 80px;
    right: 24px;
    z-index: 10;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    background: var(--color-surface-0);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    transition: box-shadow var(--duration-base) var(--ease-default),
                color var(--duration-base) var(--ease-default);
}
.scroll-to-bottom-btn:hover {
    color: var(--color-text-primary);
    box-shadow: var(--shadow-lg);
}

/* ── Input hint bar ──────────────────────────────────────────── */
.input-hint-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: var(--space-2);
}

.input-hint-bar__left {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.input-hint-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    color: var(--color-text-muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: color var(--duration-fast) var(--ease-default),
                background var(--duration-fast) var(--ease-default),
                border-color var(--duration-fast) var(--ease-default);
}

.input-hint-btn:hover {
    color: var(--color-text-primary);
    background: var(--color-surface-2);
    border-color: var(--color-border);
}

.input-hint-btn.active {
    color: var(--color-success-text);
    background: var(--color-success-bg);
    border-color: var(--color-success-border);
}

.input-hint-bar__shortcut {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.input-hint-bar__shortcut kbd {
    padding: 1px var(--space-1-5);
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
}

/* marked.js rendered output */
.message p { margin: 0 0 0.6em; }
.message p:last-child { margin-bottom: 0; }
.message ul, .message ol { margin: 0.4em 0 0.6em 1.4em; padding: 0; }
.message li { margin-bottom: 0.2em; }
.message blockquote {
    border-left: 3px solid var(--color-border-strong);
    margin: 0.5em 0;
    padding: 4px var(--space-3);
    color: var(--color-text-secondary);
}
.message table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.6em 0;
    font-size: var(--text-sm);
}
.message th, .message td {
    border: 1px solid var(--color-border);
    padding: var(--space-1-5) var(--space-2-5);
    text-align: left;
}
.message th { background: var(--color-surface-1); font-weight: var(--weight-semibold); }
.message hr { border: none; border-top: 1px solid var(--color-border); margin: 0.8em 0; }
.message h1, .message h2, .message h3,
.message h4, .message h5, .message h6 {
    margin: 0.6em 0 0.3em;
    font-weight: 600;
    line-height: 1.3;
}

/* Inline message edit */
.msg-edit-textarea {
    width: 400px;
    max-width: 100%;
    min-height: 80px;
    padding: var(--space-2) var(--space-2-5);
    border: 1px solid var(--color-accent);
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    resize: none;
    outline: none;
    box-sizing: border-box;
    background: var(--color-surface-0);
    color: var(--color-text-primary);
}
.msg-edit-textarea:focus {
    box-shadow: var(--shadow-focus);
}
.msg-edit-actions {
    display: flex;
    gap: var(--space-2);
    justify-content: flex-end;
    margin-top: var(--space-2);
}
.msg-edit-btn {
    padding: var(--space-1-5) var(--space-3);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    border-radius: var(--radius-md);
    cursor: pointer;
    border: 1px solid transparent;
    transition: background var(--duration-fast) var(--ease-default);
}
.msg-edit-btn--cancel {
    background: transparent;
    color: var(--color-text-secondary);
    border-color: var(--color-border);
}
.msg-edit-btn--cancel:hover { background: var(--color-surface-2); }
.msg-edit-btn--save {
    background: var(--color-accent);
    color: var(--color-text-on-accent);
    border-color: var(--color-accent);
}
.msg-edit-btn--save:hover { background: var(--color-accent-hover); }

/* Message action toolbar */
.msg-action-bar {
    display: flex;
    align-items: center;
    gap: var(--space-0-5);
    opacity: 0;
    transition: opacity var(--duration-fast) var(--ease-default);
    padding: var(--space-0-5) 0 var(--space-1);
    min-height: 24px;
}
.message:hover .msg-action-bar,
.msg-action-bar.pinned {
    opacity: 1;
}
.msg-wrapper--user .msg-action-bar {
    justify-content: flex-end;
}
.msg-action-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-0-5) var(--space-2);
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: color var(--duration-fast) var(--ease-default),
                background var(--duration-fast) var(--ease-default),
                border-color var(--duration-fast) var(--ease-default);
    white-space: nowrap;
}
.msg-action-btn:hover {
    color: var(--color-text-primary);
    background: var(--color-surface-2);
    border-color: var(--color-border);
}
.msg-action-btn i {
    font-size: var(--text-xs);
}

/* Code block expand/collapse */
.code-block.collapsed pre {
    max-height: 260px;
    overflow: hidden;
    mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
}
.code-hidden-count {
    font-size: 10px;
    opacity: 0.75;
}

/* hljs integration — let <code class="hljs"> control bg and padding */
.code-block pre {
    margin: 0;
    padding: 0;
    background: transparent;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    overflow: hidden;
}
.code-block pre code.hljs {
    display: block;
    padding: var(--space-4);
    overflow-x: auto;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Inline code */
.inline-code {
    padding: 2px 6px;
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.9em;
    color: var(--color-accent-text);
}

/* Dark mode — code blocks (all via tokens, no hard-coded values) */
[data-theme="dark"] .code-block,
[data-theme="dark"] .code-block-wrapper {
    background: var(--color-surface-0);
    border-color: var(--color-border);
}

[data-theme="dark"] .code-header {
    background: var(--color-surface-1);
    border-bottom-color: var(--color-border-subtle);
}

[data-theme="dark"] .code-btn {
    color: var(--color-text-muted);
    background: var(--color-surface-2);
    border-color: var(--color-border);
}

[data-theme="dark"] .code-btn:hover {
    color: var(--color-text-primary);
    background: var(--color-surface-3);
    border-color: var(--color-border-strong);
}

[data-theme="dark"] .code-content {
    background: var(--color-surface-0);
}

[data-theme="dark"] .code-content code {
    color: var(--color-text-primary);
}

[data-theme="dark"] .inline-code {
    background: var(--color-surface-2);
    border-color: var(--color-border);
    color: var(--color-accent-text);
}

/* Scrollbar styling for code blocks — inherits global token scrollbar */
.code-content::-webkit-scrollbar       { height: 6px; }
.code-content::-webkit-scrollbar-track { background: transparent; }
.code-content::-webkit-scrollbar-thumb { background: var(--color-border-strong); border-radius: var(--radius-full); }
.code-content::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted); }

/* Responsive adjustments */
@media (max-width: 640px) {
    .code-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-2);
    }

    .code-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .code-btn {
        flex: 1;
        justify-content: center;
    }
}

/* File Upload Styles */
.file-upload-btn {
    flex-shrink: 0;
}

.file-upload-btn:hover i {
    transform: rotate(-15deg);
    transition: transform 0.2s;
}

#chatInput {
    position: relative;
}

#chatInput.drag-over {
    background: var(--color-accent-muted) !important;
    border-color: var(--color-accent) !important;
}

#chatInput.drag-over::after {
    content: '📎 Drop files here';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    font-weight: 600;
    color: var(--color-accent-text);
    pointer-events: none;
    z-index: 10;
}

#attachedFilesPreview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.attached-files-label {
    width: 100%;
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.attached-file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    transition: all 0.2s;
}

.attached-file-item:hover {
    border-color: var(--color-accent);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.file-preview-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-thumbnail {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
}

.file-icon {
    font-size: 24px;
    color: #6b7280;
    width: 40px;
    text-align: center;
}

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

.file-name {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-size {
    font-size: 11px;
    color: #9ca3af;
}

.remove-file-btn {
    padding: 4px 8px;
    color: #9ca3af;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.remove-file-btn:hover {
    color: #ef4444;
    background: #fee2e2;
}

/* Message with files */
.message-files {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.message-file {
    max-width: 200px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.message-file img {
    width: 100%;
    height: auto;
    display: block;
}

.message-file-info {
    padding: 8px;
    background: #f9fafb;
    font-size: 12px;
}

/* Temperature Controls */
.temperature-control {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.temperature-control label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.temperature-control select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
}

.temperature-control select:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--color-focus-ring);
}

.temperature-control input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.temperature-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-accent);
    cursor: pointer;
}

.temperature-control input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-accent);
    cursor: pointer;
    border: none;
}


/* ── Dark mode overrides ───────────────────────────────────────── */
[data-theme="dark"] .conversation-item:hover { background-color: var(--color-surface-2); }
[data-theme="dark"] .conversation-item.active { background-color: var(--color-accent-muted); border-left-color: var(--color-accent); }

[data-theme="dark"] .provider-submenu,
[data-theme="dark"] div.provider-group:hover div.provider-submenu,
[data-theme="dark"] .provider-group:hover .provider-submenu {
    background: var(--color-surface-1) !important;
    border-color: var(--color-border) !important;
}

[data-theme="dark"] .model-option:hover { background-color: var(--color-surface-3) !important; }

[data-theme="dark"] .local-badge { background-color: var(--color-success-bg); color: var(--color-success-text); }
[data-theme="dark"] .api-badge   { background-color: var(--color-info-bg);    color: var(--color-info-text); }

/* code-block dark mode consolidated above (~line 745) — stale duplicate removed */
[data-theme="dark"] .inline-code { background: var(--color-surface-2); border-color: var(--color-border); color: var(--color-accent-text); }

[data-theme="dark"] #attachedFilesPreview { background: var(--color-surface-2); border-color: var(--color-border); }
[data-theme="dark"] .attached-file-item { background: var(--color-surface-1); border-color: var(--color-border); }
[data-theme="dark"] .file-name { color: var(--color-text-primary); }
[data-theme="dark"] .file-size { color: var(--color-text-muted); }

[data-theme="dark"] .spinner { border-color: var(--color-surface-3); border-top-color: var(--color-accent); }

[data-theme="dark"] .temperature-control select { background: var(--color-surface-2); border-color: var(--color-border); color: var(--color-text-primary); }
[data-theme="dark"] .temperature-control input[type="range"] { background: var(--color-surface-3); }
