/* ===== Jarvis - Modern Lifestyle Assistant ===== */
/* Dark Theme with Emerald/Blue Accents */

/* ===== CSS Variables ===== */
:root {
    /* Colors */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: linear-gradient(145deg, #1e293b, #0f172a);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent-primary: #10b981;
    --accent-secondary: #3b82f6;
    --accent-gradient: linear-gradient(135deg, #10b981, #3b82f6);

    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #10b981;
    --info: #3b82f6;

    --border-color: #334155;
    --border-light: rgba(148, 163, 184, 0.1);

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.3);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 70px;
    --mobile-nav-height: 70px;
}

/* ===== Theme: Cosmic (Purple/Cyan) ===== */
[data-theme="cosmic"] {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-tertiary: #2a2a4a;
    --bg-card: linear-gradient(145deg, #1e1e3f, #16213e);

    --accent-primary: #a855f7;
    --accent-secondary: #22d3d8;
    --accent-gradient: linear-gradient(135deg, #a855f7, #22d3d8);

    --success: #a855f7;
    --info: #22d3d8;
    --border-color: #2a2a4a;
    --shadow-glow: 0 0 20px rgba(168, 85, 247, 0.3);
}

/* ===== Theme: JARVIS (Iron Man HUD Style) ===== */
[data-theme="night"] {
    /* Deep navy/blue-black background */
    --bg-primary: #0a0e17;
    --bg-secondary: #0d1220;
    --bg-tertiary: #151c2c;
    --bg-card: linear-gradient(145deg, rgba(15, 23, 42, 0.9), rgba(10, 14, 23, 0.95));

    /* Electric cyan primary, coral/orange secondary */
    --accent-primary: #00d4ff;
    --accent-secondary: #ff6b35;
    --accent-gradient: linear-gradient(135deg, #00d4ff, #0099cc);

    --success: #00d4ff;
    --info: #ff6b35;
    --border-color: rgba(0, 212, 255, 0.2);
    --border-glow: rgba(0, 212, 255, 0.4);

    /* Glow effects */
    --shadow-glow: 0 0 20px rgba(0, 212, 255, 0.4);
    --shadow-glow-strong: 0 0 30px rgba(0, 212, 255, 0.6);
    --text-glow: 0 0 10px rgba(0, 212, 255, 0.5);
}

/* JARVIS Theme - Glowing Card Borders */
[data-theme="night"] .card {
    border: 1px solid rgba(0, 212, 255, 0.3);
    box-shadow:
        0 0 15px rgba(0, 212, 255, 0.1),
        inset 0 1px 0 rgba(0, 212, 255, 0.1);
    background: linear-gradient(145deg, rgba(15, 23, 42, 0.85), rgba(10, 14, 23, 0.95));
}

[data-theme="night"] .card:hover {
    border-color: rgba(0, 212, 255, 0.5);
    box-shadow:
        0 0 25px rgba(0, 212, 255, 0.2),
        0 0 50px rgba(0, 212, 255, 0.1),
        inset 0 1px 0 rgba(0, 212, 255, 0.15);
}

/* JARVIS Theme - Sidebar Glow */
[data-theme="night"] .sidebar {
    background: linear-gradient(180deg, #0d1220 0%, #0a0e17 100%);
    border-right: 1px solid rgba(0, 212, 255, 0.15);
}

[data-theme="night"] .nav-link.active {
    background: transparent;
    border: 1px solid rgba(0, 212, 255, 0.5);
    box-shadow:
        0 0 15px rgba(0, 212, 255, 0.3),
        inset 0 0 20px rgba(0, 212, 255, 0.1);
    color: #00d4ff;
}

[data-theme="night"] .nav-link:hover:not(.active) {
    background: rgba(0, 212, 255, 0.05);
    border: 1px solid rgba(0, 212, 255, 0.2);
}

/* JARVIS Theme - Stat Cards with Glow */
[data-theme="night"] .stat-card {
    border: 1px solid rgba(0, 212, 255, 0.25);
    background: linear-gradient(145deg, rgba(15, 23, 42, 0.9), rgba(10, 14, 23, 0.95));
}

[data-theme="night"] .stat-card:hover {
    box-shadow:
        0 0 30px rgba(0, 212, 255, 0.25),
        0 5px 30px rgba(0, 0, 0, 0.3);
}

/* JARVIS Theme - Icon Glow Effects */
[data-theme="night"] .stat-icon {
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.2);
}

[data-theme="night"] .stat-icon.blue {
    background: rgba(0, 212, 255, 0.15);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

[data-theme="night"] .stat-icon.green {
    background: rgba(0, 212, 255, 0.15);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

[data-theme="night"] .stat-icon.orange {
    background: rgba(255, 107, 53, 0.15);
    box-shadow: 0 0 20px rgba(255, 107, 53, 0.3);
}

[data-theme="night"] .stat-icon.red {
    background: rgba(255, 107, 53, 0.15);
    box-shadow: 0 0 20px rgba(255, 107, 53, 0.3);
}

/* JARVIS Theme - Buttons with Glow */
[data-theme="night"] .btn-primary {
    background: linear-gradient(135deg, #00d4ff, #0099cc);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

[data-theme="night"] .btn-primary:hover:not(:disabled) {
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.5);
}

/* JARVIS Theme - Progress Bars */
[data-theme="night"] .progress-fill {
    background: linear-gradient(90deg, #00d4ff, #0099cc);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

/* JARVIS Theme - Page Header */
[data-theme="night"] .page-header {
    border-bottom: 1px solid rgba(0, 212, 255, 0.15);
    background: linear-gradient(180deg, rgba(13, 18, 32, 0.95), rgba(10, 14, 23, 0.9));
}

/* JARVIS Theme - Text Glow for Important Elements */
[data-theme="night"] .stat-value {
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

[data-theme="night"] .text-gradient {
    background: linear-gradient(135deg, #00d4ff, #00a8cc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 10px rgba(0, 212, 255, 0.3));
}

/* JARVIS Theme - Mobile Nav Glow */
[data-theme="night"] .mobile-nav {
    background: linear-gradient(180deg, #0d1220, #0a0e17);
    border-top: 1px solid rgba(0, 212, 255, 0.2);
}

[data-theme="night"] .mobile-nav-link.active {
    color: #00d4ff;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

/* JARVIS Theme - Form Elements */
[data-theme="night"] .form-input:focus,
[data-theme="night"] .form-select:focus,
[data-theme="night"] .form-textarea:focus {
    border-color: #00d4ff;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.2);
}

/* JARVIS Theme - Badges */
[data-theme="night"] .badge-info {
    background: rgba(0, 212, 255, 0.15);
    color: #00d4ff;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.2);
}

/* JARVIS Theme - Data Lists */
[data-theme="night"] .data-item {
    border-bottom: 1px solid rgba(0, 212, 255, 0.1);
}

[data-theme="night"] .data-item:hover {
    background: rgba(0, 212, 255, 0.03);
}

/* Arc Reactor Icon - Visible on all themes */
.arc-reactor-icon {
    display: block;
    text-align: center;
    margin-bottom: var(--spacing-md);
}

/* Default theme - Green Arc Reactor */
.arc-reactor-svg {
    color: #10b981;
    filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.4));
    animation: arcReactorPulseDefault 2.5s ease-in-out infinite;
}

@keyframes arcReactorPulseDefault {

    0%,
    100% {
        filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.4));
        transform: scale(1);
    }

    50% {
        filter: drop-shadow(0 0 25px rgba(16, 185, 129, 1));
        transform: scale(1.05);
    }
}

/* Cosmic theme - Purple Arc Reactor */
[data-theme="cosmic"] .arc-reactor-svg {
    color: #a855f7;
    filter: drop-shadow(0 0 8px rgba(168, 85, 247, 0.4));
    animation: arcReactorPulseCosmic 2.5s ease-in-out infinite;
}

@keyframes arcReactorPulseCosmic {

    0%,
    100% {
        filter: drop-shadow(0 0 8px rgba(168, 85, 247, 0.4));
        transform: scale(1);
    }

    50% {
        filter: drop-shadow(0 0 25px rgba(168, 85, 247, 1));
        transform: scale(1.05);
    }
}

/* JARVIS theme - Cyan Arc Reactor */
[data-theme="night"] .arc-reactor-svg {
    color: #00d4ff;
    filter: drop-shadow(0 0 8px rgba(0, 212, 255, 0.4));
    animation: arcReactorPulseJarvis 2.5s ease-in-out infinite;
}

@keyframes arcReactorPulseJarvis {

    0%,
    100% {
        filter: drop-shadow(0 0 8px rgba(0, 212, 255, 0.4));
        transform: scale(1);
    }

    50% {
        filter: drop-shadow(0 0 25px rgba(0, 212, 255, 1));
        transform: scale(1.05);
    }
}

/* Sidebar Header with Arc Reactor */
.sidebar-header {
    padding-top: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.sidebar-logo {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: var(--spacing-sm);
}

[data-theme="night"] .sidebar-header {
    border-bottom: 1px solid rgba(0, 212, 255, 0.2);
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    min-height: 100dvh;
    /* Dynamic viewport height for mobile */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    max-width: 100vw;
    position: relative;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-secondary);
}

img {
    max-width: 100%;
    height: auto;
}

/* ===== Typography ===== */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 {
    font-size: 2.25rem;
}

h2 {
    font-size: 1.875rem;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
}

h5 {
    font-size: 1.125rem;
}

h6 {
    font-size: 1rem;
}

.text-gradient {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== Utilities ===== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

.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(--spacing-sm);
}

.gap-md {
    gap: var(--spacing-md);
}

.gap-lg {
    gap: var(--spacing-lg);
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--text-muted);
}

.text-secondary {
    color: var(--text-secondary);
}

.mt-sm {
    margin-top: var(--spacing-sm);
}

.mt-md {
    margin-top: var(--spacing-md);
}

.mt-lg {
    margin-top: var(--spacing-lg);
}

.mb-sm {
    margin-bottom: var(--spacing-sm);
}

.mb-md {
    margin-bottom: var(--spacing-md);
}

.mb-lg {
    margin-bottom: var(--spacing-lg);
}

.hidden {
    display: none !important;
}

/* ===== Glass Card ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    backdrop-filter: blur(10px);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-light);
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
}

/* ===== Form Elements ===== */
.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
}

.form-checkbox input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    accent-color: var(--accent-primary);
}

.form-error {
    font-size: 0.875rem;
    color: var(--danger);
    margin-top: var(--spacing-xs);
}

.input-icon-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.input-icon-wrapper .form-input {
    padding-left: 2.75rem;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--border-color);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: var(--spacing-sm) var(--spacing-md);
}

.btn-ghost:hover:not(:disabled) {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

/* ===== Auth Layout ===== */
.auth-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
    background:
        radial-gradient(ellipse at top left, rgba(16, 185, 129, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
        var(--bg-primary);
}

.auth-card {
    width: 100%;
    max-width: 420px;
}

.auth-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.auth-logo {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

.auth-footer {
    text-align: center;
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-light);
    color: var(--text-secondary);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin: var(--spacing-xl) 0;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.social-buttons {
    display: flex;
    gap: var(--spacing-md);
}

.btn-social {
    flex: 1;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.btn-social:hover {
    background: var(--bg-tertiary);
}

/* ===== App Layout ===== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition-normal);
}

.sidebar-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-light);
}

.sidebar-logo {
    font-size: 1.5rem;
    font-weight: 700;
}

.sidebar-nav {
    flex: 1;
    padding: var(--spacing-lg);
    overflow-y: auto;
}

.nav-group {
    margin-bottom: var(--spacing-lg);
}

.nav-group-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: var(--spacing-sm);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: 0.75rem var(--spacing-md);
    color: var(--text-secondary);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    margin-bottom: var(--spacing-xs);
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.nav-link.active {
    color: var(--text-primary);
    background: var(--accent-gradient);
}

.nav-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: var(--spacing-lg);
    border-top: 1px solid var(--border-light);
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 500;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* Prevent horizontal overflow on mobile */
    overflow-x: hidden;
    max-width: 100%;
}

.page-header {
    padding: var(--spacing-lg) var(--spacing-xl);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: var(--spacing-xs);
}

.page-content {
    flex: 1;
    padding: var(--spacing-xl);
    /* Prevent horizontal overflow */
    overflow-x: hidden;
    max-width: 100%;
}

/* Mobile Navigation */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 var(--spacing-lg);
    align-items: center;
    justify-content: space-between;
    z-index: 99;
}

.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--mobile-nav-height);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: var(--spacing-sm) var(--spacing-md);
    z-index: 99;
}

.mobile-nav-items {
    display: flex;
    justify-content: space-around;
    height: 100%;
}

.mobile-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    padding: var(--spacing-sm);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
    color: var(--accent-primary);
}

.mobile-nav-link svg {
    width: 24px;
    height: 24px;
}

/* Menu Toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: var(--spacing-sm);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

/* ===== Dashboard Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.stat-card {
    padding: var(--spacing-lg);
}

.stat-card:hover {
    transform: translateY(-4px);
}

.stat-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.stat-card-link:hover {
    box-shadow: var(--shadow-glow);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--spacing-md);
}

.stat-icon.green {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-primary);
}

.stat-icon.blue {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-secondary);
}

.stat-icon.orange {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.stat-icon.red {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    margin-top: var(--spacing-sm);
}

.stat-change.positive {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.stat-change.negative {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

/* ===== Data List ===== */
.data-list {
    list-style: none;
}

.data-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    border-radius: var(--radius-lg);
    transition: background var(--transition-fast);
}

.data-item:hover {
    background: var(--bg-tertiary);
}

.data-item+.data-item {
    border-top: 1px solid var(--border-light);
}

.data-item-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    flex-shrink: 0;
}

.data-item-content {
    flex: 1;
    min-width: 0;
}

.data-item-title {
    font-weight: 500;
    margin-bottom: 2px;
}

.data-item-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.data-item-value {
    font-weight: 600;
    color: var(--accent-primary);
}

.data-item-actions {
    display: flex;
    gap: var(--spacing-xs);
}

/* ===== Progress Bar ===== */
.progress-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--spacing-sm);
    font-size: 0.875rem;
}

