/* ============================================
   MARY JANE DESIGN SYSTEM - "Hlýja"
   Nordic Sanctuary Aesthetic
   ============================================ */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&display=swap');

/* ---------- CSS Variables ---------- */
:root {
    /* Base Colors - Light Mode (Warm Cream) */
    --color-base: #FAF7F2;
    --color-surface: #FFFFFF;
    --color-surface-elevated: #FFFFFF;
    --color-surface-sunken: #F5F1EA;

    /* Text Colors */
    --color-text-primary: #2D2926;
    --color-text-secondary: #6B635B;
    --color-text-tertiary: #9C948B;
    --color-text-inverse: #FAF7F2;

    /* Accent Colors */
    --color-accent: #B96ECE;
    --color-accent-soft: rgba(185, 110, 206, 0.12);
    --color-accent-hover: #A55BB8;

    /* Secondary Colors */
    --color-sage: #7B8F71;
    --color-sage-soft: rgba(123, 143, 113, 0.15);
    --color-warm: #D4C4B0;
    --color-warm-soft: rgba(212, 196, 176, 0.3);
    --color-terracotta: #C4846C;
    --color-terracotta-soft: rgba(196, 132, 108, 0.15);

    /* Semantic Colors */
    --color-success: #7B8F71;
    --color-warning: #D4A853;
    --color-error: #C45B5B;

    /* Borders & Shadows */
    --color-border: rgba(45, 41, 38, 0.08);
    --color-border-strong: rgba(45, 41, 38, 0.15);
    --shadow-sm: 0 1px 3px rgba(45, 41, 38, 0.04);
    --shadow-md: 0 4px 16px rgba(45, 41, 38, 0.08);
    --shadow-lg: 0 12px 40px rgba(45, 41, 38, 0.12);
    --shadow-glow: 0 0 30px rgba(185, 110, 206, 0.12);

    /* Typography */
    --font-display: 'DM Sans', -apple-system, sans-serif;
    --font-body: 'DM Sans', -apple-system, sans-serif;

    /* Spacing Scale */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;

    /* Layout */
    --sidebar-width: 300px;
    --header-height: 64px;
    --max-content-width: 1200px;
}

/* ---------- Dark Mode ---------- */
[data-theme="dark"] {
    --color-base: #1C1917;
    --color-surface: #262220;
    --color-surface-elevated: #2F2A27;
    --color-surface-sunken: #161412;

    --color-text-primary: #F5F1EA;
    --color-text-secondary: #B8B0A5;
    --color-text-tertiary: #7A736A;
    --color-text-inverse: #1C1917;

    --color-accent-soft: rgba(185, 110, 206, 0.2);
    --color-sage-soft: rgba(123, 143, 113, 0.2);
    --color-warm-soft: rgba(212, 196, 176, 0.15);
    --color-terracotta-soft: rgba(196, 132, 108, 0.2);

    --color-border: rgba(245, 241, 234, 0.08);
    --color-border-strong: rgba(245, 241, 234, 0.15);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(185, 110, 206, 0.2);
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.6;
    color: var(--color-text-primary);
    background-color: var(--color-base);
    min-height: 100vh;
    position: relative;
}

/* Subtle paper texture overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.015;
    pointer-events: none;
    z-index: 9999;
}

[data-theme="dark"] body::before {
    opacity: 0.025;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.3;
    color: var(--color-text-primary);
    letter-spacing: -0.02em;
}

h1 {
    font-size: 2rem;
    font-weight: 600;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

h4 {
    font-size: 1rem;
    font-weight: 600;
}

p {
    margin-bottom: var(--space-md);
    color: var(--color-text-secondary);
}

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

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

small, .text-small {
    font-size: 0.875rem;
    color: var(--color-text-tertiary);
}

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

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 0.625rem 1.25rem;
    font-family: var(--font-body);
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.5;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
}

.btn-primary {
    background: var(--color-accent);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--color-accent-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    color: white;
}

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border-strong);
}

.btn-secondary:hover {
    background: var(--color-surface-sunken);
    border-color: var(--color-accent);
    color: var(--color-accent);
}

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

.btn-ghost:hover {
    background: var(--color-accent-soft);
    color: var(--color-accent);
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    border-radius: var(--radius-lg);
}

.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: var(--radius-md);
}

.btn-icon-sm {
    width: 36px;
    height: 36px;
}

/* ---------- Cards ---------- */
.card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-interactive {
    cursor: pointer;
}

