/* 
 * RAG Chatbot - Enterprise Premium Design
 * Inspired by Claude, ChatGPT, Notion, Linear
 * Professional color palette with warm neutrals
 */

/* ===== DESIGN TOKENS ===== */
:root {
    /* Light Theme - Warm, Professional, Approachable */

    /* Primary Brand - Teal (Trust, Intelligence, Calm) */
    --brand-50: #f0fdfa;
    --brand-100: #ccfbf1;
    --brand-200: #99f6e4;
    --brand-300: #5eead4;
    --brand-400: #2dd4bf;
    --brand-500: #14b8a6;
    --brand-600: #0d9488;
    --brand-700: #0f766e;

    /* Warm Neutrals - Not pure gray, adds personality */
    --stone-50: #fafaf9;
    --stone-100: #f5f5f4;
    --stone-200: #e7e5e4;
    --stone-300: #d6d3d1;
    --stone-400: #a8a29e;
    --stone-500: #78716c;
    --stone-600: #57534e;
    --stone-700: #44403c;
    --stone-800: #292524;
    --stone-900: #1c1917;

    /* Semantic Colors */
    --success: #16a34a;
    --warning: #ea580c;
    --error: #dc2626;
    --info: #0284c7;

    /* Applied Colors */
    --bg-primary: #ffffff;
    --bg-secondary: var(--stone-50);
    --bg-tertiary: var(--stone-100);
    --bg-hover: var(--stone-100);
    --bg-active: var(--stone-200);
    --bg-user-message: var(--stone-100);

    --text-primary: var(--stone-900);
    --text-secondary: var(--stone-600);
    --text-tertiary: var(--stone-500);
    --text-muted: var(--stone-400);
    --text-inverse: #ffffff;

    --border-default: var(--stone-200);
    --border-subtle: var(--stone-100);
    --border-strong: var(--stone-300);
    --border-focus: var(--brand-500);

    --accent: var(--brand-600);
    --accent-hover: var(--brand-700);
    --accent-light: var(--brand-50);

    /* Shadows - Subtle and refined */
    --shadow-xs: 0 1px 2px rgba(28, 25, 23, 0.05);
    --shadow-sm: 0 1px 3px rgba(28, 25, 23, 0.08), 0 1px 2px rgba(28, 25, 23, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(28, 25, 23, 0.08), 0 2px 4px -2px rgba(28, 25, 23, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(28, 25, 23, 0.08), 0 4px 6px -4px rgba(28, 25, 23, 0.04);
    --shadow-focus: 0 0 0 3px rgba(20, 184, 166, 0.2);

    /* Spacing Scale */
    --space-0: 0;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 20px;
    --radius-full: 9999px;

    /* Typography */
    --font-sans: 'Vazirmatn', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --font-size-xs: 12px;
    --font-size-sm: 13px;
    --font-size-base: 14px;
    --font-size-md: 15px;
    --font-size-lg: 16px;
    --font-size-xl: 18px;
    --font-size-2xl: 20px;
    --font-size-3xl: 24px;

    /* Animation */
    --ease-default: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-in: cubic-bezier(0.4, 0, 1, 1);
    --ease-out: cubic-bezier(0, 0, 0.2, 1);
    --duration-fast: 150ms;
    --duration-base: 200ms;
    --duration-slow: 300ms;
}

/* Dark Theme - Sophisticated, Not harsh */
[data-theme="dark"] {
    --bg-primary: var(--stone-900);
    --bg-secondary: #0f0e0d;
    --bg-tertiary: var(--stone-800);
    --bg-hover: var(--stone-800);
    --bg-active: var(--stone-700);
    --bg-user-message: var(--stone-800);

    --text-primary: var(--stone-100);
    --text-secondary: var(--stone-400);
    --text-tertiary: var(--stone-500);
    --text-muted: var(--stone-600);

    --border-default: var(--stone-700);
    --border-subtle: var(--stone-800);
    --border-strong: var(--stone-600);

    --accent: var(--brand-400);
    --accent-hover: var(--brand-300);
    --accent-light: rgba(45, 212, 191, 0.1);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px 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.5), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
}

/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: var(--font-size-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-secondary);
    color: var(--text-primary);
    direction: rtl;
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color var(--duration-slow) var(--ease-default),
        color var(--duration-slow) var(--ease-default);
}

/* Refined Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: var(--radius-full);
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
    border: 2px solid transparent;
    background-clip: padding-box;
}

/* ===== LAYOUT ===== */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 300px;
    background: var(--bg-primary);
    border-left: 1px solid var(--border-default);
    display: flex;
    flex-direction: column;
    transition: width var(--duration-slow) var(--ease-default);
}

