/* 
 * Mithunam AI Chat Application
 * Modern Design System with Glassmorphism
 */

/* ============================================
   CSS Custom Properties (Design Tokens)
   ============================================ */
:root {
    /* Colors - Dark Theme */
    --color-bg-primary: #0a0a0f;
    --color-bg-secondary: #12121a;
    --color-bg-tertiary: #1a1a25;
    --color-bg-glass: rgba(255, 255, 255, 0.03);
    --color-bg-glass-hover: rgba(255, 255, 255, 0.06);

    /* Accent Colors */
    --color-accent-primary: #7c3aed;
    --color-accent-secondary: #06b6d4;
    --color-accent-gradient: linear-gradient(135deg, #7c3aed 0%, #06b6d4 100%);
    --color-accent-glow: rgba(124, 58, 237, 0.4);

    /* Text Colors */
    --color-text-primary: #f8fafc;
    --color-text-secondary: #94a3b8;
    --color-text-muted: #64748b;

    /* Status Colors */
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-error: #ef4444;
    --color-info: #3b82f6;

    /* Border */
    --color-border: rgba(255, 255, 255, 0.08);
    --color-border-light: rgba(255, 255, 255, 0.12);

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
    --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.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 40px var(--color-accent-glow);

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'Fira Code', 'Consolas', monospace;

    /* Sizing */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Z-Index Scale */
    --z-dropdown: 100;
    --z-modal: 200;
    --z-toast: 300;
}

/* Light theme */
[data-theme="light"] {
    --color-bg-primary: #f8fafc;
    --color-bg-secondary: #ffffff;
    --color-bg-tertiary: #f1f5f9;
    --color-bg-glass: rgba(255, 255, 255, 0.7);
    --color-bg-glass-hover: rgba(255, 255, 255, 0.9);
    --color-text-primary: #0f172a;
    --color-text-secondary: #475569;
    --color-text-muted: #94a3b8;
    --color-border: rgba(0, 0, 0, 0.08);
    --color-border-light: rgba(0, 0, 0, 0.12);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(124, 58, 237, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(6, 182, 212, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(124, 58, 237, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
    animation: bgPulse 15s ease-in-out infinite alternate;
}

@keyframes bgPulse {
    0% {
        opacity: 1;
        transform: scale(1);
    }

    100% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

/* ============================================
   Typography
   ============================================ */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--color-text-primary);
}

h1 {
    font-size: 2.5rem;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 2rem;
    letter-spacing: -0.015em;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
}

p {
    color: var(--color-text-secondary);
}

a {
    color: var(--color-accent-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-accent-secondary);
}

/* ============================================
   Glass Card Component
   ============================================ */
.glass-card {
    background: var(--color-bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: all var(--transition-normal);
}

.glass-card:hover {
    background: var(--color-bg-glass-hover);
    border-color: var(--color-border-light);
    box-shadow: var(--shadow-lg);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    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.2), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: var(--color-accent-gradient);
    color: white;
    box-shadow: var(--shadow-md), 0 0 20px rgba(124, 58, 237, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 30px rgba(124, 58, 237, 0.4);
}

.btn-secondary {
    background: var(--color-bg-glass);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    backdrop-filter: blur(10px);
}

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

.btn-ghost {
    background: transparent;
    color: var(--color-text-secondary);
}

.btn-ghost:hover {
    color: var(--color-text-primary);
    background: var(--color-bg-glass);
}

.btn-icon {
    padding: 0.625rem;
    border-radius: var(--radius-md);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ============================================
   Form Elements
   ============================================ */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
}

.form-input {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    color: var(--color-text-primary);
    background: var(--color-bg-glass);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
    backdrop-filter: blur(10px);
}

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

.form-input:focus {
    outline: none;
    border-color: var(--color-accent-primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

.form-input:invalid:not(:placeholder-shown) {
    border-color: var(--color-error);
}

/* ============================================
   App Layout
   ============================================ */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--color-bg-secondary);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-normal);
}

.sidebar-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.25rem;
    background: var(--color-accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--color-accent-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.sidebar-section {
    margin-bottom: 1.5rem;
}

.sidebar-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    padding: 0.5rem 0.75rem;
}

/* Conversation List */
.conversation-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.conversation-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--color-text-secondary);
}

.conversation-item:hover {
    background: var(--color-bg-glass);
    color: var(--color-text-primary);
}

.conversation-item.active {
    background: var(--color-accent-gradient);
    color: white;
}

.conversation-item-icon {
    width: 36px;
    height: 36px;
    background: var(--color-bg-glass);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.conversation-item.active .conversation-item-icon {
    background: rgba(255, 255, 255, 0.2);
}

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

.conversation-item-title {
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-item-time {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* New Chat Button */
.new-chat-btn {
    width: 100%;
    margin-bottom: 1rem;
    background: var(--color-bg-glass);
    border: 1px dashed var(--color-border);
}

.new-chat-btn:hover {
    border-color: var(--color-accent-primary);
    border-style: solid;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--color-border);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.user-profile:hover {
    background: var(--color-bg-glass);
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--color-accent-gradient);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-primary);
}

.user-email {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* User Dropdown Menu - opens upward */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    bottom: 100%;
    top: auto !important;
    /* Force upward opening */
    left: 0;
    right: 0;
    margin-bottom: 0.5rem;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all var(--transition-fast);
    z-index: var(--z-dropdown);
}

.dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--color-bg-glass);
    color: var(--color-text-primary);
}

