/* Modern AI Assistant WebUI - Complete Styling */

/* ===== CSS Variables ===== */
:root[data-theme="dark"] {
    --bg-primary: #0a0e27;
    --bg-secondary: #151933;
    --bg-tertiary: #1e2139;
    --accent-primary: #00d4ff;
    --accent-secondary: #7c3aed;
    --text-primary: #e4e7eb;
    --text-secondary: #9ca3af;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --border: rgba(255, 255, 255, 0.1);
    --shadow: rgba(0, 0, 0, 0.3);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
}

:root[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --accent-primary: #0ea5e9;
    --accent-secondary: #8b5cf6;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --success: #059669;
    --warning: #d97706;
    --error: #dc2626;
    --border: rgba(0, 0, 0, 0.1);
    --shadow: rgba(0, 0, 0, 0.1);
    --glass-bg: rgba(0, 0, 0, 0.02);
    --glass-border: rgba(0, 0, 0, 0.05);
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
}

/* ===== Header ===== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
}

.logo-icon {
    font-size: 24px;
    animation: pulse 2s ease-in-out infinite;
}

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

.ai-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--glass-bg);
    border-radius: 20px;
    font-size: 14px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
    animation: blink 2s ease-in-out infinite;
}

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

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.icon-btn:hover {
    background: var(--glass-bg);
    color: var(--text-primary);
    transform: scale(1.05);
}

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--error);
    color: white;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 10px;
    font-weight: 600;
}

/* ===== System Metrics ===== */
.system-metrics {
    display: flex;
    gap: 20px;
}

.metric {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.metric-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-bar {
    width: 80px;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.metric-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    transition: width 0.3s ease;
}

.metric-value {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
}

.model-selector {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

.model-selector:hover {
    border-color: var(--accent-primary);
}

/* ===== Main Layout ===== */
.main-layout {
    display: flex;
    height: calc(100vh - 60px - 40px);
    margin-top: 60px;
}

/* ===== Sidebar ===== */
.sidebar {
    width: 300px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-nav {
    padding: 20px;
}

.sidebar-section {
    margin-bottom: 30px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.section-header h3 {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.section-badge {
    background: var(--accent-primary);
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.icon-btn-small {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.icon-btn-small:hover {
    background: var(--glass-bg);
    color: var(--accent-primary);
}

/* Chat History */
.chat-search input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    margin-bottom: 10px;
}

.chat-search input:focus {
    border-color: var(--accent-primary);
}

.chat-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-item:hover, .chat-item.active {
    background: var(--glass-bg);
    border: 1px solid var(--accent-primary);
    transform: translateX(5px);
}

.chat-item-icon {
    font-size: 20px;
}

.chat-item-content {
    flex: 1;
}

.chat-item-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.chat-item-preview {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 15px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-action-btn:hover {
    background: var(--glass-bg);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

.action-icon {
    font-size: 24px;
}

.action-label {
    font-size: 12px;
    color: var(--text-primary);
    font-weight: 500;
}

/* Models List */
.models-list, .tools-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.model-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.model-item.active {
    border-color: var(--accent-primary);
    background: var(--glass-bg);
}

.model-icon {
    font-size: 20px;
}

.model-info {
    flex: 1;
}

.model-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.model-stats {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Tools */
.tool-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-primary);
    font-size: 14px;
}

.tool-btn:hover {
    background: var(--glass-bg);
    border-color: var(--accent-primary);
    transform: translateX(5px);
}

/* Settings */
.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
}

.settings-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
}

.settings-btn:hover {
    background: var(--glass-bg);
    border-color: var(--accent-primary);
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    scroll-behavior: smooth;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 60px 20px;
}

.welcome-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: wave 2s ease-in-out infinite;
}

@keyframes wave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(14deg); }
    75% { transform: rotate(-14deg); }
}

.welcome-message h2 {
    font-size: 32px;
    margin-bottom: 10px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-message p {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.suggested-prompts {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    max-width: 600px;
    margin: 0 auto;
}

.prompt-btn {
    padding: 10px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-primary);
    font-size: 14px;
}

.prompt-btn:hover {
    background: var(--glass-bg);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

/* Scroll to Bottom Button */
.scroll-bottom-btn {
    position: absolute;
    bottom: 200px;
    right: 30px;
    width: 40px;
    height: 40px;
    background: var(--accent-primary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.2s;
}

.scroll-bottom-btn:hover {
    transform: scale(1.1);
}

/* ===== Input Area ===== */
.input-area {
    padding: 20px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
}

.input-area.drag-over {
    border-top: 2px dashed var(--accent-primary);
    background: rgba(99, 102, 241, 0.05);
}

/* Attachment Preview Area */
.attachment-preview-area {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 4px;
    margin-bottom: 8px;
}

.attachment-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px 8px;
    max-width: 200px;
}

.attachment-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}

.attachment-icon {
    font-size: 20px;
}

.attachment-label {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attachment-remove {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    padding: 0 2px;
    line-height: 1;
    opacity: 0.6;
}
.attachment-remove:hover {
    opacity: 1;
    color: #ef4444;
}

.input-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.toolbar-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.toolbar-btn:hover {
    background: var(--glass-bg);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}
/* Wake word / voice active state — green glow */
.toolbar-btn.active,
#voice-input.active {
    background: rgba(16, 185, 129, 0.15);
    border-color: #10b981;
    color: #10b981;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.4), 0 0 24px rgba(16, 185, 129, 0.15);
    animation: voice-pulse 2s ease-in-out infinite;
}

@keyframes voice-pulse {
    0%, 100% { box-shadow: 0 0 12px rgba(16, 185, 129, 0.4), 0 0 24px rgba(16, 185, 129, 0.15); }
    50% { box-shadow: 0 0 18px rgba(16, 185, 129, 0.6), 0 0 36px rgba(16, 185, 129, 0.25); }
}

#dictation-input.active {
    background: rgba(59, 130, 246, 0.15);
    border-color: #3b82f6;
    color: #3b82f6;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
    animation: dictation-pulse 2s ease-in-out infinite;
}

@keyframes dictation-pulse {
    0%, 100% { box-shadow: 0 0 12px rgba(59, 130, 246, 0.4); }
    50% { box-shadow: 0 0 18px rgba(59, 130, 246, 0.6); }
}


.token-counter {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-secondary);
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.message-input {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    resize: none;
    max-height: 200px;
    outline: none;
    transition: all 0.2s;
}

.message-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.send-btn {
    width: 48px;
    height: 48px;
    background: var(--accent-primary);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.2s;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
}

.send-btn:active {
    transform: scale(0.95);
}

.input-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
}

.input-hint kbd {
    padding: 2px 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: monospace;
    font-size: 11px;
}

/* ===== Status Bar ===== */
.status-bar {
    height: 40px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    font-size: 12px;
}

.status-left, .status-center, .status-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
}

