/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-app: #08090e;
    --bg-sidebar: #0f1118;
    --bg-card: #151923;
    --bg-card-hover: #1b212f;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(0, 242, 254, 0.15);
    
    --text-primary: #f0f2f5;
    --text-secondary: #9aa2b1;
    --text-muted: #646d7c;
    
    --accent-blue: #00f2fe;
    --accent-purple: #8c52ff;
    --accent-grad: linear-gradient(135deg, #00f2fe, #4facfe, #8c52ff);
    
    --system-green: #00e676;
    --system-red: #ff3d00;
    --system-orange: #ff9100;
    
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    --shadow-glow: 0 0 20px rgba(0, 242, 254, 0.1);
}

body {
    background-color: var(--bg-app);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    overflow: hidden;
    height: 100vh;
}

/* App Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar Styling */
.sidebar {
    width: 320px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    padding: 24px;
    z-index: 10;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
}

.logo-icon {
    width: 44px;
    height: 44px;
    background: var(--accent-grad);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
    box-shadow: 0 4px 15px rgba(0, 242, 254, 0.3);
}

.logo-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

.logo-title h2 {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: #fff;
    line-height: 1.1;
}

.logo-title span {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Sidebar Panels */
.panel {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.panel:hover {
    border-color: rgba(0, 242, 254, 0.25);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), var(--shadow-glow);
}

.panel h3 {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel h3 i {
    background: var(--accent-grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Status Indicator */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid rgba(255, 255, 255, 0.02);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-muted);
}

.pulse-dot.active {
    background-color: var(--system-green);
    box-shadow: 0 0 8px var(--system-green);
    animation: pulse 2s infinite;
}

.pulse-dot.indexing {
    background-color: var(--system-orange);
    box-shadow: 0 0 8px var(--system-orange);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.8; }
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    font-size: 12px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
}

.stat-label {
    color: var(--text-secondary);
}

.stat-val {
    color: #fff;
    font-weight: 600;
}

/* File Upload Zone */
.drag-drop-zone {
    border: 2px dashed rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 20px 10px;
    text-align: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.01);
    transition: background 0.2s ease, border-color 0.2s ease;
}

.drag-drop-zone:hover, .drag-drop-zone.dragover {
    background: rgba(0, 242, 254, 0.03);
    border-color: var(--accent-blue);
}

.drag-drop-zone i {
    font-size: 28px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    transition: transform 0.2s ease, color 0.2s ease;
}

.drag-drop-zone:hover i {
    color: var(--accent-blue);
    transform: translateY(-2px);
}

