/* RAG Chat - Modern Professional Styles */

/* ========================================
   CSS Variables - Light Theme
   ======================================== */
:root {
    /* Primary Colors */
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-200: #bfdbfe;
    --primary-300: #93c5fd;
    --primary-400: #60a5fa;
    --primary-500: #3b82f6;
    --primary-600: #2563eb;
    --primary-700: #1d4ed8;
    --primary-800: #1e40af;
    --primary-900: #1e3a8a;

    /* Neutral Colors */
    --neutral-50: #f8fafc;
    --neutral-100: #f1f5f9;
    --neutral-200: #e2e8f0;
    --neutral-300: #cbd5e1;
    --neutral-400: #94a3b8;
    --neutral-500: #64748b;
    --neutral-600: #475569;
    --neutral-700: #334155;
    --neutral-800: #1e293b;
    --neutral-900: #0f172a;
    --neutral-950: #020617;

    /* Semantic Colors */
    --success-50: #f0fdf4;
    --success-500: #22c55e;
    --success-600: #16a34a;
    --warning-50: #fffbeb;
    --warning-500: #f59e0b;
    --warning-600: #d97706;
    --danger-50: #fef2f2;
    --danger-500: #ef4444;
    --danger-600: #dc2626;

    /* Theme Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-elevated: #ffffff;
    --bg-overlay: rgba(0, 0, 0, 0.5);
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #64748b;
    --text-inverse: #ffffff;
    
    --border-primary: #e2e8f0;
    --border-secondary: #cbd5e1;
    
    --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 -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);

    /* Accent gradient */
    --gradient-primary: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    --gradient-secondary: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
}

/* ========================================
   CSS Variables - Dark Theme
   ======================================== */
[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #242424;
    --bg-tertiary: #2d2d2d;
    --bg-elevated: #1f1f1f;
    --bg-overlay: rgba(0, 0, 0, 0.7);
    
    --text-primary: #e5e5e5;
    --text-secondary: #a3a3a3;
    --text-tertiary: #737373;
    --text-inverse: #1a1a1a;
    
    --border-primary: #404040;
    --border-secondary: #525252;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
}

/* ========================================
   Base Styles
   ======================================== */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ========================================
   Scrollbar Styling
   ======================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--neutral-400);
    border-radius: 4px;
}

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

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: var(--neutral-600);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: var(--neutral-500);
}

/* ========================================
   Typography
   ======================================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.25;
    color: var(--text-primary);
}

/* ========================================
   Modern Card Component
   ======================================== */
.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-secondary);
}

/* ========================================
   Modern Button Styles
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(59, 130, 246, 0.39);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(59, 130, 246, 0.5);
}

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

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-elevated);
    border-color: var(--border-secondary);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

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

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

.btn-danger:hover:not(:disabled) {
    background: var(--danger-600);
}

/* ========================================
   Modern Input Styles
   ======================================== */