.status-label {
    font-weight: 500;
}

.status-value {
    color: var(--text-primary);
}

/* ===== Loading Overlay ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    margin-top: 20px;
    font-size: 16px;
    color: var(--text-primary);
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 60px;
        left: 0;
        bottom: 0;
        z-index: 999;
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .system-metrics {
        display: none;
    }
    
    .header-center {
        display: none;
    }
}

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* ===== Message Enhancements ===== */
.message {
    padding: 15px 20px;
    margin-bottom: 15px;
    border-radius: 12px;
    max-width: 80%;
    animation: fadeIn 0.3s ease;
}

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

.message.user {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.message.assistant {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    margin-right: auto;
}

.message.system {
    background: var(--bg-tertiary);
    border: 1px solid var(--warning);
    margin: 0 auto;
    text-align: center;
    max-width: 60%;
}

.message.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    color: var(--error);
}

.message-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 12px;
}

.message-sender {
    font-weight: 600;
    color: var(--text-secondary);
}

.message-time {
    color: var(--text-secondary);
    opacity: 0.7;
}

.message-intent {
    padding: 2px 8px;
    background: var(--accent-primary);
    color: white;
    border-radius: 10px;
    font-size: 11px;
}

.message-content {
    line-height: 1.6;
    word-wrap: break-word;
}

.message-content code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
}

.message-content pre {
    background: var(--bg-tertiary);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 10px 0;
}

.message-content pre code {
    background: transparent;
    padding: 0;
}

.message-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    opacity: 0;
    transition: opacity 0.2s;
}

.message:hover .message-actions {
    opacity: 1;
}

.action-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
}

.action-btn:hover {
    background: var(--glass-bg);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* Thinking Indicator */
.thinking-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.thinking-indicator span {
    width: 8px;
    height: 8px;
    background: var(--accent-primary);
    border-radius: 50%;
    animation: thinking 1.4s ease-in-out infinite;
}

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

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

@keyframes thinking {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.thinking-text {
    width: auto !important;
    height: auto !important;
    background: transparent !important;
    border-radius: 0 !important;
    animation: none !important;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Background Process Panel */
.background-panel {
    position: fixed;
    right: 20px;
    top: 80px;
    width: 400px;
    max-height: calc(100vh - 200px);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 32px var(--shadow);
    z-index: 998;
    overflow: hidden;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.background-panel.minimized {
    height: 50px;
    overflow: hidden;
}

.background-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: var(--glass-bg);
    border-bottom: 1px solid var(--border);
}

.background-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.close-btn:hover {
    background: var(--glass-bg);
    color: var(--error);
}

.background-content {
    padding: 20px;
    max-height: calc(100vh - 250px);
    overflow-y: auto;
}

.process-section {
    margin-bottom: 25px;
}

.process-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.process-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.process-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border);
    opacity: 0;
    transform: translateX(-20px);
    transition: all 0.3s ease;
}

.process-step.active {
    opacity: 1;
    transform: translateX(0);
}

.step-icon {
    width: 20px;
    height: 20px;
    background: var(--success);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

.step-text {
    flex: 1;
    font-size: 13px;
    color: var(--text-primary);
}

.step-time {
    font-size: 11px;
    color: var(--text-secondary);
}

/* ═══ AGI Enhancement Modals ═══ */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
    animation: modalFadeIn 0.2s ease-out;
}
@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.modal-content {
    background: #111827;
    color: #e0e0e0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.25s ease-out;
}
@keyframes modalSlideIn {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.modal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}
.modal-close {
    background: transparent;
    border: none;
    color: #999;
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.15s;
}
.modal-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}
.modal-body {
    padding: 20px;
}
/* Stats cards grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.stat-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
}
.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #818cf8;
    margin-bottom: 4px;
}
.stat-card .stat-label {
    font-size: 12px;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
/* Section styling within modals */
.modal-section {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
}
.modal-section h3 {
    margin: 0 0 12px 0;
    font-size: 15px;
    color: #d1d5db;
}
/* Loading spinner for modals */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(129, 140, 248, 0.2);
    border-top-color: #818cf8;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