.sidebar-header {
    padding: var(--space-5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--accent);
    color: var(--text-inverse);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: transform var(--duration-fast) var(--ease-out);
}

.logo-icon:hover {
    transform: scale(1.05);
}

.logo-text {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

/* Theme Toggle */
.theme-toggle {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
    background: var(--bg-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--text-secondary);
    transition: all var(--duration-fast) var(--ease-default);
}

.theme-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.theme-toggle:focus-visible {
    outline: none;
    box-shadow: var(--shadow-focus);
    border-color: var(--border-focus);
}

/* New Chat Button */
.new-chat-btn {
    margin: var(--space-4);
    padding: var(--space-3) var(--space-5);
    background: var(--accent);
    border: none;
    border-radius: var(--radius-lg);
    color: var(--text-inverse);
    font-family: inherit;
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    transition: all var(--duration-fast) var(--ease-default);
    box-shadow: var(--shadow-sm);
}

.new-chat-btn:hover {
    background: var(--accent-hover);
    box-shadow: var(--shadow-md);
}

.new-chat-btn:active {
    transform: translateY(1px);
}

.new-chat-btn:focus-visible {
    outline: none;
    box-shadow: var(--shadow-focus);
}

/* Conversation List */
.conversation-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-2) var(--space-3);
}

.conversation-item {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-1);
    transition: all var(--duration-fast) var(--ease-default);
    border: 1px solid transparent;
}

.conversation-item:hover {
    background: var(--bg-hover);
}

.conversation-item.active {
    background: var(--accent-light);
    border-color: var(--accent);
}

.conversation-title {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    transition: color var(--duration-fast);
}

.conversation-item:hover .conversation-title {
    color: var(--text-primary);
}

.conversation-item.active .conversation-title {
    color: var(--accent);
    font-weight: 500;
}

.conversation-delete {
    opacity: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    transition: all var(--duration-fast);
}

.conversation-item:hover .conversation-delete {
    opacity: 1;
}

.conversation-delete:hover {
    color: var(--error);
    background: rgba(220, 38, 38, 0.1);
}

/* Conversation Action Buttons */
.conversation-actions {
    display: flex;
    gap: var(--space-1);
    opacity: 0;
    transition: opacity var(--duration-fast);
}

.conversation-item:hover .conversation-actions {
    opacity: 1;
}

.conversation-action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--space-1);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration-fast);
}

.conversation-action-btn:hover {
    color: var(--accent);
    background: var(--accent-light);
}

.conversation-action-btn.delete:hover {
    color: var(--error);
    background: rgba(220, 38, 38, 0.1);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: var(--space-4);
    border-top: 1px solid var(--border-subtle);
}

.admin-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: var(--font-size-sm);
    font-weight: 500;
    transition: all var(--duration-fast);
    border: 1px solid transparent;
}

.admin-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-default);
}

/* Version Info in Sidebar */
.version-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-3);
    margin-top: var(--space-3);
    border-top: 1px solid var(--border-subtle);
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    text-align: center;
}

.version-info span:first-child {
    font-weight: 500;
}

/* Disclaimer Message */
.disclaimer-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    margin-top: var(--space-2);
    font-size: var(--font-size-xs);
    color: #b91c1c;
    /* Lighter red for light mode */
    text-align: center;
    font-weight: 500;
    opacity: 0.7;
    /* Softer appearance */
}

[data-theme="dark"] .disclaimer-message {
    color: #ef4444;
    /* Softer red for dark mode */
    opacity: 0.7;
}

.disclaimer-message svg {
    flex-shrink: 0;
    opacity: 0.7;
    stroke: currentColor;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    min-width: 0;
}

/* ===== CHAT CONTAINER ===== */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 820px;
    margin: 0 auto;
    width: 100%;
    padding: 0 var(--space-6);
    height: 100%;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-8) 0;
    min-height: 0;
}

/* ===== WELCOME SCREEN ===== */
.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: var(--space-12);
}

.welcome-icon {
    font-size: 56px;
    margin-bottom: var(--space-6);
}

.welcome-logo {
    height: 60px;
    width: auto;
    max-width: 320px;
    object-fit: contain;
    margin-bottom: var(--space-6);
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.08));
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.welcome-title {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-3);
    letter-spacing: -0.02em;
}

.welcome-subtitle {
    font-size: var(--font-size-md);
    color: var(--text-tertiary);
    max-width: 480px;
    line-height: 1.8;
    margin-bottom: var(--space-8);
    text-align: center;
}

.welcome-features {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    width: 100%;
    max-width: 400px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4);
    background: var(--bg-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    text-align: right;
    transition: all var(--duration-fast) var(--ease-default);
}

.feature-item:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
}