.input {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.input:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

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

/* ========================================
   Modern Sidebar Styles
   ======================================== */
.sidebar {
    background: var(--bg-elevated);
    border-right: 1px solid var(--border-primary);
}

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

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

.sidebar-nav-item.active {
    background: var(--primary-50);
    color: var(--primary-600);
}

[data-theme="dark"] .sidebar-nav-item.active {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    font-weight: 600;
}

.sidebar-nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-nav-badge {
    margin-left: auto;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    background: var(--bg-tertiary);
    border-radius: 10px;
    color: var(--text-secondary);
}

/* ========================================
   Modern Header Styles
   ======================================== */
.header {
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-primary);
    backdrop-filter: blur(10px);
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========================================
   Status Indicator
   ======================================== */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    background: var(--bg-tertiary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: var(--success-500);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.status-dot.disconnected {
    background: var(--danger-500);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
    animation: none;
}

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

/* ========================================
   Chat Message Styles
   ======================================== */
.message-container {
    display: flex;
    margin-bottom: 16px;
}

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

.message-container.assistant {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 70%;
    padding: 14px 18px;
    border-radius: 16px;
    line-height: 1.5;
}

.message-bubble.user {
    background: var(--gradient-primary);
    color: white;
    border-bottom-right-radius: 6px;
}

.message-bubble.assistant {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
    border-bottom-left-radius: 6px;
    box-shadow: var(--shadow-sm);
}

/* ========================================
   Image Preview Box
   ======================================== */
.image-preview-box {
    background: var(--bg-elevated);
    border: 1px solid var(--border-primary);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.image-preview-box:hover {
    border-color: var(--primary-300);
    box-shadow: var(--shadow-md);
}

[data-theme="dark"] .image-preview-box:hover {
    border-color: var(--primary-600);
}

.image-preview-box img {
    display: block;
    background: var(--bg-secondary);
}

.image-preview-box img:hover {
    opacity: 0.95;
}

/* ========================================
   Tool Call Badge
   ======================================== */
.tool-call-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    font-size: 12px;
    color: var(--warning-600);
}

[data-theme="dark"] .tool-call-badge {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning-500);
}

/* ========================================
   Project/Note Cards
   ======================================== */
.item-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s ease;
}

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

[data-theme="dark"] .item-card:hover {
    border-color: var(--primary-600);
}

/* ========================================
   Tag Styles
   ======================================== */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 6px;
    background: var(--primary-50);
    color: var(--primary-700);
}

[data-theme="dark"] .tag {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary-300);
}

/* ========================================
   Modal Styles
   ======================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--bg-elevated);
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    max-width: 480px;
    width: 100%;
    margin: 16px;
    overflow: hidden;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-primary);
}

.modal-body {
    padding: 24px;
}

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

/* ========================================
   Theme Toggle Button
   ======================================== */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

/* ========================================
   Empty State
   ======================================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    color: var(--text-tertiary);
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    max-width: 300px;
}

/* ========================================
   Loading Spinner
   ======================================== */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-primary);
    border-top-color: var(--primary-500);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ========================================
   Typing Indicator
   ======================================== */
.typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 12px 16px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--neutral-400);
    animation: typing-bounce 1.4s infinite ease-in-out both;
}

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

@keyframes typing-bounce {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* ========================================
   Code Blocks
   ======================================== */
pre {
    background: var(--neutral-900);
    color: #e2e8f0;
    padding: 16px;
    border-radius: 10px;
    overflow-x: auto;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.6;
}

code {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--primary-600);
}

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

pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    color: inherit;
}

/* ========================================
   Animations
   ======================================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease;
}

.animate-slide-in {
    animation: slideIn 0.3s ease;
}

.message-user {
    animation: slideInRight 0.3s ease;
}

.message-assistant {
    animation: slideInLeft 0.3s ease;
}

/* ========================================
   HTMX Loading States
   ======================================== */
.htmx-request .htmx-indicator {
    display: inline-block;
}

.htmx-request.htmx-indicator {
    display: none;
}

.htmx-swapping {
    opacity: 0;
    transition: opacity 0.2s ease-out;
}

.htmx-settling {
    opacity: 1;
    transition: opacity 0.2s ease-out;
}

/* ========================================
   Utility Classes
   ======================================== */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Visually Hidden (Accessibility) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus Visible for Keyboard Navigation */
:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .message-bubble {
        max-width: 85%;
    }
    
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 40;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
}

/* ========================================
   Alpine.js Cloak
   ======================================== */
[x-cloak] {
    display: none !important;
}

/* ========================================
   Model Selector Styles
   ======================================== */
.model-selector-dropdown {
    background: var(--bg-elevated);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.25);
}

.model-item {
    transition: all 0.15s ease;
}

.model-item:hover {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.08) 0%, rgba(147, 51, 234, 0.08) 100%);
}

