/* ================================================================
   RAG AGENT PLATFORM - MODERN UI STYLES
   Professional design system with smooth micro-interactions
   ================================================================ */

/* ================================================================
   1. CSS RESET & BASE
   ================================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

*:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

/* ================================================================
   2. DESIGN TOKENS (CSS CUSTOM PROPERTIES)
   ================================================================ */
:root {
    /* Color Palette - Light Theme */
    --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;

    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    --success-50: #ecfdf5;
    --success-500: #10b981;
    --success-600: #059669;
    --success-700: #047857;

    --warning-50: #fffbeb;
    --warning-500: #f59e0b;
    --warning-600: #d97706;

    --danger-50: #fef2f2;
    --danger-500: #ef4444;
    --danger-600: #dc2626;
    --danger-700: #b91c1c;

    /* Semantic Colors - Light Theme */
    --bg-primary: #f9fafb;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f3f4f6;
    --bg-elevated: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --border-color: #e5e7eb;
    --border-hover: #d1d5db;
    --input-bg: #ffffff;
    --card-bg: #ffffff;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
    --gradient-header: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);

    /* Spacing Scale (4px base) */
    --space-1: 0.25rem;   /* 4px */
    --space-2: 0.5rem;    /* 8px */
    --space-3: 0.75rem;   /* 12px */
    --space-4: 1rem;      /* 16px */
    --space-5: 1.25rem;   /* 20px */
    --space-6: 1.5rem;    /* 24px */
    --space-8: 2rem;      /* 32px */
    --space-10: 2.5rem;   /* 40px */
    --space-12: 3rem;     /* 48px */
    --space-16: 4rem;     /* 64px */

    /* Typography */
    --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', 'Courier New', monospace;

    --text-xs: clamp(0.75rem, 0.7rem + 0.2vw, 0.8rem);
    --text-sm: clamp(0.875rem, 0.85rem + 0.125vw, 0.9375rem);
    --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.0625rem);
    --text-lg: clamp(1.125rem, 1.05rem + 0.35vw, 1.25rem);
    --text-xl: clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);
    --text-2xl: clamp(1.5rem, 1.35rem + 0.75vw, 2rem);
    --text-3xl: clamp(1.875rem, 1.65rem + 1vw, 2.5rem);

    /* Shadows - Elevation System */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px 0 rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 400ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Dark Theme */
[data-theme="dark"] {
    --primary-500: #60a5fa;
    --primary-600: #3b82f6;
    --primary-700: #2563eb;

    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-elevated: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --border-color: #334155;
    --border-hover: #475569;
    --input-bg: #1e293b;
    --card-bg: #1e293b;

    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 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 -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.7);

    --gradient-header: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
}

/* ================================================================
   3. BASE STYLES
   ================================================================ */
html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color var(--transition-base), color var(--transition-base);
}

/* ================================================================
   4. LAYOUT COMPONENTS
   ================================================================ */
.header {
    background: var(--gradient-header);
    border-bottom: 1px solid var(--border-color);
    padding: var(--space-6) var(--space-8);
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
    transition: all var(--transition-base);
}

.header-content {
    flex: 1;
}

.header h1 {
    font-family: var(--font-heading);
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header p {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    font-weight: 500;
}

.theme-toggle {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-base);
    font-size: var(--text-sm);
    font-weight: 600;
    box-shadow: var(--shadow-xs);
}

.theme-toggle:hover {
    background: var(--border-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.theme-toggle:active {
    transform: translateY(0);
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: var(--space-8);
}

.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-8);
}

.grid > * {
    min-width: 0;
    overflow-x: hidden;
}

@media (min-width: 768px) {
    .grid {
        grid-template-columns: 280px 1fr;
    }
}

@media (min-width: 1024px) {
    .grid {
        grid-template-columns: 350px 1fr;
    }
}

/* ================================================================
   5. NAVIGATION
   ================================================================ */
.nav-tabs {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-8);
    border-bottom: 2px solid var(--border-color);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.nav-tabs::-webkit-scrollbar {
    height: 3px;
}

.nav-tabs::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

.nav-tabs::-webkit-scrollbar-thumb {
    background: var(--primary-500);
    border-radius: var(--radius-full);
}

