/**
 * Professional White Dashboard Theme CSS
 * Modern, clean, sophisticated design inspired by premium dashboards
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    /* Modern Color Palette - Dark Calm Blue */
    --primary: #1E40AF;
    --primary-dark: #1E3A8A;
    --primary-light: #3B82F6;
    --secondary: #2563EB;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #0EA5E9;
    
    /* Neutral Grays */
    --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;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #F0F4F8 0%, #E2E8F0 50%, #F8FAFC 100%);
    background-attachment: fixed;
    background-size: 100% 100%;
    color: var(--gray-900);
    line-height: 1.6;
    font-size: 15px;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.01em;
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px;
    min-height: 100vh;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding: 28px 36px;
    background: linear-gradient(135deg, #FFFFFF 0%, #F8FAFC 50%, #FFFFFF 100%);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 20px rgba(30, 64, 175, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(30, 64, 175, 0.1);
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(30, 64, 175, 0.05), transparent);
    transition: left 0.6s;
}

.header:hover::before {
    left: 100%;
}

.header:hover {
    box-shadow: 0 8px 30px rgba(30, 64, 175, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
    border-color: rgba(30, 64, 175, 0.2);
}

.header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.02em;
    margin: 0;
    position: relative;
}

.header h1::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 2px;
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    background: linear-gradient(135deg, #FFFFFF 0%, #F9FAFB 100%);
    color: var(--primary);
    text-decoration: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    letter-spacing: -0.01em;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    background: linear-gradient(135deg, #FFFFFF 0%, #F3F4F6 100%);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    border-color: var(--gray-300);
}

.btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #FFFFFF;
    border: none;
    box-shadow: 0 4px 14px rgba(30, 64, 175, 0.3), 0 2px 4px rgba(30, 64, 175, 0.2);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    box-shadow: 0 6px 20px rgba(30, 64, 175, 0.4), 0 4px 8px rgba(30, 64, 175, 0.3);
    transform: translateY(-2px);
}

.btn-secondary {
    background: linear-gradient(135deg, #FFFFFF 0%, #F9FAFB 100%);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #F9FAFB 0%, #F3F4F6 100%);
    color: var(--gray-900);
    border-color: var(--gray-400);
}

.btn-danger {
    background: linear-gradient(135deg, #FFFFFF 0%, #FEF2F2 100%);
    color: var(--danger);
    border: 1px solid #FEE2E2;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #FEF2F2 0%, #FEE2E2 100%);
    color: #DC2626;
    border-color: #FECACA;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-info {
    background-color: #FFFFFF;
    color: #333333;
    border-color: #E0E0E0;
}

/* Content Box */
.content-box {
    background: linear-gradient(135deg, #FFFFFF 0%, #FAFBFC 50%, #FFFFFF 100%);
    border: 1px solid rgba(30, 64, 175, 0.08);
    border-radius: var(--radius-md);
    padding: 36px;
    margin-bottom: 28px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.content-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 50%, var(--primary) 100%);
    background-size: 200% 100%;
    opacity: 0;
    transition: all 0.4s ease;
    animation: shimmer 3s infinite;
}

.content-box:hover {
    box-shadow: 0 8px 30px rgba(30, 64, 175, 0.1), 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-3px);
    border-color: rgba(30, 64, 175, 0.2);
}

.content-box:hover::before {
    opacity: 1;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.content-box h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--gray-900);
    letter-spacing: -0.02em;
}

/* Forms */
.form {
    max-width: 800px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #333333;
    font-size: 14px;
}

.form-group .required {
    color: #CC0000;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    background: linear-gradient(135deg, #FFFFFF 0%, #FAFBFC 100%);
    color: var(--gray-900);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1), inset 0 1px 2px rgba(0, 0, 0, 0.02);
    background: #FFFFFF;
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: #666666;
    font-size: 12px;
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: radial-gradient(circle at center, #FFFFFF 0%, #F0F9FF 30%, #e8f2ff 60%, #cfe3ff 100%);
    background-attachment: fixed;
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(30, 64, 175, 0.05) 0%, transparent 70%);
    animation: pulse 8s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.login-box {
    background: linear-gradient(135deg, #FFFFFF 0%, #FAFBFC 100%);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(10px);
}

.login-box h1 {
    text-align: center;
    margin-bottom: 32px;
    font-size: 24px;
    font-weight: 400;
    color: #202124;
}

.login-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 32px;
    border-bottom: 1px solid #DADCE0;
}

.tab-button {
    flex: 1;
    padding: 12px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 14px;
    color: #5F6368;
    transition: all 0.2s ease;
    font-weight: 500;
}

.tab-button:hover {
    color: #1A73E8;
    background-color: #F8F9FA;
}

.tab-button.active {
    color: #1A73E8;
    border-bottom-color: #1A73E8;
    font-weight: 500;
}

/* Messages */
.error-message {
    background: linear-gradient(135deg, #FEF2F2 0%, #FEE2E2 100%);
    border: 1px solid #FECACA;
    color: var(--danger);
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--danger);
}

.success-message {
    background: linear-gradient(135deg, #ECFDF5 0%, #D1FAE5 100%);
    border: 1px solid #A7F3D0;
    color: var(--success);
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--success);
}