.model-item.selected {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.15) 0%, rgba(147, 51, 234, 0.15) 100%);
}

/* Model Info Card Gradient Animation */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.model-info-header {
    background: linear-gradient(
        135deg,
        rgba(59, 130, 246, 0.12) 0%,
        rgba(147, 51, 234, 0.12) 50%,
        rgba(59, 130, 246, 0.12) 100%
    );
    background-size: 200% 100%;
}

/* Feature Badge Colors */
.feature-badge {
    font-size: 11px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 6px;
    transition: transform 0.15s ease;
}

.feature-badge:hover {
    transform: scale(1.05);
}

/* Pricing Card Styles */
.pricing-card {
    background: var(--bg-tertiary);
    border-radius: 10px;
    transition: all 0.2s ease;
}

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

/* Model Status Indicator */
.status-online {
    color: var(--success-500);
}

.status-offline {
    color: var(--danger-500);
}

/* Custom Range Slider */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-tertiary);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--gradient-primary);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.4);
    transition: transform 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 50%;
    background: var(--gradient-primary);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.4);
}

/* Settings Page Specific */
.settings-section {
    animation: fadeIn 0.4s ease-out;
}

.settings-section:nth-child(1) { animation-delay: 0.1s; }
.settings-section:nth-child(2) { animation-delay: 0.2s; }
.settings-section:nth-child(3) { animation-delay: 0.3s; }

/* Free Model Badge Glow */
.free-badge {
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px rgba(34, 197, 94, 0.5); }
    50% { box-shadow: 0 0 15px rgba(34, 197, 94, 0.8); }
}

/* Scrollbar for Model List */
.model-list-scroll::-webkit-scrollbar {
    width: 6px;
}

.model-list-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.model-list-scroll::-webkit-scrollbar-thumb {
    background: var(--neutral-300);
    border-radius: 3px;
}

[data-theme="dark"] .model-list-scroll::-webkit-scrollbar-thumb {
    background: var(--neutral-600);
}

/* Stats Grid Animation */
.stat-item {
    transition: all 0.2s ease;
}

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

/* Gradient Text for Important Values */
.gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Copy Button Hover Effect */
.copy-btn {
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background: var(--primary-50);
}

[data-theme="dark"] .copy-btn:hover {
    background: rgba(59, 130, 246, 0.15);
}

/* ========================================
   Modern Chat Input Container
   ======================================== */
.chat-input-container {
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.chat-input-container:hover {
    border-color: var(--border-secondary);
}

.chat-input-container:focus-within {
    border-color: var(--primary-400);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

[data-theme="dark"] .chat-input-container:focus-within {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Chat input textarea */
.chat-input-container textarea {
    scrollbar-width: thin;
    scrollbar-color: var(--neutral-300) transparent;
}

.chat-input-container textarea::-webkit-scrollbar {
    width: 6px;
}

.chat-input-container textarea::-webkit-scrollbar-track {
    background: transparent;
}

.chat-input-container textarea::-webkit-scrollbar-thumb {
    background: var(--neutral-300);
    border-radius: 3px;
}

[data-theme="dark"] .chat-input-container textarea::-webkit-scrollbar-thumb {
    background: var(--neutral-600);
}

.chat-input-container textarea::placeholder {
    color: var(--text-tertiary);
}

/* File attachment chip in chat input */
.chat-input-container .file-chip {
    animation: slideInUp 0.2s ease;
}

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

/* Send button pulse animation when ready */
.chat-input-container button[class*="bg-[var(--primary"]:not(:disabled) {
    animation: readyPulse 2s ease-in-out infinite;
}

@keyframes readyPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(59, 130, 246, 0);
    }
}

/* Drag and drop indicator styles (for future enhancement) */
.chat-input-container.drag-over {
    border-color: var(--primary-500);
    background: var(--primary-50);
}

[data-theme="dark"] .chat-input-container.drag-over {
    background: rgba(59, 130, 246, 0.1);
}

/* ========================================
   Mermaid Diagram Styles
   ======================================== */

/* Mermaid container */
.mermaid-container {
    margin: 1rem 0;
    padding: 1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-primary);
    border-radius: 0.75rem;
    overflow-x: auto;
    box-shadow: var(--shadow-sm);
}