.nav-tab {
    padding: var(--space-4) var(--space-6);
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
    position: relative;
}

.nav-tab::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-500);
    transform: scaleX(0);
    transition: transform var(--transition-base);
}

.nav-tab:hover {
    color: var(--primary-600);
    background: var(--primary-50);
}

[data-theme="dark"] .nav-tab:hover {
    background: var(--bg-tertiary);
}

.nav-tab.active {
    color: var(--primary-600);
}

.nav-tab.active::after {
    transform: scaleX(1);
}

/* Inner agent tabs (Chat / Settings) */
.agent-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: var(--space-6);
}

.agent-tab {
    padding: var(--space-3) var(--space-5);
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
}

.agent-tab:hover {
    color: var(--primary-600);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.agent-tab.active {
    color: var(--primary-600);
    border-bottom-color: var(--primary-500);
}

.agent-tab-panel {
    display: none;
    animation: fadeIn var(--transition-base);
}

.agent-tab-panel.active {
    display: block;
}

.view {
    display: none;
}

.view.active {
    display: block;
    animation: fadeIn var(--transition-base);
}

/* ================================================================
   6. FORMS & INPUTS
   ================================================================ */

/* Form sections with visual separation */
.form-section {
    padding-top: var(--space-6);
    margin-top: var(--space-6);
    border-top: 2px solid var(--border-color);
}

.form-section:first-of-type {
    padding-top: 0;
    margin-top: 0;
    border-top: none;
}

.form-section-title {
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* Toggle Switch */
.toggle-container {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    transition: all var(--transition-base);
    cursor: pointer;
}

.toggle-container:hover {
    background: var(--border-color);
    border-color: var(--border-hover);
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--gray-300);
    transition: var(--transition-base);
    border-radius: var(--radius-full);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition-base);
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary-500);
}

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

[data-theme="dark"] .toggle-slider {
    background-color: var(--gray-600);
}

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

.toggle-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--text-base);
    margin-bottom: var(--space-1);
    display: block;
}

.toggle-description {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Tooltip system */
.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-500);
    color: white;
    font-size: 12px;
    font-weight: 700;
    font-style: normal;
    cursor: help;
    position: relative;
    margin-left: var(--space-2);
    flex-shrink: 0;
    transition: all var(--transition-base);
    vertical-align: middle;
}

.info-icon::before {
    content: 'i';
    color: white;
    z-index: 1;
}

.info-icon:hover {
    background: var(--primary-600);
    transform: scale(1.1);
}

.info-icon::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    background: var(--card-bg);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    line-height: 1.6;
    white-space: normal;
    width: 300px;
    max-width: 90vw;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
    font-weight: 400;
    text-align: left;
    word-wrap: break-word;
}

.info-icon:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) scale(1);
}

[data-theme="dark"] .info-icon::after {
    background: var(--card-bg);
    color: var(--text-primary);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
}

select,
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
textarea {
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    background: var(--input-bg);
    color: var(--text-primary);
    transition: all var(--transition-base);
    font-family: var(--font-body);
}

select:hover,
input:hover,
textarea:hover {
    border-color: var(--border-hover);
}

select:focus,
input:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100);
    transform: translateY(-1px);
}

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

.form-group {
    margin-bottom: var(--space-5);
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.form-group:has(.multi-select-container) {
    width: 100%;
    max-width: 100%;
}

.form-group label {
    display: block;
    margin-bottom: var(--space-2);
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--text-sm);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.checkbox-label {
    display: flex;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    background: var(--card-bg);
    font-size: var(--text-sm);
}

.checkbox-label:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-500);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.checkbox-label input {
    margin-right: var(--space-2);
    cursor: pointer;
}

textarea {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

.param-input-group {
    margin-bottom: var(--space-4);
}

.param-input-group label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 600;
    margin-bottom: var(--space-2);
    color: var(--text-primary);
}

.param-input-group input,
.param-input-group textarea {
    width: 100%;
    padding: var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: var(--text-sm);
}

.param-input-group small {
    display: block;
    margin-top: var(--space-2);
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

/* ================================================================
   7. BUTTONS
   ================================================================ */
button {
    padding: var(--space-3) var(--space-5);
    background: var(--primary-500);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-xs);
    font-family: var(--font-body);
}