.feature-icon {
    width: 40px;
    height: 40px;
    background: var(--accent-light);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.feature-icon svg {
    width: 20px;
    height: 20px;
    color: var(--accent);
}

.feature-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.feature-text strong {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.feature-text span {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

/* Logo Image - For wide text-based logos like DeepMind */
.logo-img {
    height: 40px;
    width: auto;
    max-width: 160px;
    object-fit: contain;
}

/* Theme-aware logo switching */
.logo-light-theme {
    display: block !important;
}

.logo-dark-theme {
    display: none !important;
}

[data-theme="dark"] .logo-light-theme {
    display: none !important;
}

[data-theme="dark"] .logo-dark-theme {
    display: block !important;
}

/* Hide text when using image logo */
.logo .logo-text {
    display: none;
}

/* Welcome page logo - centered */
.welcome-logo {
    height: 80px;
    width: auto;
    max-width: 320px;
    object-fit: contain;
    margin-bottom: var(--space-5);
    margin-left: auto;
    margin-right: auto;
}

/* Hide welcome title when using image logo */
.welcome-screen .welcome-title {
    display: none;
}

/* User Info Section */
.user-info {
    display: none;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-hover);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-3);
}

.user-info.visible {
    display: flex;
}

.user-avatar {
    width: 28px;
    height: 28px;
    background: var(--accent);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.username-text {
    flex: 1;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-primary);
}

.logout-btn {
    background: none;
    border: none;
    color: var(--error);
    cursor: pointer;
    padding: var(--space-1);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration-fast);
}

.logout-btn:hover {
    background: rgba(220, 38, 38, 0.1);
}

/* Admin Links */
.admin-links {
    display: none;
    flex-direction: column;
    gap: var(--space-1);
}

.admin-links.visible {
    display: flex;
}


/* ===== MESSAGES ===== */
.message {
    display: flex;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
    animation: messageIn 0.3s var(--ease-out);
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-avatar {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: var(--accent);
    color: var(--text-inverse);
}

.message.assistant .message-avatar {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message.user .message-content {
    background: var(--bg-user-message);
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-xl);
    border-top-right-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.message.assistant .message-content {
    padding: var(--space-4) var(--space-1);
}

.message-text {
    color: var(--text-primary);
    line-height: 1.75;
    font-size: var(--font-size-base);
}

.message-text p {
    margin-bottom: var(--space-3);
}

.message-text p:last-child {
    margin-bottom: 0;
}

.message-text ul,
.message-text ol {
    margin: var(--space-3) 0;
    padding-right: var(--space-6);
}

.message-text li {
    margin-bottom: var(--space-2);
}

.message-text strong {
    font-weight: 600;
    color: var(--accent);
}

/* Source Tags */
.message-sources {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-subtle);
}

.sources-label {
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: var(--space-2);
}

.source-tag {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 500;
    color: var(--text-secondary);
    margin-left: var(--space-2);
    margin-bottom: var(--space-2);
    border: 1px solid var(--border-default);
    transition: all var(--duration-fast);
}

.source-tag:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

/* Clarification Options */
.clarification-options {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border-default);
}

.clarification-option-btn {
    display: inline-flex;
    align-items: center;
    padding: var(--space-2) var(--space-4);
    background: var(--bg-primary);
    border: 1.5px solid var(--accent);
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-family: inherit;
    font-weight: 500;
    color: var(--accent);
    cursor: pointer;
    transition: all var(--duration-fast);
    white-space: nowrap;
}

.clarification-option-btn:hover:not(:disabled) {
    background: var(--accent);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(var(--accent-rgb, 99, 102, 241), 0.3);
}

.clarification-option-btn:active:not(:disabled) {
    transform: translateY(0);
}

.clarification-option-btn:disabled {
    cursor: not-allowed;
}

.clarification-option-btn.selected {
    background: var(--accent) !important;
    color: white !important;
    opacity: 1 !important;
}

/* Streaming Cursor */
.cursor-blink {
    animation: blink 0.7s infinite;
    color: var(--accent);
    font-weight: 600;
}

@keyframes blink {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0;
    }
}

/* Cancel Button */
.cancel-btn {
    position: absolute;
    top: var(--space-2);
    left: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: var(--font-size-xs);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration-fast);
    z-index: 10;
}

.cancel-btn:hover {
    background: var(--error);
    border-color: var(--error);
    color: white;
}

/* Send button in cancel mode - red gradient with stop icon */
.send-btn.cancel-mode {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 50%, #b91c1c 100%);
    border-color: #dc2626;
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.3);
}

.send-btn.cancel-mode:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 50%, #991b1b 100%);
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.4);
    transform: scale(1.05);
}

/* Retry Button */
.retry-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    background: var(--accent);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-family: inherit;
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    margin-top: var(--space-4);
    transition: all var(--duration-fast);
}