/* ===== Badge ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--radius-full);
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.badge-info {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
    z-index: 200;
    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;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform var(--transition-normal);
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-lg);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--spacing-sm);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.modal-footer {
    display: flex;
    gap: var(--spacing-md);
    justify-content: flex-end;
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-light);
}

/* ===== Alert Messages ===== */
.alert {
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success);
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--warning);
}

.alert-info {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--info);
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: var(--spacing-2xl);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    color: var(--text-muted);
    margin-bottom: var(--spacing-lg);
}

.empty-state h3 {
    margin-bottom: var(--spacing-sm);
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: var(--spacing-lg);
}

/* ===== Loader ===== */
.loader {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--bg-tertiary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.btn .loader {
    width: 18px;
    height: 18px;
    border-width: 2px;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-color);
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }

    .main-content {
        margin-left: 0;
        padding-top: var(--header-height);
        padding-bottom: var(--mobile-nav-height);
    }

    .mobile-header {
        display: flex;
    }

    .mobile-nav {
        display: block;
    }

    .menu-toggle {
        display: block;
    }
}

@media (max-width: 640px) {
    html {
        font-size: 14px;
    }

    .page-content {
        padding: var(--spacing-md);
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .card {
        padding: var(--spacing-lg);
    }

    .auth-card {
        padding: var(--spacing-lg);
    }

    .auth-layout {
        padding: var(--spacing-md);
    }

    .modal {
        max-width: 100%;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
    }
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.animate-fade-in {
    animation: fadeIn var(--transition-normal) ease;
}

.animate-slide-up {
    animation: slideUp var(--transition-normal) ease;
}

/* ===== Checkbox and Task Styling ===== */
.task-checkbox {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    flex-shrink: 0;
}

.task-checkbox:checked {
    background: var(--accent-gradient);
    border-color: var(--accent-primary);
}

.task-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.task-completed .data-item-title {
    text-decoration: line-through;
    color: var(--text-muted);
}

/* ===== Theme Selector ===== */
.theme-selector {
    position: relative;
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-light);
}

.theme-toggle-btn {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    width: 100%;
    padding: 0.75rem var(--spacing-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.875rem;
    font-family: inherit;
}

.theme-toggle-btn:hover {
    background: var(--border-color);
    border-color: var(--accent-primary);
}

.theme-dropdown {
    position: absolute;
    bottom: calc(100% + var(--spacing-sm));
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-sm);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all var(--transition-fast);
    z-index: 150;
    box-shadow: var(--shadow-lg);
}

.theme-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.theme-option {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    width: 100%;
    padding: 0.625rem var(--spacing-md);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.875rem;
    font-family: inherit;
    text-align: left;
}

.theme-option:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.theme-option.active {
    background: var(--accent-gradient);
    color: white;
}

.theme-preview {
    width: 20px;
    height: 20px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.theme-preview.default {
    background: linear-gradient(135deg, #10b981, #3b82f6);
}

.theme-preview.cosmic {
    background: linear-gradient(135deg, #a855f7, #22d3d8);
}

.theme-preview.jarvis {
    background: linear-gradient(135deg, #3b82f6, #f97316);
}

/* ===== JARVIS Chat Popup ===== */

/* Arc Reactor Enhanced Animations */
.arc-reactor-icon {
    cursor: pointer;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.arc-reactor-icon:hover {
    transform: scale(1.15);
    filter: brightness(1.2);
}

.arc-reactor-svg {
    color: var(--accent-primary);
}

[data-theme="cosmic"] .arc-reactor-svg {
    color: #a855f7;
}

[data-theme="night"] .arc-reactor-svg {
    color: #00d4ff;
}

/* Rotating Rings */
.arc-ring-outer {
    transform-origin: 50% 50%;
    animation: arcRotateSlow 20s linear infinite;
}

.arc-ring-middle {
    transform-origin: 50% 50%;
    animation: arcRotateReverse 15s linear infinite;
}

.arc-ring-inner {
    transform-origin: 50% 50%;
    animation: arcRotateFast 8s linear infinite;
}

.arc-core-segments {
    transform-origin: 50% 50%;
    animation: arcRotateReverse 6s linear infinite;
}

@keyframes arcRotateSlow {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes arcRotateReverse {
    from {
        transform: rotate(360deg);
    }

    to {
        transform: rotate(0deg);
    }
}

@keyframes arcRotateFast {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Pulsing Core */
.arc-core-glow {
    animation: arcCorePulse 2s ease-in-out infinite;
}

.arc-core-center {
    animation: arcCoreGlow 1.5s ease-in-out infinite alternate;
}

@keyframes arcCorePulse {

    0%,
    100% {
        opacity: 0.7;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

@keyframes arcCoreGlow {
    0% {
        opacity: 0.8;
        filter: brightness(1);
    }

    100% {
        opacity: 1;
        filter: brightness(1.3);
    }
}

/* Pulsing Triangle Vertex Nodes */
.arc-pulse-node {
    animation: arcNodePulse 1.5s ease-in-out infinite;
}

@keyframes arcNodePulse {

    0%,
    100% {
        opacity: 0.6;
        r: 2.5;
    }

    50% {
        opacity: 1;
        r: 3.5;
    }
}

/* Energy Nodes on Outer Rim */
.arc-energy-nodes {
    animation: arcEnergyFlicker 3s ease-in-out infinite;
}

@keyframes arcEnergyFlicker {

    0%,
    100% {
        opacity: 0.8;
    }

    25% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }

    75% {
        opacity: 1;
    }
}

/* Hover: Spin faster */
.arc-reactor-icon:hover .arc-ring-outer {
    animation-duration: 5s;
}

.arc-reactor-icon:hover .arc-ring-middle {
    animation-duration: 4s;
}

.arc-reactor-icon:hover .arc-ring-inner {
    animation-duration: 2s;
}

.arc-reactor-icon:hover .arc-core-segments {
    animation-duration: 1.5s;
}

.arc-reactor-icon:hover .arc-core-glow {
    animation-duration: 0.5s;
}

/* ===== JARVIS Dashboard Stat Cards ===== */
.stats-grid-jarvis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

@media (max-width: 1200px) {
    .stats-grid-jarvis {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .stats-grid-jarvis {
        grid-template-columns: 1fr;
    }
}

/* Base Stat Card - JARVIS Style with Gradient Border */
.stats-grid-jarvis .stat-card {
    background: linear-gradient(145deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.9));
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    position: relative;
    transition: all 0.3s ease;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    border: none;
}

/* Gradient border glow effect */
.stats-grid-jarvis .stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: var(--radius-xl);
    padding: 1px;
    background: linear-gradient(135deg, #06b6d4 0%, #0ea5e9 25%, #3b82f6 50%, #f97316 75%, #ef4444 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

/* Glow effect layer */
.stats-grid-jarvis .stat-card::after {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.15) 0%, rgba(14, 165, 233, 0.1) 25%, rgba(59, 130, 246, 0.1) 50%, rgba(249, 115, 22, 0.1) 75%, rgba(239, 68, 68, 0.15) 100%);
    filter: blur(8px);
    z-index: -1;
    opacity: 0.5;
    transition: opacity 0.3s ease, filter 0.3s ease;
}

.stats-grid-jarvis .stat-card:hover::before {
    opacity: 1;
}

.stats-grid-jarvis .stat-card:hover::after {
    opacity: 0.8;
    filter: blur(12px);
}

/* Stat Card Header */
.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
}

.stat-card-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card-title-large {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.stat-card-footer {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: auto;
    padding-top: var(--spacing-sm);
}

/* Calorie Stats Display (above ring) */
.calorie-stats-display {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin-bottom: var(--spacing-sm);
}

.calorie-big-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: #06b6d4;
    line-height: 1;
}

.calorie-target-text {
    font-size: 1.1rem;
    color: var(--text-muted);
}

/* Circular Progress - Calories Card */
.stat-card-circular {
    min-height: 320px;
}

.progress-percent-large {
    font-size: 1.5rem;
    font-weight: 700;
    color: #06b6d4;
}

.circular-progress-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
}

.circular-progress {
    transform: rotate(-90deg);
}

.circular-progress .progress-bg {
    fill: none;
    stroke: rgba(148, 163, 184, 0.1);
    stroke-width: 8;
}

.circular-progress .progress-ring {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease-out;
    filter: drop-shadow(0 0 8px rgba(6, 182, 212, 0.5));
}

.circular-progress-text {
    position: absolute;
    text-align: center;
}

.circular-progress-text .progress-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.circular-progress-text .progress-target {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.circular-progress-text .progress-percent {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--accent-primary);
    margin-top: 4px;
}

/* Workout Card - Running Figure */
.stat-card-workout {
    min-height: 320px;
}


.workout-stats-display {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: var(--spacing-sm);
}

.workout-big-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--warning);
    line-height: 1;
}

.workout-label-text {
    font-size: 1rem;
    color: var(--text-muted);
}

.workout-figure-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    min-height: 100px;
}

.running-figure {
    opacity: 0.9;
}

.workout-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    flex: 1;
}

.workout-figure {
    opacity: 0.9;
}

.workout-stats {
    text-align: left;
}

.workout-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--warning);
    line-height: 1;
}