button:hover {
    background: var(--primary-600);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: var(--shadow-xs) !important;
}

.btn-sm {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-xs);
}

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

.btn-success:hover {
    background: var(--success-600);
}

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

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

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

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

/* ================================================================
   8. CARDS & PANELS
   ================================================================ */
.panel {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-6);
    border: 1px solid var(--border-color);
    transition: all var(--transition-base);
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

#agentForm {
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

#agentForm > * {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.panel:hover {
    box-shadow: var(--shadow-md);
}

.panel h2 {
    font-family: var(--font-heading);
    font-size: var(--text-xl);
    font-weight: 700;
    margin-bottom: var(--space-5);
    color: var(--text-primary);
}

.agent-card {
    padding: var(--space-5);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
    cursor: pointer;
    transition: all var(--transition-base);
    background: var(--card-bg);
    position: relative;
    overflow: hidden;
}

.agent-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary-500);
    transform: scaleY(0);
    transition: transform var(--transition-base);
}

.agent-card:hover {
    border-color: var(--primary-500);
    background: var(--bg-tertiary);
    transform: translateX(4px);
    box-shadow: var(--shadow-lg);
}

.agent-card:hover::before {
    transform: scaleY(1);
}

.agent-card.active {
    border-color: var(--primary-500) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background: linear-gradient(135deg, var(--primary-50) 0%, var(--card-bg) 100%) !important;
}

[data-theme="dark"] .agent-card.active {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, var(--card-bg) 100%) !important;
}

.agent-card.active::before {
    transform: scaleY(1);
}

.agent-card.active::after {
    content: '✓ Selected';
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    background: var(--primary-500);
    color: white;
    font-size: var(--text-xs);
    font-weight: 600;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    line-height: 1.2;
}

.agent-name {
    font-weight: 700;
    font-size: var(--text-base);
    color: var(--text-primary);
    margin-bottom: var(--space-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agent-model {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    font-weight: 500;
}

.agent-kbs {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    margin-top: var(--space-2);
}

.agent-date {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    margin-top: var(--space-1);
    font-style: italic;
}

/* ================================================================
   9. TABLES
   ================================================================ */
.models-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.models-table th {
    background: var(--bg-tertiary);
    padding: var(--space-4);
    text-align: left;
    font-weight: 700;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-primary);
    position: sticky;
    top: 0;
    z-index: 10;
}

.models-table td {
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.models-table tr {
    transition: all var(--transition-fast);
}

.models-table tr:hover {
    background: var(--bg-tertiary);
    transform: scale(1.01);
}

.model-badge {
    display: inline-block;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.model-badge.digitalocean {
    background: rgba(0, 128, 255, 0.15);
    color: #0080ff;
}

.model-badge.openai {
    background: rgba(16, 163, 127, 0.15);
    color: #10a37f;
}

.model-badge.anthropic {
    background: rgba(212, 129, 104, 0.15);
    color: #d48168;
}

/* ================================================================
   10. STATISTICS
   ================================================================ */
.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-5);
    margin-bottom: var(--space-6);
}

.stat-card {
    background: var(--card-bg);
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: all var(--transition-base);
}

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

.stat-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: var(--text-3xl);
    font-weight: 800;
    color: var(--text-primary);
    font-family: var(--font-heading);
}

/* ================================================================
   11. PROGRESS INDICATORS
   ================================================================ */
.progress-indicator {
    background: var(--bg-tertiary);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary-500);
    font-size: var(--text-sm);
    box-shadow: var(--shadow-xs);
}

.progress-step {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.progress-timer {
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

/* ================================================================
   12. CHAT INTERFACE
   ================================================================ */
.chat-container {
    max-height: 500px;
    overflow-y: auto;
    padding: var(--space-5);
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-5);
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-500) var(--bg-tertiary);
}

.chat-container::-webkit-scrollbar {
    width: 8px;
}

.chat-container::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

.chat-container::-webkit-scrollbar-thumb {
    background: var(--primary-500);
    border-radius: var(--radius-full);
}