.card-interactive:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-accent-soft);
}

.card-body {
    padding: var(--space-xl);
}

/* ---------- Form Elements ---------- */
.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--color-text-primary);
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.form-control::placeholder {
    color: var(--color-text-tertiary);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-label {
    display: block;
    margin-bottom: var(--space-sm);
    font-weight: 500;
    font-size: 0.9375rem;
    color: var(--color-text-primary);
}

.form-group {
    margin-bottom: var(--space-lg);
}

/* ---------- Input Group ---------- */
.input-group {
    display: flex;
    gap: var(--space-sm);
}

.input-group .form-control {
    flex: 1;
}

.input-group .btn {
    flex-shrink: 0;
}

/* ---------- Badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-radius: var(--radius-full);
    background: var(--color-accent-soft);
    color: var(--color-accent);
}

.badge-sage {
    background: var(--color-sage-soft);
    color: var(--color-sage);
}

.badge-coming {
    background: var(--color-warm-soft);
    color: var(--color-text-tertiary);
}

/* ---------- Avatar ---------- */
.avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
    flex-shrink: 0;
}

.avatar-sm {
    width: 36px;
    height: 36px;
    font-size: 0.875rem;
}

.avatar-user {
    background: var(--color-sage-soft);
    color: var(--color-sage);
}

.avatar-ai {
    background: var(--color-accent-soft);
    color: var(--color-accent);
}

/* ---------- Layout ---------- */
.container {
    width: 100%;
    max-width: var(--max-content-width);
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---------- Sidebar Layout ---------- */
.layout-sidebar {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform var(--transition-base);
}

.sidebar-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--color-border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

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

.sidebar-logo-text {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--color-text-primary);
}

.sidebar-logo-subtitle {
    font-size: 0.75rem;
    color: var(--color-text-tertiary);
    margin-top: 2px;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
}

.sidebar-footer {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--color-border);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Sidebar Navigation */
.nav-section {
    margin-bottom: var(--space-xl);
}

.nav-section-title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-tertiary);
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-xs);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 0.625rem var(--space-md);
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    font-size: 0.9375rem;
    transition: all var(--transition-fast);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    text-decoration: none;
}

.nav-item:hover {
    background: var(--color-surface-sunken);
    color: var(--color-text-primary);
}

.nav-item.active {
    background: var(--color-accent-soft);
    color: var(--color-accent);
    font-weight: 500;
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 1.125rem;
    opacity: 0.8;
}

.nav-item.active i {
    opacity: 1;
}

/* ---------- Chat Layout ---------- */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background: var(--color-base);
}

.chat-header {
    padding: var(--space-md) var(--space-xl);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chat-header-title {
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 500;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-xl);
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.chat-input-area {
    padding: var(--space-md) var(--space-xl) var(--space-lg);
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
}

.chat-input-wrapper {
    display: flex;
    gap: var(--space-sm);
    align-items: flex-end;
}

.chat-input-wrapper textarea {
    flex: 1;
    resize: none;
    min-height: 48px;
    max-height: 200px;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-lg);
}