.workout-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.workout-progress {
    margin-top: auto;
    padding-top: var(--spacing-sm);
}

.workout-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.progress-bar-mini {
    height: 6px;
    background: rgba(148, 163, 184, 0.15);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
}

.progress-bar-fill.orange {
    background: linear-gradient(90deg, #f97316, #fb923c);
}

/* Tasks Card - Inline List */
.stat-card-tasks {
    min-height: 280px;
}

.tasks-summary {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin-bottom: var(--spacing-md);
}

.tasks-count {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--info);
    line-height: 1;
}

.tasks-total {
    font-size: 1rem;
    color: var(--text-muted);
}

.tasks-inline-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.task-inline-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.8rem;
    padding: 6px 8px;
    background: rgba(148, 163, 184, 0.05);
    border-radius: var(--radius-md);
    border-left: 2px solid var(--text-muted);
}

.task-inline-item.completed {
    border-left-color: var(--success);
    opacity: 0.7;
}

.task-inline-item.completed .task-name {
    text-decoration: line-through;
}

.task-inline-item.empty {
    color: var(--text-muted);
    font-style: italic;
    border-left-color: transparent;
}

.task-check {
    font-size: 0.9rem;
    width: 18px;
    text-align: center;
}

.task-inline-item.completed .task-check {
    color: var(--success);
}