.chat-message {
    margin-bottom: var(--space-5);
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-lg);
    max-width: 80%;
    animation: slideInMessage var(--transition-base);
    box-shadow: var(--shadow-xs);
}

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

.chat-message.user {
    background: var(--primary-500);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: var(--radius-sm);
}

.chat-message.assistant {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-bottom-left-radius: var(--radius-sm);
}

/* Markdown rendering inside assistant messages */
.chat-message.assistant p {
    margin-bottom: var(--space-3);
    line-height: 1.7;
}

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

.chat-message.assistant h1,
.chat-message.assistant h2,
.chat-message.assistant h3,
.chat-message.assistant h4,
.chat-message.assistant h5,
.chat-message.assistant h6 {
    margin: var(--space-4) 0 var(--space-2);
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-primary);
}

.chat-message.assistant h1 {
    font-size: var(--text-xl);
}

.chat-message.assistant h2 {
    font-size: var(--text-lg);
}

.chat-message.assistant h3 {
    font-size: var(--text-base);
}

.chat-message.assistant ul,
.chat-message.assistant ol {
    margin: var(--space-2) 0 var(--space-3) var(--space-5);
    line-height: 1.7;
}

.chat-message.assistant li {
    margin-bottom: var(--space-1);
}

.chat-message.assistant strong {
    font-weight: 700;
}

.chat-message.assistant em {
    font-style: italic;
}

.chat-message.assistant code {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.125rem var(--space-2);
    font-size: 0.9em;
    font-family: var(--font-mono);
}

.chat-message.assistant pre {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-4) var(--space-5);
    margin: var(--space-3) 0;
    overflow-x: auto;
}

.chat-message.assistant pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: var(--text-sm);
}

.chat-message.assistant blockquote {
    border-left: 4px solid var(--primary-500);
    margin: var(--space-3) 0;
    padding: var(--space-1) 0 var(--space-1) var(--space-4);
    color: var(--text-secondary);
    font-style: italic;
}

.chat-message.assistant hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: var(--space-4) 0;
}

.chat-message.assistant table {
    border-collapse: collapse;
    width: 100%;
    margin: var(--space-3) 0;
    font-size: var(--text-sm);
}

.chat-message.assistant th,
.chat-message.assistant td {
    border: 1px solid var(--border-color);
    padding: var(--space-2) var(--space-3);
    text-align: left;
}

.chat-message.assistant th {
    background: var(--bg-tertiary);
    font-weight: 700;
}

.chat-message.assistant a {
    color: var(--primary-500);
    text-decoration: underline;
}

.chat-message.assistant a:hover {
    color: var(--primary-600);
}

/* Special styling for italic sections at the end (like "Next Steps") */
.chat-message.assistant .next-steps-section {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--card-bg) 100%);
    border-left: 4px solid var(--primary-400);
    padding: var(--space-4) var(--space-5);
    margin-top: var(--space-6);
    border-radius: var(--radius-md);
    font-style: italic;
    color: var(--text-secondary);
}

.chat-message.assistant .next-steps-section p {
    margin-bottom: var(--space-2);
}

.chat-message.assistant .next-steps-section p:last-child {
    margin-bottom: 0;
}

/* ================================================================
   13. MODALS
   ================================================================ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 9999;
    animation: fadeIn var(--transition-base);
}

.modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.modal {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-2xl);
    animation: slideUp var(--transition-slow);
    border: 1px solid var(--border-color);
}

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

.modal-header {
    font-size: var(--text-xl);
    font-weight: 700;
    margin-bottom: var(--space-5);
    color: var(--text-primary);
    font-family: var(--font-heading);
}

.modal-body {
    margin-bottom: var(--space-6);
    color: var(--text-secondary);
    line-height: 1.6;
}

.modal-input {
    width: 100%;
    padding: var(--space-4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    background: var(--bg-primary);
    color: var(--text-primary);
    margin-top: var(--space-3);
}

.modal-input:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100);
}

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

.modal-footer {
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
}

.modal-button {
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-size: var(--text-sm);
    transition: all var(--transition-base);
}

.modal-button.primary {
    background: var(--primary-500);
    color: white;
}

.modal-button.primary:hover {
    background: var(--primary-600);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.modal-button.secondary:hover {
    background: var(--border-color);
}

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

.modal-button.danger:hover {
    background: var(--danger-600);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.modal-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.modal-error {
    color: var(--danger-500);
    font-size: var(--text-sm);
    margin-top: var(--space-3);
    display: none;
    font-weight: 600;
}

.modal-error.active {
    display: block;
    animation: shake 0.3s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ================================================================
   14. API DOCUMENTATION STYLES
   ================================================================ */