/* Pre-render mermaid code (for loading state) */
.mermaid-container pre.mermaid {
    margin: 0;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 0.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-secondary);
    overflow-x: auto;
    white-space: pre-wrap;
}

/* Rendered mermaid diagram */
.mermaid-diagram {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100px;
    padding: 0.5rem;
}

.mermaid-diagram svg {
    max-width: 100%;
    height: auto;
    font-family: 'Inter', system-ui, sans-serif;
}

/* Mermaid error state */
.mermaid-container pre.mermaid-error {
    background: var(--danger-50);
    color: var(--danger-600);
    border: 1px solid var(--danger-500);
}

[data-theme="dark"] .mermaid-container pre.mermaid-error {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border-color: #dc2626;
}

/* Loading animation for mermaid */
.mermaid-container:has(pre.mermaid:not(.mermaid-rendered):not(.mermaid-error)) {
    position: relative;
}

.mermaid-container:has(pre.mermaid:not(.mermaid-rendered):not(.mermaid-error))::before {
    content: 'Rendering diagram...';
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: var(--primary-500);
    color: white;
    font-size: 0.75rem;
    border-radius: 9999px;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

/* Improve mermaid SVG contrast in dark mode */
[data-theme="dark"] .mermaid-diagram svg {
    filter: brightness(0.95) contrast(1.1);
}

/* Ensure mermaid text is readable */
.mermaid-diagram svg text {
    fill: var(--text-primary);
}

/* Scrollbar for wide diagrams */
.mermaid-container::-webkit-scrollbar {
    height: 8px;
}

.mermaid-container::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.mermaid-container::-webkit-scrollbar-thumb {
    background: var(--neutral-400);
    border-radius: 4px;
}

.mermaid-container::-webkit-scrollbar-thumb:hover {
    background: var(--neutral-500);
}

[data-theme="dark"] .mermaid-container::-webkit-scrollbar-thumb {
    background: var(--neutral-600);
}

[data-theme="dark"] .mermaid-container::-webkit-scrollbar-thumb:hover {
    background: var(--neutral-500);
}

/* ========================================
   Auth Page Styles - Light Theme
   ======================================== */
.auth-branding-panel {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #a855f7 100%);
}

/* Ensure white text on branding panel */
.auth-branding-panel * {
    color: #ffffff;
}

.auth-branding-panel h1,
.auth-branding-panel h3 {
    color: #ffffff !important;
}

.auth-branding-panel p {
    color: rgba(255, 255, 255, 0.85) !important;
}

.auth-branding-panel svg {
    color: #ffffff !important;
    stroke: #ffffff !important;
}

.auth-form-panel {
    background: #f8fafc;
}

.auth-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
}

.auth-logo {
    font-size: 1.875rem;
    font-weight: 700;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.auth-subtitle {
    font-size: 0.875rem;
    color: #64748b;
}

.auth-link {
    color: #3b82f6;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease;
}

.auth-link:hover {
    color: #2563eb;
    text-decoration: underline;
}

.auth-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #475569;
    margin-bottom: 0.5rem;
}

.auth-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #0f172a;
    transition: all 0.2s ease;
}

.auth-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.auth-input::placeholder {
    color: #94a3b8;
}

.auth-hint {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #94a3b8;
}

.auth-error {
    margin-bottom: 1.5rem;
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid #fca5a5;
    background: #fef2f2;
    color: #dc2626;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
}

.auth-submit-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(59, 130, 246, 0.35);
}

.auth-submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(59, 130, 246, 0.45);
}

.auth-submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.auth-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: #94a3b8;
}