.task-name {
    flex: 1;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Goals Card - Mini Progress Bars */
.stat-card-goals {
    min-height: 280px;
}

.goals-summary {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: var(--spacing-md);
}

.goals-count {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--danger);
    line-height: 1;
}

.goals-label {
    font-size: 1rem;
    color: var(--text-muted);
}

.goals-mini-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.goal-mini-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.goal-mini-item.empty {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.8rem;
}

.goal-name {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.goal-mini-bar {
    height: 6px;
    background: rgba(148, 163, 184, 0.15);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.goal-mini-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--danger), #f472b6);
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
}

/* Theme adjustments - hover glow colors */
[data-theme="night"] .stats-grid-jarvis .stat-card:hover::after {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.2) 0%, rgba(6, 182, 212, 0.15) 50%, rgba(249, 115, 22, 0.15) 100%);
}

[data-theme="cosmic"] .stats-grid-jarvis .stat-card:hover::after {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2) 0%, rgba(139, 92, 246, 0.15) 50%, rgba(236, 72, 153, 0.15) 100%);
}

.jarvis-chat {
    position: fixed;
    bottom: 24px;
    left: 280px;
    width: 380px;
    max-width: calc(100vw - 300px);
    height: 500px;
    max-height: calc(100vh - 48px);
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 40px rgba(16, 185, 129, 0.15);
    display: none;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
}