.api-section {
    margin-bottom: var(--space-8);
}

.api-section h3 {
    font-size: var(--text-lg);
    font-weight: 700;
    margin-bottom: var(--space-4);
    color: var(--text-primary);
}

.api-info-box {
    background: var(--bg-tertiary);
    padding: var(--space-5);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
    border: 1px solid var(--border-color);
}

.api-info-label {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
}

.api-info-value {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-primary);
    word-break: break-all;
}

.code-block {
    position: relative;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-5);
    margin-bottom: var(--space-4);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
}

.code-block code {
    display: block;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-primary);
    white-space: pre;
    word-break: normal;
}

.code-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--border-color);
}

.code-block-title {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-body);
}

.copy-button {
    padding: var(--space-1) var(--space-4);
    background: var(--primary-500);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--text-xs);
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: var(--font-body);
    font-weight: 600;
}

.copy-button:hover {
    background: var(--primary-600);
    transform: translateY(-1px);
}

.copy-button.copied {
    background: var(--success-500);
}

.copy-button.copied::after {
    content: ' ✓';
}

/* ================================================================
   15. UTILITY STATES
   ================================================================ */
.loading {
    color: var(--primary-500);
    font-weight: 600;
}

.error {
    color: var(--danger-500);
    padding: var(--space-4);
    background: var(--danger-50);
    border: 1px solid var(--danger-500);
    border-radius: var(--radius-md);
    margin-top: var(--space-4);
    font-weight: 600;
}

[data-theme="dark"] .error {
    background: rgba(239, 68, 68, 0.1);
}

.success {
    color: var(--success-600);
    padding: var(--space-4);
    background: var(--success-50);
    border: 1px solid var(--success-500);
    border-radius: var(--radius-md);
    margin-top: var(--space-4);
    font-weight: 600;
}

[data-theme="dark"] .success {
    background: rgba(16, 185, 129, 0.1);
}

.empty-state {
    text-align: center;
    padding: var(--space-16) var(--space-8);
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    border: 2px dashed var(--border-color);
}

.empty-state::before {
    content: '📭';
    display: block;
    font-size: 4rem;
    margin-bottom: var(--space-5);
    opacity: 0.5;
}

.empty-state p {
    font-size: var(--text-base);
    font-weight: 500;
}

/* ================================================================
   16. LOADING ANIMATIONS
   ================================================================ */
@keyframes skeleton-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

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