.chat-input-hint {
    font-size: 0.75rem;
    color: var(--color-text-tertiary);
    margin-top: var(--space-sm);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

/* Message Bubbles */
.message {
    display: flex;
    gap: var(--space-md);
    max-width: 80%;
    animation: messageAppear 0.4s ease-out;
}

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

.message-user {
    flex-direction: row-reverse;
    margin-left: auto;
}

.message-content {
    background: var(--color-surface);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.message-ai .message-content {
    border-bottom-left-radius: var(--radius-sm);
}

.message-user .message-content {
    background: var(--color-accent);
    color: white;
    border-color: transparent;
    border-bottom-right-radius: var(--radius-sm);
}

.message-meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.75rem;
    color: var(--color-text-tertiary);
    margin-bottom: var(--space-xs);
}

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

.message-name {
    font-weight: 600;
    color: var(--color-text-primary);
}

.message-user .message-name {
    color: white;
}

/* AI Message Markdown */
.message-ai .message-content h1,
.message-ai .message-content h2,
.message-ai .message-content h3 {
    margin-top: var(--space-md);
    margin-bottom: var(--space-sm);
}

.message-ai .message-content h1:first-child,
.message-ai .message-content h2:first-child,
.message-ai .message-content h3:first-child {
    margin-top: 0;
}

.message-ai .message-content h1 { font-size: 1.25rem; }
.message-ai .message-content h2 { font-size: 1.125rem; }
.message-ai .message-content h3 { font-size: 1rem; font-weight: 500; }

.message-ai .message-content p {
    margin-bottom: var(--space-sm);
    color: var(--color-text-primary);
}

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

.message-ai .message-content ul,
.message-ai .message-content ol {
    margin: var(--space-sm) 0;
    padding-left: var(--space-lg);
}

.message-ai .message-content li {
    margin-bottom: var(--space-xs);
    color: var(--color-text-primary);
}

.message-ai .message-content strong {
    font-weight: 600;
}

.message-ai .message-content hr {
    margin: var(--space-md) 0;
    border: none;
    border-top: 1px solid var(--color-border);
}

.message-ai .message-content code {
    background: var(--color-surface-sunken);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
    font-size: 0.875em;
    font-family: 'SF Mono', Monaco, monospace;
}

/* Streaming text */
.streaming-text {
    animation: fadeIn 0.3s ease-out;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: var(--space-md) var(--space-lg);
    align-items: center;
}

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

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

@keyframes typingPulse {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Welcome State */
.chat-welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-2xl);
    max-width: 500px;
    margin: 0 auto;
}

.chat-welcome-icon {
    width: 80px;
    height: 80px;
    background: var(--color-accent-soft);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-lg);
}

.chat-welcome-icon i {
    font-size: 2rem;
    color: var(--color-accent);
}

.chat-welcome h2 {
    margin-bottom: var(--space-sm);
    font-size: 1.5rem;
}

.chat-welcome p {
    color: var(--color-text-secondary);
    line-height: 1.7;
}

/* Sources */
.message-sources {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--color-border);
    font-size: 0.8125rem;
    color: var(--color-text-tertiary);
}

.message-sources i {
    margin-right: var(--space-xs);
}

/* ---------- Tool Cards (Index) ---------- */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
}

.tool-card {
    position: relative;
    padding: var(--space-xl);
    text-decoration: none;
    color: inherit;
    display: block;
}

.tool-card-icon {
    width: 56px;
    height: 56px;
    background: var(--color-accent-soft);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-md);
    transition: all var(--transition-base);
}

.tool-card-icon i {
    font-size: 1.5rem;
    color: var(--color-accent);
    transition: all var(--transition-base);
}

.tool-card:hover .tool-card-icon {
    background: var(--color-accent);
    transform: scale(1.05);
}

.tool-card:hover .tool-card-icon i {
    color: white;
}

.tool-card h3 {
    margin-bottom: var(--space-sm);
    font-size: 1.125rem;
}

.tool-card p {
    margin-bottom: 0;
    font-size: 0.9375rem;
    line-height: 1.6;
}

.tool-card .badge {
    position: absolute;
    top: var(--space-lg);
    right: var(--space-lg);
}

.tool-card-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.tool-card-disabled:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
}

/* Sage colored tool card */
.tool-card-sage .tool-card-icon {
    background: var(--color-sage-soft);
}

.tool-card-sage .tool-card-icon i {
    color: var(--color-sage);
}

.tool-card-sage:hover .tool-card-icon {
    background: var(--color-sage);
}

/* Terracotta colored tool card */
.tool-card-terracotta .tool-card-icon {
    background: var(--color-terracotta-soft);
}

.tool-card-terracotta .tool-card-icon i {
    color: var(--color-terracotta);
}

.tool-card-terracotta:hover .tool-card-icon {
    background: var(--color-terracotta);
}