.drag-drop-zone p {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Progress indicator */
.upload-progress-container {
    margin-top: 12px;
}

.progress-bar-bg {
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.progress-bar-fill {
    width: 0%;
    height: 100%;
    background: var(--accent-grad);
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 11px;
    color: var(--text-secondary);
    display: block;
    text-align: center;
}

/* Indexed Documents list */
.doc-list-container {
    max-height: 200px;
    overflow-y: auto;
}

.doc-list {
    list-style: none;
}

.doc-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 12px;
    border: 1px solid var(--border-color);
    transition: background 0.2s ease;
}

.doc-list li:hover {
    background: rgba(255, 255, 255, 0.05);
}

.doc-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.doc-name {
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    max-width: 140px;
}

.doc-name i {
    color: var(--accent-blue);
}

.doc-chunks {
    background: rgba(0, 242, 254, 0.1);
    color: var(--accent-blue);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

.empty-list {
    text-align: center;
    color: var(--text-muted) !important;
    background: none !important;
    border: none !important;
    font-style: italic;
    padding: 12px 0 !important;
}

/* Sidebar buttons */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 12px;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.btn-block {
    width: 100%;
}

.btn-danger {
    background: rgba(255, 61, 0, 0.1);
    color: var(--system-red);
    border: 1px solid rgba(255, 61, 0, 0.2);
}

.btn-danger:hover {
    background: var(--system-red);
    color: #fff;
    box-shadow: 0 4px 15px rgba(255, 61, 0, 0.3);
}

.sidebar-footer {
    margin-top: auto;
}

/* Main Chat Area Styling */
.chat-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: linear-gradient(180deg, #0a0c13 0%, #06070a 100%);
    position: relative;
}

.chat-header {
    height: 80px;
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    background: rgba(8, 9, 14, 0.5);
    backdrop-filter: blur(10px);
}

.header-info h1 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.header-info p {
    font-size: 12px;
    color: var(--text-secondary);
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

/* Messages container */
.messages-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Welcome Banner */
.welcome-banner {
    max-width: 600px;
    margin: 60px auto auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fadeIn 0.8s ease;
}

.banner-icon {
    width: 80px;
    height: 80px;
    background: var(--accent-grad);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: #fff;
    box-shadow: 0 8px 30px rgba(0, 242, 254, 0.25);
    margin-bottom: 24px;
}

.welcome-banner h2 {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 12px;
}

.welcome-banner p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 30px;
}

.quick-tips {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.tip-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.tip-card:hover {
    border-color: var(--accent-blue);
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.tip-card i {
    color: var(--accent-blue);
}

/* Chat Messages */
.message {
    display: flex;
    gap: 16px;
    max-width: 80%;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
}

@keyframes slideUp {
    0% { transform: translateY(12px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

.message-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-bot {
    align-self: flex-start;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #fff;
    flex-shrink: 0;
}

.message-user .message-avatar {
    background: linear-gradient(135deg, #a855f7, #6366f1);
}

.message-bot .message-avatar {
    background: var(--accent-grad);
    box-shadow: 0 2px 10px rgba(0, 242, 254, 0.2);
}

.message-content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.message-bubble {
    padding: 12px 18px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.message-user .message-bubble {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.25);
    color: var(--text-primary);
    border-top-right-radius: 4px;
}

.message-bot .message-bubble {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-top-left-radius: 4px;
}

/* Markdown response styling */
.message-bubble p {
    margin-bottom: 8px;
}

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

.message-bubble ul, .message-bubble ol {
    margin: 8px 0 8px 20px;
}

.message-bubble li {
    margin-bottom: 4px;
}

.message-bubble strong {
    color: #fff;
}

/* User attached images in chat bubble */
.message-image {
    max-width: 100%;
    max-height: 200px;
    border-radius: 10px;
    margin-top: 8px;
    border: 1px solid var(--border-color);
    object-fit: cover;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.message-image:hover {
    opacity: 0.9;
}

/* Sources cited cards */
.sources-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sources-header {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.sources-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.source-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 11px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.source-badge:hover {
    background: rgba(0, 242, 254, 0.05);
    border-color: rgba(0, 242, 254, 0.3);
    color: var(--accent-blue);
}

.source-badge i {
    color: var(--accent-blue);
    font-size: 10px;
}

.source-similarity {
    font-size: 9px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Typing / Loading Indicator Bubble */
.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 8px 12px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--text-secondary);
    animation: typing 1.4s infinite ease-in-out both;
}

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

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

/* Image preview section before sending */
.image-preview-container {
    padding: 0 40px;
    margin-top: -12px;
    margin-bottom: 12px;
    display: flex;
}

.preview-wrapper {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 12px;
    border: 1px solid var(--accent-blue);
    box-shadow: var(--shadow-glow);
    overflow: hidden;
}

.preview-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.btn-remove-preview {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: #fff;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-remove-preview:hover {
    background: var(--system-red);
}

/* Chat Input Footer Controls */
.chat-footer {
    padding: 0 40px 30px;
    background: transparent;
}

.input-form {
    max-width: 800px;
    margin: 0 auto;
}

.input-wrapper {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-wrapper:focus-within {
    border-color: rgba(0, 242, 254, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), var(--shadow-glow);
}

.btn-input-attach {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
    padding: 4px;
}

.btn-input-attach:hover {
    color: var(--accent-blue);
    transform: scale(1.05);
}

.chat-input {
    flex-grow: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    resize: none;
    outline: none;
    max-height: 150px;
    padding: 8px 0;
    line-height: 1.5;
}

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

.btn-input-send {
    background: var(--accent-grad);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s ease;
    box-shadow: 0 2px 10px rgba(0, 242, 254, 0.2);
}

.btn-input-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 242, 254, 0.4);
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Chat Sessions Sidebar Panel */
.chat-sessions-panel {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    max-height: 280px;
    margin-bottom: 20px;
}

.sessions-list-container {
    flex-grow: 1;
    overflow-y: auto;
    margin-top: 10px;
    padding-right: 2px;
}

.sessions-list {
    list-style: none;
}

.sessions-list li {
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 12px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.sessions-list li:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.15);
}

.sessions-list li.active {
    background: rgba(0, 242, 254, 0.05);
    border-color: rgba(0, 242, 254, 0.35);
    box-shadow: var(--shadow-glow);
    color: #fff;
    font-weight: 500;
}

.session-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.session-title i {
    color: var(--accent-blue);
    font-size: 11px;
}

.btn-delete-session {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    position: relative;
    z-index: 10;
}

.btn-delete-session i {
    pointer-events: none;
}

.btn-delete-session:hover {
    color: var(--system-red);
}

/* Token Usage Muted Card */
.token-usage-card {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
    align-self: flex-start;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.token-usage-card i {
    font-size: 9px;
    color: var(--accent-purple);
}

/* Drag-and-drop active visual cue on Chat Area */
.chat-area.dragover-active {
    outline: 2px dashed rgba(0, 242, 254, 0.4);
    outline-offset: -4px;
    background: linear-gradient(180deg, rgba(0, 242, 254, 0.02) 0%, #06070a 100%);
}

/* User Profile Card */
.user-profile {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
}

.user-info i {
    color: var(--accent-blue);
    font-size: 16px;
}

.user-actions {
    display: flex;
    gap: 6px;
}

.btn-user-action {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.btn-user-action:hover {
    color: var(--accent-blue);
    background: rgba(255, 255, 255, 0.05);
}

.btn-user-action.btn-logout:hover {
    color: var(--system-red);
}

/* Login Overlay */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(8, 9, 14, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), var(--shadow-glow);
    text-align: center;
}

.login-logo img {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 242, 254, 0.3);
}

.login-card h2 {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
}

.login-card p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.form-group {
    text-align: left;
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group select,
.form-group input {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 10px 14px;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 14px;
    transition: all 0.2s ease;
}

.form-group select:focus,
.form-group input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: var(--shadow-glow);
    background: rgba(255, 255, 255, 0.05);
}

.form-group select option {
    background: var(--bg-card);
    color: #fff;
}

.login-error {
    color: var(--system-red);
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 16px;
    text-align: left;
}

/* Modals General */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.4), var(--shadow-glow);
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 14px;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 600;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h2 i {
    color: var(--accent-blue);
}

.btn-close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.btn-close-modal:hover {
    color: #fff;
}

/* Stats KPIs */
.stats-kpis {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.kpi-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.kpi-val {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 700;
    color: var(--accent-blue);
    background: var(--accent-grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.kpi-label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Stats Charts */
.stats-charts h3 {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 14px;
}

.chart-container {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    height: 180px;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    position: relative;
}

.empty-chart {
    font-size: 12px;
    color: var(--text-muted);
    width: 100%;
    text-align: center;
    margin-bottom: auto;
    margin-top: auto;
}

.bar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    height: 100%;
    justify-content: flex-end;
    width: 40px;
}

.bar-fill {
    background: var(--accent-grad);
    width: 12px;
    border-radius: 4px 4px 0 0;
    min-height: 2px;
    box-shadow: 0 4px 10px rgba(0, 242, 254, 0.2);
    transition: height 0.5s ease-out;
}

.bar-count {
    font-size: 10px;
    font-weight: 600;
    color: var(--accent-blue);
}

.bar-label {
    font-size: 9px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Toast Notification */
.toast-notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-card);
    border: 1px solid var(--accent-blue);
    box-shadow: var(--shadow-glow);
    border-radius: 10px;
    padding: 12px 20px;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 10000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast-notification.show {
    transform: translateY(0);
    opacity: 1;
}

.toast-notification i {
    color: var(--system-green);
    font-size: 16px;
}

/* Document delete actions in sidebar */
.doc-meta-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-delete-doc {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.btn-delete-doc:hover {
    color: var(--system-red);
    background: rgba(255, 255, 255, 0.05);
}

/* Test Simulator Styles */

/* Test Size Selector (Segmented Radio) */
.test-size-selector {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2px;
    gap: 2px;
}

.test-size-selector input[type="radio"] {
    display: none;
}

.test-size-selector label {
    flex: 1;
    text-align: center;
    padding: 8px 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    margin: 0;
}

.test-size-selector input[type="radio"]:checked + label {
    background: var(--accent-grad);
    color: #fff;
    box-shadow: var(--shadow-glow);
}

/* Subject Progress Items in Sidebar Stats */
.subject-progress-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 4px;
}

.subject-progress-item {
    display: flex;
    flex-direction: column;
}

.progress-bar-fill.green {
    background: var(--system-green);
    box-shadow: 0 0 8px rgba(0, 230, 115, 0.4);
}

.progress-bar-fill.yellow {
    background: var(--accent-orange);
    box-shadow: 0 0 8px rgba(255, 122, 0, 0.4);
}

.progress-bar-fill.red {
    background: var(--system-red);
    box-shadow: 0 0 8px rgba(255, 75, 75, 0.4);
}

/* Question Active Screen */
.test-question-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 28px;
    margin: 20px auto;
    max-width: 800px;
    box-shadow: var(--shadow-glow);
}

.test-progress-bar {
    margin-bottom: 24px;
}

.progress-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 6px;
    display: block;
}

.progress-bar-bg {
    background: rgba(255, 255, 255, 0.05);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    background: var(--accent-grad);
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.question-box {
    margin-bottom: 24px;
    position: relative;
}

.question-subject-badge {
    background: rgba(140, 82, 255, 0.15);
    color: var(--accent-purple);
    border: 1px solid rgba(140, 82, 255, 0.3);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
    margin-bottom: 12px;
}

.question-text {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.5;
    color: #fff;
}

/* Option Buttons list */
.options-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.option-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px 18px;
    text-align: left;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.option-btn:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
    transform: translateX(4px);
}

.option-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Active option states */
.option-btn.correct {
    background: rgba(0, 230, 115, 0.08);
    border-color: var(--system-green);
    color: #fff;
    box-shadow: 0 0 15px rgba(0, 230, 115, 0.15);
}

.option-btn.correct .option-num {
    background: var(--system-green);
    color: #fff;
}

.option-btn.incorrect {
    background: rgba(255, 75, 75, 0.08);
    border-color: var(--system-red);
    color: #fff;
    box-shadow: 0 0 15px rgba(255, 75, 75, 0.15);
}

.option-btn.incorrect .option-num {
    background: var(--system-red);
    color: #fff;
}

/* Explanation Panel */
.explanation-card {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-top: 24px;
    border-left: 4px solid var(--accent-blue);
    animation: fadeIn 0.4s ease-out;
}

.explanation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.explanation-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-blue);
}

.explanation-source {
    font-size: 11px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
    padding: 2px 8px;
    border-radius: 4px;
}

.explanation-text {
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-secondary);
}

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

.loading-pulse {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
}