.info-banner {
    background-color: #F5F5F5;
    border: 1px solid #E0E0E0;
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 14px;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 20px;
    background: #FFFFFF;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.data-table thead {
    background: linear-gradient(135deg, var(--gray-50) 0%, #FFFFFF 100%);
    border-bottom: 2px solid var(--gray-200);
}

.data-table th {
    padding: 16px 20px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.data-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 14px;
    color: var(--gray-900);
    transition: background-color 0.2s ease;
}

.data-table tbody tr {
    transition: all 0.2s ease;
}

.data-table tbody tr:hover {
    background: linear-gradient(135deg, #F9FAFB 0%, #FFFFFF 100%);
    transform: scale(1.01);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table .actions {
    white-space: nowrap;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.info-item {
    padding: 20px;
    background: linear-gradient(135deg, #FFFFFF 0%, #F9FAFB 100%);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.info-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--gray-300);
}

.info-item label {
    display: block;
    font-size: 11px;
    color: var(--gray-500);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
}

.info-item div {
    font-size: 15px;
    color: var(--gray-900);
    font-weight: 500;
    line-height: 1.5;
}

.info-item.full-width {
    grid-column: 1 / -1;
}

.prompt-display {
    white-space: pre-wrap;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 13px;
    background: linear-gradient(135deg, #F9FAFB 0%, #F3F4F6 100%);
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    color: var(--gray-800);
    line-height: 1.7;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.token-display {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 12px;
    background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid #BFDBFE;
    color: var(--primary);
    font-weight: 500;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
}

code {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 13px;
    background: linear-gradient(135deg, #F3F4F6 0%, #E5E7EB 100%);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    color: var(--primary);
    font-weight: 500;
    border: 1px solid var(--gray-200);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Vector DB Layout */
.vectordb-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 20px;
}

.vectordb-main {
    min-width: 0;
}

.action-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.form-box {
    background-color: #F9F9F9;
    border: 1px solid #E0E0E0;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
}

.form-box h3 {
    margin-bottom: 16px;
    font-size: 16px;
}

.documents-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.document-item {
    background-color: #FFFFFF;
    border: 1px solid #E0E0E0;
    border-radius: 4px;
    padding: 16px;
    transition: box-shadow 0.2s ease;
}

.document-item:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.document-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.document-content {
    color: #666666;
    font-size: 13px;
    margin-bottom: 8px;
    line-height: 1.5;
}

.document-metadata {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #E0E0E0;
}

.document-metadata small {
    color: #999999;
    font-size: 11px;
}

.document-actions {
    display: flex;
    gap: 6px;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #999999;
}

.upload-result {
    margin-top: 12px;
    padding: 12px;
    border-radius: 4px;
}

.upload-result .success {
    background-color: #E8F5E9;
    color: #2E7D32;
}

.upload-result .error {
    background-color: #FFEBEE;
    color: #CC0000;
}

/* Chat Sidebar */
.chat-sidebar {
    position: sticky;
    top: 20px;
    height: fit-content;
    max-height: calc(100vh - 40px);
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 600px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background-color: #F9F9F9;
    border: 1px solid #E0E0E0;
    border-radius: 4px;
    margin-bottom: 12px;
    min-height: 400px;
}

.chat-message {
    margin-bottom: 12px;
    padding: 10px;
    background-color: #FFFFFF;
    border: 1px solid #E0E0E0;
    border-radius: 4px;
}

.chat-message.user {
    background-color: #F5F5F5;
}

.chat-message .message-header {
    font-size: 11px;
    color: #999999;
    margin-bottom: 4px;
}

.chat-message .message-content {
    font-size: 13px;
    color: #333333;
}

.chat-form {
    display: flex;
    gap: 8px;
}

.chat-form .form-input {
    flex: 1;
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metric-card {
    background: linear-gradient(135deg, #FFFFFF 0%, #FAFBFC 100%);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 28px;
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.metric-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
    border-color: var(--gray-300);
}

.metric-card:hover::before {
    transform: scaleX(1);
}

.metric-card h3 {
    font-size: 12px;
    color: #5F6368;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.metric-value {
    font-size: 36px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

/* Logs */
.logs-container {
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid #E0E0E0;
    border-radius: 4px;
    background-color: #F9F9F9;
}

.log-entry {
    padding: 10px 12px;
    border-bottom: 1px solid #E0E0E0;
    font-size: 12px;
    font-family: 'Courier New', monospace;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-time {
    color: #999999;
    margin-bottom: 4px;
}

.log-message {
    color: #333333;
}

.info-text {
    color: #666666;
    font-style: italic;
}

/* Responsive */
@media (max-width: 1024px) {
    .vectordb-layout {
        grid-template-columns: 1fr;
    }
    
    .chat-sidebar {
        position: static;
        max-height: none;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 12px;
    }
    
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .header-actions {
        width: 100%;
        flex-direction: column;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .client-menu-bar {
        flex-direction: column;
    }
    
    .client-menu-bar .btn {
        width: 100%;
    }
}

/* Client Menu Bar */
.client-menu-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    /* Add comfortable vertical spacing so buttons don't stick to content */
    margin-top: 16px;
    margin-bottom: 24px;
    padding-top: 4px;
    padding-bottom: 4px;
}

/* Client Info Header */
.client-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 20px 28px;
    background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.client-info-header::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(30, 64, 175, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.client-info-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    color: var(--gray-900);
    letter-spacing: -0.02em;
    position: relative;
    z-index: 1;
}

.client-info-header .client-name {
    color: var(--primary);
    font-weight: 700;
}

.client-info-header .client-id {
    color: var(--gray-600);
    font-size: 15px;
    font-weight: 500;
    margin-left: 12px;
}