.skeleton {
    animation: skeleton-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    background: linear-gradient(90deg,
            var(--gray-200) 0%,
            var(--gray-100) 50%,
            var(--gray-200) 100%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease infinite;
    border-radius: var(--radius-md);
}

[data-theme="dark"] .skeleton {
    background: linear-gradient(90deg,
            var(--gray-700) 0%,
            var(--gray-600) 50%,
            var(--gray-700) 100%);
    background-size: 200% 100%;
}

/* Typing indicator */
@keyframes typing-dot {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

.typing-indicator {
    display: flex;
    gap: var(--space-1);
    padding: var(--space-3);
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: var(--radius-full);
    animation: typing-dot 1.4s infinite;
}

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

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

/* ================================================================
   17. RESPONSIVE DESIGN
   ================================================================ */
@media (max-width: 767px) {
    .container {
        padding: var(--space-4);
    }

    .header {
        flex-direction: column;
        gap: var(--space-4);
        text-align: center;
        padding: var(--space-5);
    }

    .nav-tabs {
        gap: 0;
        scrollbar-width: none;
    }

    .nav-tabs::-webkit-scrollbar {
        display: none;
    }

    .nav-tab {
        padding: var(--space-3) var(--space-4);
        font-size: var(--text-xs);
    }

    .grid {
        grid-template-columns: 1fr;
        gap: var(--space-6);
    }

    .agent-card {
        margin-bottom: var(--space-3);
    }

    .chat-message {
        max-width: 90%;
    }

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

    .panel {
        padding: var(--space-5);
    }

    .modal {
        width: 95%;
        padding: var(--space-6);
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .container {
        padding: var(--space-6);
    }
}

/* ================================================================
   18. ACCESSIBILITY
   ================================================================ */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-500);
    color: white;
    padding: var(--space-2) var(--space-4);
    text-decoration: none;
    font-weight: 600;
    border-radius: var(--radius-md);
}

.skip-link:focus {
    top: var(--space-2);
}

/* 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;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --text-primary: #000000;
    }

    [data-theme="dark"] {
        --border-color: #ffffff;
        --text-primary: #ffffff;
    }
}

/* ================================================================
   19. PRINT STYLES
   ================================================================ */
@media print {
    .header,
    .nav-tabs,
    .theme-toggle,
    button {
        display: none;
    }

    .panel {
        break-inside: avoid;
    }
}

/* ================================================================
   20. ADDITIONAL UI ENHANCEMENTS
   ================================================================ */

/* Toast Notification System */
.toast-container {
    position: fixed;
    top: var(--space-8);
    right: var(--space-8);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    pointer-events: none;
}

.toast {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-5) var(--space-6);
    min-width: 320px;
    max-width: 500px;
    box-shadow: var(--shadow-xl);
    pointer-events: all;
    animation: slideInToast var(--transition-base) ease-out;
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    border-left: 4px solid var(--primary-500);
}

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

.toast.toast-success {
    border-left-color: var(--success-500);
}

.toast.toast-error {
    border-left-color: var(--danger-500);
}

.toast.toast-warning {
    border-left-color: var(--warning-500);
}

.toast.toast-removing {
    animation: slideOutToast var(--transition-base) ease-in forwards;
}

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

.toast-icon {
    font-size: var(--text-xl);
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 700;
    font-size: var(--text-base);
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.toast-message {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.5;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    font-size: var(--text-lg);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.toast-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transform: scale(1.1);
}

/* Details/Summary styling */
details {
    cursor: pointer;
}

details summary {
    transition: color var(--transition-base);
    user-select: none;
}

details summary:hover {
    color: var(--primary-600);
}

details[open] summary {
    margin-bottom: var(--space-3);
}

/* File input styling */
input[type="file"] {
    padding: var(--space-3);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    cursor: pointer;
    transition: all var(--transition-base);
    width: 100%;
    font-size: var(--text-sm);
}

input[type="file"]:hover {
    border-color: var(--primary-500);
    background: var(--primary-50);
}

[data-theme="dark"] input[type="file"]:hover {
    background: rgba(59, 130, 246, 0.1);
}

input[type="file"]:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100);
}

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

/* Document badge styling */
.doc-badge {
    display: inline-block;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 700;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    margin-right: var(--space-2);
}

/* Batch item styling */
.batch-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-2);
    border: 1px solid var(--border-color);
    transition: all var(--transition-base);
}

.batch-item:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-500);
    transform: translateX(2px);
}

.batch-item-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--text-sm);
}

.batch-item-size {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    margin-top: var(--space-1);
}

/* Progress bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-top: var(--space-3);
}

.progress-bar-fill {
    height: 100%;
    background: var(--gradient-primary);
    transition: width var(--transition-slow);
    border-radius: var(--radius-full);
}

/* ================================================================
   KB OPERATION STATES - Disable interactions during operations
   ================================================================ */

/* Selected KB card state */
.kb-card-selected {
    border-color: var(--primary-500) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background: linear-gradient(135deg, var(--primary-50) 0%, var(--card-bg) 100%) !important;
}

/* Dark mode selected state */
[data-theme="dark"] .kb-card-selected {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, var(--card-bg) 100%) !important;
}

/* Disabled KB card state */
.kb-card-disabled {
    opacity: 0.6;
    pointer-events: none !important;
    cursor: not-allowed !important;
}

/* Processing KB card state */
.kb-card-processing {
    border-color: var(--warning-500) !important;
    background: linear-gradient(135deg, var(--warning-50) 0%, var(--card-bg) 100%) !important;
}