.dropdown-item.danger {
    color: var(--color-error);
}

.dropdown-item.danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

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

/* Header */
.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--color-bg-glass);
    border-bottom: 1px solid var(--color-border);
    backdrop-filter: blur(20px);
}

.header-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Main View Container - fills available space */
#mainView {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    /* Critical for flexbox overflow */
}

/* ============================================
   Chat Interface
   ============================================ */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Message Bubbles */
.message {
    display: flex;
    gap: 1rem;
    max-width: 85%;
    animation: messageSlide 0.3s ease-out;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.message.assistant .message-avatar {
    background: var(--color-accent-gradient);
    color: white;
}

.message.user .message-avatar {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
}

.message-content {
    background: var(--color-bg-glass);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    backdrop-filter: blur(10px);
}

.message.user .message-content {
    background: var(--color-accent-gradient);
    border-color: transparent;
    color: white;
}

.message-text {
    font-size: 0.9375rem;
    line-height: 1.7;
}

.message-text p {
    margin-bottom: 0.75rem;
    color: inherit;
}

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

.message-text code {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.875em;
}

.message-text pre {
    background: var(--color-bg-primary);
    border-radius: var(--radius-md);
    padding: 1rem;
    overflow-x: auto;
    margin: 0.75rem 0;
}

.message-text pre code {
    background: none;
    padding: 0;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.message.user .message-meta {
    color: rgba(255, 255, 255, 0.7);
}

.search-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: rgba(6, 182, 212, 0.2);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--color-accent-secondary);
}

/* Chat Input */
.chat-input-container {
    padding: 1rem 1.5rem 1.5rem;
    background: var(--color-bg-glass);
    border-top: 1px solid var(--color-border);
    backdrop-filter: blur(20px);
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 0.5rem;
    transition: border-color var(--transition-fast);
}

.chat-input-wrapper:focus-within {
    border-color: var(--color-accent-primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.chat-input {
    flex: 1;
    min-height: 44px;
    max-height: 200px;
    padding: 0.625rem 0.75rem;
    background: transparent;
    border: none;
    color: var(--color-text-primary);
    font-size: 0.9375rem;
    font-family: inherit;
    resize: none;
    line-height: 1.5;
}

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

.chat-input:focus {
    outline: none;
}

.send-btn {
    width: 44px;
    height: 44px;
    background: var(--color-accent-gradient);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
    flex-shrink: 0;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.4);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
}

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

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

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

@keyframes typingBounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-8px);
    }
}

/* ============================================
   Auth Pages
   ============================================ */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--color-bg-glass);
    backdrop-filter: blur(30px);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    box-shadow: var(--shadow-xl), var(--shadow-glow);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    width: 60px;
    height: 60px;
    background: var(--color-accent-gradient);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 1.75rem;
    color: white;
    box-shadow: var(--shadow-glow);
}

.auth-title {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    color: var(--color-text-secondary);
}

.auth-form {
    margin-bottom: 1.5rem;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-border);
}