/* ---------- Login Page ---------- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    position: relative;
    overflow: hidden;
}

.login-utility {
    position: absolute;
    top: var(--space-lg);
    right: var(--space-lg);
    z-index: 10;
}

.login-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
}

.login-blob {
    position: absolute;
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
    filter: blur(80px);
    opacity: 0.5;
}

.login-blob-1 {
    width: 600px;
    height: 600px;
    background: var(--color-warm-soft);
    top: -200px;
    right: -150px;
}

.login-blob-2 {
    width: 400px;
    height: 400px;
    background: var(--color-sage-soft);
    bottom: -100px;
    left: -100px;
}

.login-container {
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
}

.login-card {
    padding: var(--space-2xl);
}

.login-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.login-logo {
    width: 72px;
    height: 72px;
    background: var(--color-accent-soft);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-lg);
}

.login-logo i {
    font-size: 2rem;
    color: var(--color-accent);
}

.login-header h1 {
    font-size: 1.75rem;
    margin-bottom: var(--space-sm);
}

.login-header p {
    margin-bottom: 0;
}

.login-error {
    background: rgba(196, 91, 91, 0.1);
    border: 1px solid rgba(196, 91, 91, 0.3);
    color: var(--color-error);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
    font-size: 0.9375rem;
}

.login-info {
    text-align: center;
    font-size: 0.875rem;
    color: var(--color-text-tertiary);
    border-top: 1px solid var(--color-border);
    padding-top: var(--space-lg);
    margin-top: var(--space-lg);
}

/* ---------- Dashboard Page ---------- */
.dashboard {
    padding: var(--space-2xl) var(--space-xl);
    max-width: 900px;
    margin: 0 auto;
}

.dashboard-utility {
    display: flex;
    justify-content: flex-end;
    margin-bottom: var(--space-md);
}

.dashboard-header {
    text-align: center;
    margin-bottom: var(--space-3xl);
}

.dashboard-greeting {
    font-size: 0.875rem;
    color: var(--color-accent);
    font-weight: 500;
    margin-bottom: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dashboard-header h1 {
    margin-bottom: var(--space-md);
}

.dashboard-subtitle {
    font-size: 1.125rem;
    max-width: 500px;
    margin: 0 auto;
    color: var(--color-text-secondary);
}

.dashboard-section {
    margin-bottom: var(--space-2xl);
}

.dashboard-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
}

.dashboard-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-tertiary);
}

/* ---------- Theme Toggle ---------- */
.theme-toggle {
    position: fixed;
    bottom: var(--space-lg);
    right: var(--space-lg);
    width: 48px;
    height: 48px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
    z-index: 1000;
}

.theme-toggle:hover {
    box-shadow: var(--shadow-lg);
    transform: scale(1.05);
    border-color: var(--color-accent);
}

.theme-toggle i {
    font-size: 1.25rem;
    color: var(--color-text-secondary);
}

/* ---------- Animations ---------- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

.animate-slide-up {
    animation: slideUp 0.5s ease-out forwards;
}

/* Stagger animations */
.stagger-1 { animation-delay: 0.1s; opacity: 0; }
.stagger-2 { animation-delay: 0.15s; opacity: 0; }
.stagger-3 { animation-delay: 0.2s; opacity: 0; }
.stagger-4 { animation-delay: 0.25s; opacity: 0; }

/* ---------- Utilities ---------- */
.text-center { text-align: center; }
.text-right { text-align: right; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

.w-full { width: 100%; }

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

@media (max-width: 768px) {
    :root {
        --sidebar-width: 100%;
    }

    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }

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

    .main-content {
        margin-left: 0;
    }

    .mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: var(--space-md) var(--space-lg);
        background: var(--color-surface);
        border-bottom: 1px solid var(--color-border);
    }

    .mobile-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
    }

    .mobile-overlay.show {
        display: block;
    }

    h1 {
        font-size: 1.75rem;
    }

    .message {
        max-width: 90%;
    }

    .dashboard {
        padding: var(--space-lg);
    }

    .chat-messages {
        padding: var(--space-md);
    }

    .chat-input-area {
        padding: var(--space-md);
    }
}

@media (min-width: 769px) {
    .mobile-header {
        display: none;
    }

    .mobile-menu-btn {
        display: none;
    }
}

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

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

::-webkit-scrollbar-thumb {
    background: var(--color-border-strong);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-tertiary);
}

/* ---------- Focus States ---------- */
*:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* ---------- Print Styles ---------- */
@media print {
    .sidebar,
    .theme-toggle,
    .chat-input-area {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .message {
        break-inside: avoid;
    }
}