/* Dark mode processing state */
[data-theme="dark"] .kb-card-processing {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.1) 0%, var(--card-bg) 100%) !important;
}

/* Small spinner for processing indicator */
.spinner-small {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid var(--warning-200);
    border-top-color: var(--warning-600);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Disabled navigation tabs during operations */
.nav-tab.disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}

/* ================================================================
   MULTI-SELECT COMPONENT STYLES
   ================================================================ */
.multi-select-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

/* Search Input */
.multi-select-search {
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.multi-select-search input {
    width: 100%;
    max-width: 100%;
    padding: var(--space-3) var(--space-4) var(--space-3) var(--space-10);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    transition: all 0.2s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%236b7280' d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.2.2.48.34.752.34a1 1 0 0 0 1-1 6.5 6.5 0 0 0 1.398-1.397M12.5 11.5a1 1 0 0 1 1.414 1.414l3 3a1 1 0 0 1-1.414 1.414l-3-3a1 1 0 0 1 0-1.414z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: var(--space-3) center;
    background-size: 16px;
    box-sizing: border-box;
}

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

.multi-select-search input::placeholder {
    color: var(--text-secondary);
}

/* Results List */
.multi-select-results {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2);
    max-height: 350px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--space-2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--card-bg);
    min-height: 120px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .multi-select-results {
        grid-template-columns: 1fr;
    }
}

.multi-select-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    min-width: 0;
    min-height: 44px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
    flex-shrink: 0;
}

.multi-select-result-item:hover {
    background: var(--border-color);
}

.multi-select-result-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.multi-select-result-name {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
    overflow-wrap: break-word;
    word-break: break-word;
    line-height: 1.4;
}

.multi-select-result-desc {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    overflow-wrap: break-word;
    word-break: break-word;
    line-height: 1.4;
}

.multi-select-result-add {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    flex-shrink: 0;
    background: var(--primary-500);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    padding: 0;
}

.multi-select-result-add:hover {
    background: var(--primary-600);
    transform: scale(1.05);
}

.multi-select-empty {
    padding: var(--space-6) var(--space-4);
    text-align: center;
    color: var(--text-secondary);
    font-size: var(--text-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
    grid-column: 1 / -1;
}

/* Selected Items List */
.multi-select-selected {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.multi-select-selected-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.multi-select-selected-items {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2);
    min-height: 40px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

@media (max-width: 768px) {
    .multi-select-selected-items {
        grid-template-columns: 1fr;
    }
}

.multi-select-selected-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: linear-gradient(135deg, var(--primary-50), var(--primary-100));
    border: 1px solid var(--primary-200);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    min-width: 0;
    min-height: 44px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
    flex-shrink: 0;
}

[data-theme="dark"] .multi-select-selected-item {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(59, 130, 246, 0.1));
    border-color: rgba(59, 130, 246, 0.3);
}

.multi-select-selected-item:hover {
    background: linear-gradient(135deg, var(--primary-100), var(--primary-200));
    border-color: var(--primary-300);
}

[data-theme="dark"] .multi-select-selected-item:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.25), rgba(59, 130, 246, 0.15));
    border-color: rgba(59, 130, 246, 0.4);
}

.multi-select-selected-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.multi-select-selected-name {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--primary-700);
    overflow-wrap: break-word;
    word-break: break-word;
    line-height: 1.4;
}

[data-theme="dark"] .multi-select-selected-name {
    color: var(--primary-300);
}

.multi-select-selected-desc {
    font-size: var(--text-xs);
    color: var(--primary-600);
    overflow-wrap: break-word;
    word-break: break-word;
    line-height: 1.4;
    opacity: 0.8;
}

[data-theme="dark"] .multi-select-selected-desc {
    color: var(--primary-400);
    opacity: 0.7;
}

.multi-select-selected-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    flex-shrink: 0;
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-600);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.2s ease;
    padding: 0;
}

.multi-select-selected-remove:hover {
    background: var(--danger-500);
    color: white;
    border-color: var(--danger-500);
    transform: scale(1.05);
}

.multi-select-no-selected {
    padding: var(--space-4);
    text-align: center;
    color: var(--text-secondary);
    font-size: var(--text-xs);
    font-style: italic;
    grid-column: 1 / -1;
}