.auth-footer {
    text-align: center;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

/* ============================================
   Onboarding
   ============================================ */
.onboarding-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.onboarding-card {
    width: 100%;
    max-width: 600px;
    background: var(--color-bg-glass);
    backdrop-filter: blur(30px);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: 3rem;
    box-shadow: var(--shadow-xl);
}

.onboarding-progress {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.progress-step {
    flex: 1;
    height: 4px;
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-step.active {
    background: var(--color-accent-gradient);
}

.progress-step.completed {
    background: var(--color-success);
}

.onboarding-header {
    text-align: center;
    margin-bottom: 2rem;
}

.onboarding-title {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
}

.onboarding-subtitle {
    color: var(--color-text-secondary);
}

.interests-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.interest-item {
    padding: 1rem;
    background: var(--color-bg-glass);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.interest-item:hover {
    border-color: var(--color-accent-primary);
    transform: translateY(-2px);
}

.interest-item.selected {
    border-color: var(--color-accent-primary);
    background: rgba(124, 58, 237, 0.1);
}

.interest-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.interest-label {
    font-size: 0.875rem;
    font-weight: 500;
}

/* ============================================
   Dashboard
   ============================================ */
.dashboard-container {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.dashboard-header {
    margin-bottom: 2rem;
}

.dashboard-title {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.dashboard-subtitle {
    color: var(--color-text-secondary);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--color-bg-glass);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: all var(--transition-normal);
    backdrop-filter: blur(10px);
}

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

.stat-icon {
    width: 48px;
    height: 48px;
    background: var(--color-accent-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    background: var(--color-accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    margin-top: 0.25rem;
}

.stat-change {
    font-size: 0.75rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.stat-change.positive {
    color: var(--color-success);
}

.stat-change.negative {
    color: var(--color-error);
}

/* Charts Section */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-card {
    background: var(--color-bg-glass);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    backdrop-filter: blur(10px);
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.chart-title {
    font-size: 1rem;
    font-weight: 600;
}

.chart-container {
    height: 250px;
    position: relative;
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: var(--z-toast);
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: toastSlide 0.3s ease-out;
    max-width: 400px;
}

@keyframes toastSlide {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    background: rgba(16, 185, 129, 0.2);
    color: var(--color-success);
}

.toast.error .toast-icon {
    background: rgba(239, 68, 68, 0.2);
    color: var(--color-error);
}

.toast.info .toast-icon {
    background: rgba(59, 130, 246, 0.2);
    color: var(--color-info);
}

.toast-message {
    flex: 1;
    font-size: 0.875rem;
}

.toast-close {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0.25rem;
}

/* ============================================
   Loading States
   ============================================ */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-bg-tertiary);
    border-top-color: var(--color-accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 15, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    backdrop-filter: blur(5px);
}

.skeleton {
    background: linear-gradient(90deg,
            var(--color-bg-glass) 25%,
            var(--color-bg-tertiary) 50%,
            var(--color-bg-glass) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

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

    100% {
        background-position: -200% 0;
    }
}

/* ============================================
   Modals
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 15, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    backdrop-filter: blur(5px);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transform: scale(0.95);
    transition: transform var(--transition-normal);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

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

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    color: var(--color-text-primary);
    background: var(--color-bg-glass);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--color-border);
}

/* ============================================
   Dropdown Menu
   ============================================ */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 180px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.5rem;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
    z-index: var(--z-dropdown);
}

.dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(5px);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--color-bg-glass);
    color: var(--color-text-primary);
}

.dropdown-item.danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-error);
}

/* ============================================
   Empty States
   ============================================ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    background: var(--color-bg-glass);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
}

.empty-state-title {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.empty-state-text {
    color: var(--color-text-secondary);
    max-width: 400px;
    margin-bottom: 1.5rem;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: var(--z-modal);
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: calc(var(--z-modal) - 1);
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-normal);
    }

    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    .menu-toggle {
        display: flex;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .interests-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .message {
        max-width: 95%;
    }

    .auth-card,
    .onboarding-card {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .chat-input-container {
        padding: 0.75rem 1rem 1rem;
    }
}

/* ============================================
   Utility Classes
   ============================================ */
.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

.flex {
    display: flex !important;
}

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

.text-center {
    text-align: center;
}

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

.mt-1 {
    margin-top: 0.25rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-4 {
    gap: 1rem;
}