.retry-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

/* Error Message */
.error-message {
    text-align: center;
    padding: var(--space-4);
    color: var(--text-secondary);
}

.error-message p {
    margin-bottom: var(--space-2);
}

.error-message p:first-child {
    font-size: var(--font-size-lg);
    color: var(--warning);
}

/* Message content needs relative positioning for cancel button */
.message.assistant .message-content {
    position: relative;
}

/* ===== INPUT AREA - Modern Redesign ===== */
.input-area {
    padding: var(--space-5) 0 var(--space-8);
    flex-shrink: 0;
}

.input-container {
    display: flex;
    gap: var(--space-4);
    align-items: center;
    background: var(--bg-primary);
    border: 2px solid var(--border-default);
    border-radius: 28px;
    padding: var(--space-3) var(--space-4);
    transition: all var(--duration-fast) var(--ease-default);
    box-shadow: var(--shadow-md);
}

.input-container:focus-within {
    border-color: var(--accent);
    box-shadow: var(--shadow-focus), var(--shadow-lg);
    transform: translateY(-1px);
}

.message-input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--font-size-md);
    resize: none;
    max-height: 150px;
    outline: none;
    line-height: 1.6;
    padding: var(--space-2) var(--space-3);
    text-align: right;
    direction: rtl;
}

.message-input::placeholder {
    color: var(--text-muted);
    text-align: right;
}

.send-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border: none;
    border-radius: 50%;
    color: var(--text-inverse);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--duration-fast) var(--ease-default);
    box-shadow: var(--shadow-sm);
}

.send-btn:hover {
    background: linear-gradient(135deg, var(--accent-hover), var(--brand-700));
    box-shadow: var(--shadow-md);
    transform: scale(1.05);
}

.send-btn:active {
    transform: scale(0.95);
}

.send-btn:active {
    transform: scale(0.96);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ===== ADMIN PAGE ===== */
.admin-container {
    max-width: 900px;
    margin: 0 auto;
    padding: var(--space-10) var(--space-6);
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-8);
}

.admin-title {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.back-link {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: var(--font-size-sm);
    font-weight: 500;
    transition: all var(--duration-fast);
}

.back-link:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

/* Stats */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.stat-item {
    background: var(--bg-primary);
    padding: var(--space-6);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-default);
    transition: all var(--duration-fast);
}

.stat-item:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: var(--font-size-sm);
    color: var(--text-tertiary);
    margin-top: var(--space-1);
}

/* Upload Section */
.upload-section,
.documents-section {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
    border: 1px solid var(--border-default);
}

.section-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--space-5);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-primary);
}

.upload-zone {
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius-xl);
    padding: var(--space-12);
    text-align: center;
    cursor: pointer;
    transition: all var(--duration-fast);
    background: var(--bg-secondary);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.upload-icon {
    font-size: 48px;
    margin-bottom: var(--space-4);
    opacity: 0.7;
}

.upload-text {
    font-size: var(--font-size-md);
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
    font-weight: 500;
}

.upload-hint {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

.upload-input {
    display: none;
}

/* Documents List */
.documents-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.document-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    transition: all var(--duration-fast);
}

.document-item:hover {
    border-color: var(--border-default);
    box-shadow: var(--shadow-sm);
}

.document-info {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.document-icon {
    width: 44px;
    height: 44px;
    background: var(--accent-light);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.document-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--font-size-base);
}

.document-meta {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: 2px;
}

.document-delete {
    padding: var(--space-2) var(--space-4);
    background: none;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    font-size: var(--font-size-xs);
    font-weight: 500;
    transition: all var(--duration-fast);
}

.document-delete:hover {
    background: var(--error);
    border-color: var(--error);
    color: white;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--space-12);
    color: var(--text-muted);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: var(--space-6);
    left: var(--space-6);
    z-index: 1000;
    display: flex;
    flex-direction: column-reverse;
    gap: var(--space-2);
}

.toast {
    padding: var(--space-3) var(--space-5);
    background: var(--bg-primary);
    color: var(--text-primary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-default);
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s var(--ease-out);
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.toast.success {
    border-color: var(--success);
    background: rgba(22, 163, 74, 0.1);
    color: var(--success);
}

.toast.error {
    border-color: var(--error);
    background: rgba(220, 38, 38, 0.1);
    color: var(--error);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Loading */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(6px);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-default);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        z-index: 100;
        transform: translateX(100%);
        box-shadow: var(--shadow-lg);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .chat-container {
        padding: 0 var(--space-4);
    }

    .stats-bar {
        grid-template-columns: 1fr;
    }

    .admin-container {
        padding: var(--space-5);
    }
}