.jarvis-chat.active {
    display: flex;
    animation: jarvisChatIn 0.3s ease-out;
}

@keyframes jarvisChatIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Theme-specific glow */
[data-theme="cosmic"] .jarvis-chat {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 40px rgba(168, 85, 247, 0.15);
}

[data-theme="night"] .jarvis-chat {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 212, 255, 0.15);
}

.jarvis-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    background: rgba(30, 41, 59, 0.5);
}

.jarvis-chat-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.jarvis-chat-icon {
    color: var(--accent-primary);
}

[data-theme="cosmic"] .jarvis-chat-icon {
    color: #a855f7;
}

[data-theme="night"] .jarvis-chat-icon {
    color: #00d4ff;
}

.jarvis-chat-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    line-height: 1;
    padding: var(--spacing-xs);
    cursor: pointer;
    transition: color 0.2s;
    border-radius: var(--radius-sm);
}

.jarvis-chat-close:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.jarvis-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.jarvis-message {
    max-width: 85%;
    animation: messageIn 0.3s ease-out;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.jarvis-message-user {
    align-self: flex-end;
}

.jarvis-message-assistant {
    align-self: flex-start;
}

.jarvis-message-content {
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
    line-height: 1.5;
}

.jarvis-message-user .jarvis-message-content {
    background: var(--accent-gradient);
    color: white;
    border-bottom-right-radius: var(--radius-xs);
}

.jarvis-message-assistant .jarvis-message-content {
    background: rgba(51, 65, 85, 0.8);
    color: var(--text-primary);
    border-bottom-left-radius: var(--radius-xs);
}

.jarvis-chat-form {
    display: flex;
    padding: var(--spacing-md);
    gap: var(--spacing-sm);
    border-top: 1px solid rgba(148, 163, 184, 0.1);
    background: rgba(30, 41, 59, 0.3);
}

.jarvis-chat-input {
    flex: 1;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.jarvis-chat-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

[data-theme="cosmic"] .jarvis-chat-input:focus {
    border-color: #a855f7;
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
}

[data-theme="night"] .jarvis-chat-input:focus {
    border-color: #00d4ff;
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.15);
}

.jarvis-chat-send {
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-full);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: transform 0.2s, box-shadow 0.2s;
}

.jarvis-chat-send:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-glow);
}

.jarvis-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Typing indicator */
.jarvis-typing {
    display: flex;
    gap: 4px;
    padding: var(--spacing-sm) var(--spacing-md);
}

.jarvis-typing-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-primary);
    border-radius: 50%;
    animation: typingDot 1.4s infinite ease-in-out both;
}

.jarvis-typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.jarvis-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.jarvis-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDot {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Mobile: show above mobile nav bar */
@media (max-width: 768px) {
    .jarvis-chat {
        left: 16px;
        right: 16px;
        bottom: 90px;
        width: auto;
        max-width: none;
        height: 60vh;
    }
}