/* ============================================
   THE THERAPIST AI - PREMIUM MOBILE APP CSS
   Native iOS/Android feel with glassmorphism
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Brand Colors - Premium Palette */
    --color-primary: #0e2c25;
    --color-secondary: #4c9c8a;
    --color-accent: #e8e3ce;
    --color-teal-light: #5fb3a0;
    --color-teal-dark: #3d8070;

    /* Cream Palette for Warmth */
    --color-cream: #e8e3ce;
    --color-cream-light: #f5f2e8;
    --color-cream-dark: #dad5c0;

    /* Neutral Colors */
    --color-text: #1a1a1a;
    --color-text-light: #6b7280;
    --color-text-muted: #9ca3af;
    --color-background: #f8f6f1;
    --color-surface: #ffffff;
    --color-border: rgba(14, 44, 37, 0.08);

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

    /* Gradient Colors */
    --gradient-primary: linear-gradient(135deg, var(--color-secondary), var(--color-teal-light));
    --gradient-dark: linear-gradient(135deg, var(--color-primary), #1a4f43);
    --gradient-warm: linear-gradient(180deg, var(--color-cream) 0%, var(--color-background) 100%);
    --gradient-card: linear-gradient(135deg, var(--color-secondary) 0%, var(--color-primary) 100%);

    /* Glass Effect */
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-blur: blur(20px);

    /* Shadows - Softer, more elegant */
    --shadow-sm: 0 2px 8px rgba(14, 44, 37, 0.04);
    --shadow-md: 0 4px 16px rgba(14, 44, 37, 0.08);
    --shadow-lg: 0 8px 32px rgba(14, 44, 37, 0.12);
    --shadow-xl: 0 16px 48px rgba(14, 44, 37, 0.16);
    --shadow-glow: 0 4px 20px rgba(76, 156, 138, 0.25);
    --shadow-card: 0 2px 12px rgba(14, 44, 37, 0.06);

    /* Safe Area Insets */
    --sat: env(safe-area-inset-top, 0px);
    --sar: env(safe-area-inset-right, 0px);
    --sab: env(safe-area-inset-bottom, 0px);
    --sal: env(safe-area-inset-left, 0px);

    /* App Layout */
    --status-bar-height: max(20px, var(--sat));
    --bottom-nav-height: 70px;
    --safe-bottom-height: max(10px, var(--sab));
    --header-height: 60px;

    /* Border Radius - Rounded, native feel */
    --radius-xs: 8px;
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --radius-full: 100px;

    /* Transitions - Smooth, native-like */
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --transition-fast: 150ms var(--ease-smooth);
    --transition-normal: 250ms var(--ease-smooth);
    --transition-slow: 350ms var(--ease-smooth);
    --transition-spring: 400ms var(--ease-spring);
}

/* Dark Mode */
[data-theme="dark"] {
    --color-text: #f5f5f5;
    --color-text-light: #a0a0a0;
    --color-background: #0d1f1a;
    --color-surface: #152c26;
    --color-border: rgba(232, 227, 206, 0.1);
    --glass-bg: rgba(21, 44, 38, 0.9);
    --glass-border: rgba(232, 227, 206, 0.1);
    --gradient-warm: linear-gradient(180deg, #0d1f1a 0%, #0a1512 100%);
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 400;
    color: var(--color-text);
    background: var(--color-background);
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
}

.selectable,
.message-content,
.content-text {
    -webkit-user-select: text;
    user-select: text;
}

/* ============================================
   STATUS BAR - Premium Glass Effect
   ============================================ */

.status-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--status-bar-height);
    background: var(--color-primary);
    z-index: 1000;
}

/* ============================================
   APP LAYOUT
   ============================================ */

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    padding-top: var(--status-bar-height);
    background: var(--gradient-warm);
}

.content-area {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.page-container {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    scrollbar-width: none;
}

.page-container::-webkit-scrollbar {
    display: none;
}

/* ============================================
   PAGE TRANSITIONS - iOS-like
   ============================================ */

.page {
    min-height: 100%;
    opacity: 0;
    transform: translateX(20px);
    animation: pageSlideIn var(--transition-spring) forwards;
}

.page.active {
    opacity: 1;
    transform: translateX(0);
}

.page.exiting {
    animation: pageSlideOut var(--transition-normal) forwards;
}

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

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ============================================
   BOTTOM NAVIGATION - Premium Glass
   ============================================ */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--bottom-nav-height) + var(--safe-bottom-height));
    padding-bottom: var(--safe-bottom-height);
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    padding-top: 8px;
    z-index: 100;
    box-shadow: 0 -4px 24px rgba(14, 44, 37, 0.08);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 8px 4px;
    text-decoration: none;
    color: var(--color-text-light);
    transition: all var(--transition-fast);
    position: relative;
    cursor: pointer;
    min-height: 54px;
}

.nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 32px;
    height: 3px;
    background: var(--color-secondary);
    border-radius: 2px;
    transition: transform var(--transition-spring);
}

.nav-item.active::before {
    transform: translateX(-50%) scaleX(1);
}

.nav-item.active {
    color: var(--color-secondary);
}

.nav-icon {
    width: 26px;
    height: 26px;
    margin-bottom: 4px;
    transition: all var(--transition-spring);
    stroke-width: 2;
    object-fit: contain;
    filter: grayscale(0.3) opacity(0.7);
}

.nav-item.active .nav-icon {
    transform: scale(1.1) translateY(-2px);
    filter: grayscale(0) opacity(1);
}

/* ============================================
   ICON UTILITIES
   ============================================ */

.icon-sm {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.icon-md {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.icon-lg {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.icon-xl {
    width: 64px;
    height: 64px;
    object-fit: contain;
}

.nav-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.nav-item:active {
    transform: scale(0.92);
}

/* ============================================
   LOADING STATES - Premium
   ============================================ */

.page-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--color-text-light);
    gap: 16px;
}

.loader-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid var(--color-cream);
    border-top-color: var(--color-secondary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ============================================
   PREMIUM CARDS
   ============================================ */

.card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    transition: all var(--transition-normal);
}

.card:active {
    transform: scale(0.98);
    box-shadow: var(--shadow-md);
}

.card-gradient {
    background: var(--gradient-card);
    border-radius: var(--radius-xl);
    padding: 24px;
    color: white;
    box-shadow: var(--shadow-lg);
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
}

/* ============================================
   PREMIUM BUTTONS
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 16px 28px;
    border: none;
    border-radius: var(--radius-md);
    font-family: 'Nunito', sans-serif;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
    min-height: 52px;
}

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

.btn-primary:active {
    transform: scale(0.97);
    box-shadow: 0 2px 12px rgba(76, 156, 138, 0.2);
}

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

.btn-secondary:active {
    transform: scale(0.97);
    background: var(--color-cream-dark);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--color-secondary);
    color: var(--color-secondary);
}

.btn-outline:active {
    background: rgba(76, 156, 138, 0.1);
    transform: scale(0.97);
}

.btn-ghost {
    background: rgba(76, 156, 138, 0.1);
    color: var(--color-secondary);
}

.btn-ghost:active {
    background: rgba(76, 156, 138, 0.2);
    transform: scale(0.97);
}

/* Ripple effect */
.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
}

.btn:active::after {
    width: 300px;
    height: 300px;
}

/* ============================================
   PREMIUM INPUTS
   ============================================ */

.input-wrapper {
    position: relative;
}

.input {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    font-family: 'Nunito', sans-serif;
    font-size: 16px;
    color: var(--color-text);
    background: var(--color-surface);
    transition: all var(--transition-fast);
    outline: none;
}

.input:focus {
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 4px rgba(76, 156, 138, 0.12);
}

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

/* ============================================
   AVATAR STYLES
   ============================================ */

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: var(--shadow-md);
    position: relative;
}

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

.avatar-lg {
    width: 64px;
    height: 64px;
    font-size: 32px;
}

.avatar-online::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #10b981;
    border: 2px solid white;
    border-radius: 50%;
}

/* ============================================
   MOOD BUTTONS
   ============================================ */

.mood-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 14px 10px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-spring);
    backdrop-filter: blur(8px);
    flex: 1;
    min-width: 70px;
}

.mood-btn:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.35);
    border-color: rgba(255, 255, 255, 0.5);
}

.mood-btn.selected {
    background: rgba(255, 255, 255, 0.4);
    border-color: white;
    transform: scale(1.02);
}

.mood-emoji {
    font-size: 28px;
    margin-bottom: 6px;
}

.mood-label {
    font-size: 12px;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* ============================================
   QUICK ACTION CARDS
   ============================================ */

.action-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-card);
    transition: all var(--transition-spring);
    text-decoration: none;
    color: inherit;
    display: block;
}

.action-card:active {
    transform: scale(0.97);
    box-shadow: var(--shadow-md);
}

.action-icon {
    width: 52px;
    height: 52px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    box-shadow: var(--shadow-glow);
}

.action-icon svg {
    width: 26px;
    height: 26px;
    stroke: white;
    stroke-width: 2;
}

.action-icon img,
.action-icon-img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.action-card h4 {
    font-size: 16px;
    font-weight: 800;
    color: var(--color-primary);
    margin-bottom: 4px;
}

.action-card p {
    font-size: 13px;
    color: var(--color-text-light);
    line-height: 1.4;
}

/* ============================================
   MESSAGE BUBBLES - Premium Chat
   ============================================ */

.message {
    display: flex;
    gap: 10px;
    animation: fadeInUp 0.4s var(--ease-smooth);
    max-width: 85%;
}

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

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

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.message.user .message-avatar {
    background: linear-gradient(135deg, #d1d5db, #9ca3af);
}

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

.message-bubble {
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    font-size: 15px;
    line-height: 1.55;
    box-shadow: var(--shadow-sm);
}

.message.ai .message-bubble {
    background: var(--color-surface);
    color: var(--color-text);
    border-bottom-left-radius: 6px;
}

.message.user .message-bubble {
    background: var(--color-secondary);
    color: white;
    border-bottom-right-radius: 6px;
}

.message-time {
    font-size: 11px;
    color: var(--color-text-muted);
    font-weight: 600;
    padding: 0 8px;
}

.message.user .message-time {
    text-align: right;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 16px 18px;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border-bottom-left-radius: 6px;
    width: fit-content;
    box-shadow: var(--shadow-sm);
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-secondary);
    opacity: 0.4;
    animation: typingPulse 1.4s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingPulse {
    0%, 60%, 100% {
        opacity: 0.4;
        transform: scale(1);
    }
    30% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* ============================================
   QUICK REPLY BUTTONS
   ============================================ */

.quick-reply-btn {
    padding: 12px 18px;
    background: var(--color-surface);
    border: 2px solid rgba(14, 44, 37, 0.1);
    border-radius: var(--radius-full);
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-primary);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.quick-reply-btn:active {
    transform: scale(0.95);
    background: rgba(76, 156, 138, 0.1);
    border-color: var(--color-secondary);
    color: var(--color-secondary);
}

/* ============================================
   PWA INSTALL PROMPT - Premium
   ============================================ */

.install-prompt {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + var(--safe-bottom-height) + 20px);
    left: 16px;
    right: 16px;
    background: var(--color-primary);
    color: white;
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: var(--shadow-xl);
    z-index: 200;
    transition: all var(--transition-spring);
    transform: translateY(0);
}

.install-prompt.hidden {
    transform: translateY(calc(100% + 120px));
    pointer-events: none;
    opacity: 0;
}

.install-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.install-icon {
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.install-icon svg {
    width: 28px;
    height: 28px;
    stroke: white;
}

.install-text h3 {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 6px;
}

.install-text p {
    font-size: 14px;
    opacity: 0.85;
    line-height: 1.5;
}

.btn-install {
    background: white;
    color: var(--color-primary);
    padding: 14px 28px;
    border-radius: var(--radius-md);
    border: none;
    font-family: 'Nunito', sans-serif;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-install:active {
    transform: scale(0.97);
}

.btn-dismiss {
    background: transparent;
    color: white;
    padding: 8px;
    border: none;
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    opacity: 0.75;
    transition: opacity var(--transition-fast);
}

.btn-dismiss:active {
    opacity: 1;
}

/* ============================================
   OFFLINE INDICATOR
   ============================================ */

.offline-indicator {
    position: fixed;
    top: calc(var(--status-bar-height) + 12px);
    left: 50%;
    transform: translateX(-50%);
    background: #ef4444;
    color: white;
    padding: 10px 20px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 700;
    box-shadow: var(--shadow-lg);
    z-index: 300;
    transition: all var(--transition-spring);
}

.offline-indicator.hidden {
    transform: translateX(-50%) translateY(-100px);
    opacity: 0;
    pointer-events: none;
}

.offline-indicator svg {
    width: 18px;
    height: 18px;
    stroke: white;
}

/* ============================================
   SECTION STYLES
   ============================================ */

.section-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

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

.section-header h3 {
    font-size: 18px;
    font-weight: 800;
    color: var(--color-primary);
}

.section-header a {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-secondary);
    text-decoration: none;
}

/* ============================================
   ACTIVITY LIST
   ============================================ */

.activity-item {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 10px;
    transition: all var(--transition-fast);
}

.activity-item:active {
    transform: scale(0.98);
}

.activity-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-icon svg {
    width: 22px;
    height: 22px;
    stroke: white;
}

.activity-icon.bg-teal { background: var(--color-secondary); }
.activity-icon.bg-green { background: #10b981; }
.activity-icon.bg-blue { background: #3b82f6; }
.activity-icon.bg-purple { background: #8b5cf6; }
.activity-icon.bg-orange { background: #f59e0b; }

.activity-content {
    flex: 1;
}

.activity-content h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 2px;
}

.activity-content p {
    font-size: 13px;
    color: var(--color-text-light);
}

.activity-badge {
    width: 28px;
    height: 28px;
    background: var(--color-cream);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--color-secondary);
    font-weight: 700;
}

/* ============================================
   STAT CARDS
   ============================================ */

.stat-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-card);
    text-align: center;
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--color-secondary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-light);
}

/* ============================================
   SETTINGS LIST
   ============================================ */

.settings-group {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    margin-bottom: 20px;
}

.settings-item {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.settings-item:last-child {
    border-bottom: none;
}

.settings-item:active {
    background: rgba(76, 156, 138, 0.05);
}

.settings-icon {
    width: 40px;
    height: 40px;
    background: rgba(76, 156, 138, 0.1);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 14px;
}

.settings-icon svg {
    width: 20px;
    height: 20px;
    stroke: var(--color-secondary);
}

.settings-content {
    flex: 1;
}

.settings-content h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 2px;
}

.settings-content p {
    font-size: 13px;
    color: var(--color-text-light);
}

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

/* Toggle Switch */
.toggle-switch {
    width: 52px;
    height: 30px;
    background: #e5e7eb;
    border-radius: 15px;
    position: relative;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.toggle-switch.active {
    background: var(--color-secondary);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all var(--transition-fast);
}

.toggle-switch.active::after {
    transform: translateX(22px);
}

/* ============================================
   KEYBOARD HANDLING
   ============================================ */

body.keyboard-open .bottom-nav {
    transform: translateY(100%);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.hidden { display: none !important; }

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

.mb-xs { margin-bottom: 4px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 24px; }
.mb-xl { margin-bottom: 32px; }

.mt-xs { margin-top: 4px; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mt-xl { margin-top: 32px; }

.p-sm { padding: 8px; }
.p-md { padding: 16px; }
.p-lg { padding: 24px; }

.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-xs { gap: 4px; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }

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

/* Animation utilities */
.bounce-in {
    animation: bounceIn 0.5s var(--ease-spring);
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.shake {
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

/* Touch feedback */
.touchable {
    cursor: pointer;
    transition: all var(--transition-fast);
}

.touchable:active {
    transform: scale(0.97);
    opacity: 0.85;
}

/* ============================================
   BOTTOM SPACER FOR SAFE AREA
   ============================================ */

.bottom-spacer {
    height: calc(var(--bottom-nav-height) + var(--safe-bottom-height) + 20px);
}

/* ============================================
   SMOOTH SCROLLING & GPU ACCELERATION
   ============================================ */

* {
    -webkit-overflow-scrolling: touch;
}

.page,
.nav-item,
.btn,
.card,
.action-card,
.install-prompt,
.message {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* ============================================
   RESPONSIVE (though mobile-first)
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   2026 UI/UX - EMOTIONAL STATE COLORS
   ============================================ */

:root {
    --emotion-calm: rgba(76, 156, 138, 0.05);
    --emotion-anxious: rgba(237, 108, 2, 0.03);
    --emotion-sad: rgba(100, 100, 120, 0.04);
    --emotion-hopeful: rgba(255, 235, 200, 0.06);

    --mood-excellent: #4ade80;
    --mood-good: #60a5fa;
    --mood-neutral: #fbbf24;
    --mood-poor: #f87171;
    --mood-crisis: #ef4444;
}

/* ============================================
   AI AVATAR BREATHING ANIMATION
   ============================================ */

@keyframes breathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.ai-avatar-breathing {
    animation: breathe 4s ease-in-out infinite;
}

.user-is-typing .ai-avatar-breathing {
    animation-play-state: paused;
}

/* Listening state - gentle pulse */
@keyframes listening {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(76, 156, 138, 0.4);
    }
    50% {
        transform: scale(1.01);
        box-shadow: 0 0 0 8px rgba(76, 156, 138, 0);
    }
}

.ai-avatar-listening {
    animation: listening 2s ease-in-out infinite;
}

/* ============================================
   EMOTION-AWARE BACKGROUNDS
   ============================================ */

.chat-container[data-emotion-state="calm"] {
    background: linear-gradient(
        to bottom,
        var(--emotion-calm),
        transparent 60%
    );
}

.chat-container[data-emotion-state="anxious"] {
    background: linear-gradient(
        to bottom,
        var(--emotion-anxious),
        transparent 60%
    );
}

.chat-container[data-emotion-state="sad"] {
    background: linear-gradient(
        to bottom,
        var(--emotion-sad),
        transparent 60%
    );
}

.chat-container[data-emotion-state="hopeful"] {
    background: linear-gradient(
        to bottom,
        var(--emotion-hopeful),
        transparent 60%
    );
}

/* ============================================
   STRESS-ADAPTIVE TYPOGRAPHY
   ============================================ */

[data-stress-level="high"] {
    --text-base: 1.25rem;
    --leading-normal: 1.75;
    --tracking-normal: 0.01em;
}

[data-stress-level="high"] .message-bubble {
    font-size: 1.25rem;
    line-height: 1.75;
    letter-spacing: 0.01em;
}

/* ============================================
   PRIVACY MODE - BLUR FILTER
   ============================================ */

body.privacy-mode .page-content,
body.privacy-mode .messages-container,
body.privacy-mode .chat-page {
    filter: blur(12px);
    transition: filter 0.3s ease;
}

body.privacy-mode .privacy-mode-banner {
    display: flex;
}

.privacy-mode-banner {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--color-primary);
    color: white;
    padding: 24px 32px;
    border-radius: var(--radius-xl);
    z-index: 1000;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-xl);
}

.privacy-mode-banner h3 {
    font-size: 18px;
    font-weight: 700;
}

.privacy-mode-banner p {
    font-size: 14px;
    opacity: 0.9;
}

/* ============================================
   DISTRESS MODE - HIGH CONTRAST & LARGE TARGETS
   ============================================ */

[data-distress-mode="true"] {
    --color-text: #000000;
    --color-background: #ffffff;
    --color-surface: #ffffff;
}

[data-distress-mode="true"] .btn,
[data-distress-mode="true"] .touchable,
[data-distress-mode="true"] .nav-item {
    min-height: 72px;
    min-width: 72px;
}

[data-distress-mode="true"] .message-bubble {
    font-size: 1.25rem;
    line-height: 1.75;
    padding: 18px 22px;
}

[data-distress-mode="true"] * {
    animation: none !important;
    transition: none !important;
}

[data-distress-mode="true"] .bottom-nav {
    height: calc(90px + var(--safe-bottom-height));
}

[data-distress-mode="true"] .nav-icon {
    width: 32px;
    height: 32px;
}

[data-distress-mode="true"] .nav-label {
    font-size: 14px;
}

/* ============================================
   CRISIS UI - EMERGENCY BUTTONS
   ============================================ */

.crisis-button-emergency {
    min-height: 72px;
    background: var(--mood-crisis);
    color: white;
    border: 3px solid currentColor;
    font-weight: 700;
    font-size: 20px;
    border-radius: var(--radius-lg);
    padding: 20px 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.3);
    transition: transform 0.1s ease;
}

.crisis-button-emergency:active {
    transform: scale(0.98);
}

.crisis-button-secondary {
    min-height: 60px;
    background: white;
    color: var(--mood-crisis);
    border: 2px solid var(--mood-crisis);
    font-weight: 700;
    font-size: 18px;
    border-radius: var(--radius-lg);
    padding: 16px 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    cursor: pointer;
}

.crisis-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 2000;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

.crisis-screen h1 {
    font-size: 28px;
    font-weight: 800;
    color: var(--color-primary);
    text-align: center;
    margin-bottom: 8px;
}

.crisis-screen .crisis-subtitle {
    font-size: 16px;
    color: var(--color-text-light);
    text-align: center;
    margin-bottom: 24px;
}

.safety-checklist {
    background: var(--color-cream);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin: 16px 0;
}

.safety-checklist h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 16px;
}

.safety-checklist label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    font-size: 16px;
    color: var(--color-text);
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
}

.safety-checklist label:last-child {
    border-bottom: none;
}

.safety-checklist input[type="checkbox"] {
    width: 24px;
    height: 24px;
    accent-color: var(--color-secondary);
}

.crisis-return {
    background: var(--color-secondary);
    color: white;
    border: none;
    padding: 18px 24px;
    border-radius: var(--radius-lg);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    margin-top: auto;
}

/* ============================================
   12-EMOTION SELECTOR GRID
   ============================================ */

.emotion-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 16px;
}

.emotion-grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 8px;
    background: var(--color-surface);
    border: 2px solid transparent;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: transform 120ms cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: var(--shadow-sm);
}

.emotion-grid-item:active {
    transform: scale(0.92);
}

.emotion-grid-item.selected {
    border-color: var(--color-secondary);
    background: rgba(76, 156, 138, 0.1);
}

.emotion-grid-item .emotion-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.emotion-grid-item .emotion-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-text);
    text-align: center;
}

/* Emotion intensity slider */
.emotion-intensity {
    padding: 16px;
}

.emotion-intensity-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-light);
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
}

.emotion-intensity-slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right,
        var(--color-cream) 0%,
        var(--color-secondary) 100%
    );
    -webkit-appearance: none;
    appearance: none;
}

.emotion-intensity-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--color-secondary);
    border: 3px solid white;
    box-shadow: var(--shadow-md);
    cursor: pointer;
}

/* ============================================
   JOURNEY PHASES (Non-Gamification)
   ============================================ */

.journey-phases {
    display: flex;
    justify-content: space-around;
    padding: 20px 16px;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    margin: 16px 0;
}

.journey-phase {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0.5;
    transition: all 0.3s ease;
}

.journey-phase.active {
    opacity: 1;
}

.journey-phase.completed {
    opacity: 0.8;
}

.journey-phase-icon {
    font-size: 32px;
}

.journey-phase-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-text);
}

.journey-phase-connector {
    flex: 1;
    height: 2px;
    background: var(--color-border);
    margin-top: 20px;
}

.journey-phase.completed + .journey-phase-connector {
    background: var(--color-secondary);
}

/* ============================================
   MEMORY INDICATORS
   ============================================ */

.memory-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(76, 156, 138, 0.1);
    border-radius: var(--radius-full);
    font-size: 12px;
    color: var(--color-secondary);
    font-weight: 600;
}

.memory-indicator-icon {
    font-size: 14px;
}

/* ============================================
   SESSION TIMER WARNING
   ============================================ */

.session-timer-warning {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + var(--safe-bottom-height) + 20px);
    left: 16px;
    right: 16px;
    background: var(--color-warning);
    color: white;
    padding: 16px 20px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 150;
    animation: slideUp 0.3s ease;
}

.session-timer-warning.hidden {
    display: none;
}

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

.session-timer-icon {
    font-size: 24px;
}

.session-timer-content {
    flex: 1;
}

.session-timer-content h4 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 2px;
}

.session-timer-content p {
    font-size: 12px;
    opacity: 0.9;
}

.session-timer-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: white;
    font-size: 18px;
    cursor: pointer;
}

/* ============================================
   ADAPTIVE TYPING INDICATOR
   ============================================ */

.typing-indicator[data-typing-speed="calm"] .typing-dot {
    animation-duration: 1.4s;
}

.typing-indicator[data-typing-speed="anxious"] .typing-dot {
    animation-duration: 2.1s;
}

.typing-indicator[data-typing-speed="crisis"] .typing-dot {
    animation-duration: 0.7s;
}

/* ============================================
   TOOL UNLOCK CARDS (Non-Badge System)
   ============================================ */

.tool-unlock-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-card);
    margin-bottom: 12px;
}

.tool-unlock-card.locked {
    opacity: 0.6;
}

.tool-unlock-card.unlocked {
    border: 2px solid var(--color-secondary);
}

.tool-unlock-icon {
    width: 56px;
    height: 56px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.tool-unlock-card.locked .tool-unlock-icon {
    background: var(--color-cream);
    filter: grayscale(1);
}

.tool-unlock-content {
    flex: 1;
}

.tool-unlock-content h4 {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 4px;
}

.tool-unlock-content p {
    font-size: 13px;
    color: var(--color-text-light);
}

.tool-unlock-status {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-secondary);
    padding: 6px 12px;
    background: rgba(76, 156, 138, 0.1);
    border-radius: var(--radius-full);
}

.tool-unlock-card.locked .tool-unlock-status {
    color: var(--color-text-muted);
    background: var(--color-cream);
}

/* ============================================
   EMOTION GRID - 12 Emotions Selector
   ============================================ */
.emotion-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 20px;
}

.emotion-grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 8px;
    background: var(--color-cream-light);
    border: 2px solid transparent;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

.emotion-grid-item:active {
    transform: scale(0.95);
}

.emotion-grid-item.selected {
    background: rgba(76, 156, 138, 0.15);
    border-color: var(--color-secondary);
    box-shadow: var(--shadow-glow);
}

.emotion-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.emotion-name {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-primary);
    text-align: center;
}

.emotion-intensity {
    padding: 20px;
    padding-top: 0;
}

.emotion-intensity-label {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 12px;
}

.emotion-intensity-slider {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--color-cream);
    border-radius: 4px;
    outline: none;
}

.emotion-intensity-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: var(--gradient-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-md);
}

.emotion-intensity-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: var(--gradient-primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: var(--shadow-md);
}

/* ============================================
   STAT CARDS
   ============================================ */
.stat-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 20px 16px;
    text-align: center;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--color-primary);
}

.stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-light);
}

.stat-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
}


/* ====== chat page styles ====== */
        .chat-page {
            display: flex;
            flex-direction: column;
            height: 100%;
            background: var(--color-cream);
        }

        /* Chat Header */
        .chat-header {
            padding: 12px 16px;
            background: var(--color-surface);
            border-bottom: 1px solid var(--color-border);
            display: flex;
            align-items: center;
            gap: 12px;
            box-shadow: var(--shadow-sm);
        }

        .back-btn, .menu-btn {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: rgba(14, 44, 37, 0.05);
            border: none;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            flex-shrink: 0;
        }

        .back-btn svg, .menu-btn svg {
            width: 22px;
            height: 22px;
            stroke: var(--color-primary);
        }

        .btn-icon {
            width: 22px;
            height: 22px;
            object-fit: contain;
        }

        .avatar-icon {
            width: 100%;
            height: 100%;
            object-fit: cover;
            border-radius: 50%;
        }

        .message-avatar-img {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            object-fit: cover;
            flex-shrink: 0;
        }

        .crisis-icon-img {
            width: 24px;
            height: 24px;
            object-fit: contain;
        }

        .memory-icon {
            width: 14px;
            height: 14px;
            object-fit: contain;
        }

        .therapist-info {
            flex: 1;
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .therapist-avatar {
            width: 44px;
            height: 44px;
            border-radius: 50%;
            background: var(--gradient-primary);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 22px;
            position: relative;
            box-shadow: var(--shadow-md);
        }

        .online-indicator {
            position: absolute;
            bottom: 0;
            right: 0;
            width: 14px;
            height: 14px;
            background: #10b981;
            border: 3px solid white;
            border-radius: 50%;
        }

        .therapist-details h3 {
            font-size: 17px;
            font-weight: 800;
            color: var(--color-primary);
            margin-bottom: 2px;
        }

        .therapist-details p {
            font-size: 13px;
            color: var(--color-secondary);
            font-weight: 600;
        }

        /* Crisis Banner */
        .crisis-banner {
            background: linear-gradient(135deg, #fef3cd, #fde68a);
            padding: 12px 16px;
            display: flex;
            align-items: center;
            gap: 12px;
            border-bottom: 1px solid #f59e0b;
        }

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

        .crisis-text {
            flex: 1;
            font-size: 13px;
            color: #92400e;
            font-weight: 600;
        }

        .crisis-btn {
            padding: 8px 14px;
            background: #f59e0b;
            color: white;
            border: none;
            border-radius: var(--radius-sm);
            font-size: 13px;
            font-weight: 700;
            font-family: 'Nunito', sans-serif;
            cursor: pointer;
            box-shadow: 0 2px 6px rgba(245, 158, 11, 0.3);
        }

        /* Messages Container */
        .messages-container {
            flex: 1;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            padding: 20px 16px;
            display: flex;
            flex-direction: column;
            gap: 16px;
        }

        /* Quick Actions */
        .quick-actions {
            padding: 12px 16px 0;
            display: flex;
            gap: 8px;
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
            scrollbar-width: none;
        }

        .quick-actions::-webkit-scrollbar {
            display: none;
        }

        /* Input Area */
        .input-area {
            padding: 12px 16px;
            background: var(--color-surface);
            border-top: 1px solid var(--color-border);
        }

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

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

        .action-btn {
            width: 44px;
            height: 44px;
            border-radius: 50%;
            background: rgba(76, 156, 138, 0.1);
            border: none;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            flex-shrink: 0;
        }

        .action-btn svg {
            width: 22px;
            height: 22px;
            stroke: var(--color-secondary);
        }

        .message-input-wrapper {
            flex: 1;
            background: rgba(14, 44, 37, 0.05);
            border-radius: var(--radius-xl);
            padding: 12px 18px;
            display: flex;
            align-items: center;
        }

        .message-input {
            flex: 1;
            border: none;
            background: none;
            font-size: 16px;
            font-family: 'Nunito', sans-serif;
            color: var(--color-text);
            resize: none;
            outline: none;
            max-height: 100px;
            line-height: 1.4;
        }

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

        .send-btn {
            width: 48px;
            height: 48px;
            border-radius: 50%;
            background: var(--gradient-primary);
            border: none;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            flex-shrink: 0;
            box-shadow: var(--shadow-glow);
        }

        .send-btn svg {
            width: 22px;
            height: 22px;
            stroke: white;
        }

        .chat-safe-area {
            height: calc(var(--bottom-nav-height) + var(--safe-bottom-height));
            background: var(--color-surface);
        }

/* ====== crisis page styles ====== */
        .crisis-page {
            background: white;
            min-height: 100vh;
            padding-bottom: 0;
        }

        .crisis-screen {
            padding: 24px;
            padding-top: calc(24px + var(--sat, 0px));
            display: flex;
            flex-direction: column;
            min-height: 100vh;
        }

        .crisis-header {
            text-align: center;
            margin-bottom: 28px;
        }

        .crisis-header h1 {
            font-size: 28px;
            font-weight: 800;
            color: var(--color-primary);
            margin-bottom: 12px;
        }

        .crisis-subtitle {
            font-size: 16px;
            color: var(--color-text-light);
            line-height: 1.5;
        }

        /* Emergency Hotlines */
        .crisis-hotlines {
            display: flex;
            flex-direction: column;
            gap: 12px;
            margin-bottom: 24px;
        }

        .crisis-button-emergency {
            min-height: 72px;
            background: #ef4444;
            color: white;
            border: none;
            border-radius: var(--radius-lg, 16px);
            padding: 16px 20px;
            display: flex;
            align-items: center;
            gap: 16px;
            text-decoration: none;
            box-shadow: 0 4px 20px rgba(239, 68, 68, 0.3);
            transition: transform 0.1s ease;
        }

        .crisis-button-emergency:active {
            transform: scale(0.98);
        }

        .crisis-button-secondary {
            min-height: 60px;
            background: white;
            color: #ef4444;
            border: 2px solid #ef4444;
            border-radius: var(--radius-lg, 16px);
            padding: 14px 20px;
            display: flex;
            align-items: center;
            gap: 14px;
            text-decoration: none;
            transition: all 0.15s ease;
        }

        .crisis-button-secondary:active {
            background: #fef2f2;
            transform: scale(0.98);
        }

        .crisis-btn-icon {
            font-size: 28px;
            flex-shrink: 0;
        }

        .crisis-btn-icon-img {
            width: 36px;
            height: 36px;
            flex-shrink: 0;
            object-fit: contain;
        }

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

        .grounding-icon {
            width: 28px;
            height: 28px;
            object-fit: contain;
        }

        .grounding-header h4 {
            margin-bottom: 0;
        }

        .crisis-btn-text {
            display: flex;
            flex-direction: column;
            text-align: left;
        }

        .crisis-btn-text strong {
            font-size: 18px;
            font-weight: 700;
        }

        .crisis-btn-text small {
            font-size: 13px;
            opacity: 0.9;
            margin-top: 2px;
        }

        .crisis-button-secondary .crisis-btn-text strong {
            font-size: 16px;
        }

        /* Safety Checklist */
        .safety-checklist {
            background: #fef3cd;
            border-radius: var(--radius-lg, 16px);
            padding: 20px;
            margin-bottom: 20px;
        }

        .safety-checklist h3 {
            font-size: 16px;
            font-weight: 700;
            color: #92400e;
            margin-bottom: 16px;
        }

        .safety-checklist label {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 12px 0;
            font-size: 15px;
            color: #78350f;
            border-bottom: 1px solid rgba(146, 64, 14, 0.2);
            cursor: pointer;
        }

        .safety-checklist label:last-of-type {
            border-bottom: none;
            padding-bottom: 0;
        }

        .safety-checklist input[type="checkbox"] {
            width: 24px;
            height: 24px;
            accent-color: #10b981;
            flex-shrink: 0;
        }

        /* Grounding Exercise */
        .grounding-section {
            margin-bottom: 24px;
        }

        .grounding-card {
            background: rgba(76, 156, 138, 0.1);
            border: 1px solid rgba(76, 156, 138, 0.2);
            border-radius: var(--radius-lg, 16px);
            padding: 20px;
        }

        .grounding-card h4 {
            font-size: 16px;
            font-weight: 700;
            color: var(--color-secondary, #4c9c8a);
            margin-bottom: 12px;
        }

        .grounding-card p {
            font-size: 15px;
            line-height: 1.8;
            color: var(--color-text, #2D2D2D);
        }

        .grounding-card strong {
            color: var(--color-secondary, #4c9c8a);
        }

        /* Crisis Actions */
        .crisis-actions {
            margin-top: auto;
            padding-top: 20px;
        }

        .crisis-return {
            width: 100%;
            min-height: 56px;
            background: var(--color-secondary, #4c9c8a);
            color: white;
            border: none;
            border-radius: var(--radius-lg, 16px);
            font-size: 16px;
            font-weight: 700;
            font-family: 'Nunito', sans-serif;
            cursor: pointer;
            transition: all 0.15s ease;
        }

        .crisis-return:active {
            transform: scale(0.98);
            opacity: 0.9;
        }

        .crisis-note {
            font-size: 13px;
            color: var(--color-text-light, #6b7280);
            text-align: center;
            margin-top: 12px;
            line-height: 1.5;
        }

        /* Hide bottom nav on crisis page */
        .crisis-page ~ .bottom-nav,
        body:has(.crisis-page) .bottom-nav {
            display: none;
        }

/* ====== home page styles ====== */
        .home-page {
            background: var(--gradient-warm);
        }

        .page-content {
            padding: 20px;
        }

        /* Header */
        .home-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 24px;
            animation: fadeInUp 0.5s var(--ease-smooth);
        }

        .header-logo {
            flex-shrink: 0;
        }

        .app-logo {
            height: 48px;
            width: auto;
        }

        .header-right {
            display: flex;
            flex-direction: column;
            align-items: flex-end;
        }

        .greeting-time {
            font-size: 14px;
            color: var(--color-text-light);
            font-weight: 600;
        }

        .greeting-name {
            font-size: 16px;
            font-weight: 700;
            color: var(--color-primary);
            margin-top: 2px;
        }

        /* Welcome Card */
        .welcome-card {
            margin-bottom: 28px;
            text-align: center;
            animation: fadeInUp 0.5s var(--ease-smooth) 0.1s backwards;
        }

        .welcome-icon {
            font-size: 48px;
            margin-bottom: 16px;
            filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
        }

        .welcome-icon-img {
            width: 80px;
            height: 80px;
            margin-bottom: 16px;
            filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
        }

        .welcome-card h2 {
            font-size: 22px;
            font-weight: 800;
            margin-bottom: 8px;
        }

        .welcome-card > p {
            font-size: 14px;
            opacity: 0.9;
            margin-bottom: 24px;
        }

        .mood-selector {
            display: flex;
            gap: 10px;
            justify-content: center;
        }

        /* Quick Actions Section */
        .quick-actions-section {
            margin-bottom: 28px;
            animation: fadeInUp 0.5s var(--ease-smooth) 0.2s backwards;
        }

        .action-grid .action-card {
            animation: scaleIn 0.4s var(--ease-smooth) backwards;
        }

        .action-grid .action-card:nth-child(1) { animation-delay: 0.15s; }
        .action-grid .action-card:nth-child(2) { animation-delay: 0.2s; }
        .action-grid .action-card:nth-child(3) { animation-delay: 0.25s; }
        .action-grid .action-card:nth-child(4) { animation-delay: 0.3s; }

        /* Insight Section */
        .insight-section {
            margin-bottom: 28px;
            animation: fadeInUp 0.5s var(--ease-smooth) 0.3s backwards;
        }

        .insight-card {
            padding: 20px;
            display: flex;
            align-items: flex-start;
            gap: 16px;
        }

        .insight-icon {
            font-size: 32px;
            flex-shrink: 0;
        }

        .insight-icon-img {
            width: 48px;
            height: 48px;
            flex-shrink: 0;
            object-fit: contain;
        }

        .action-icon-img {
            width: 28px;
            height: 28px;
            object-fit: contain;
        }

        .activity-icon-img {
            width: 22px;
            height: 22px;
            object-fit: contain;
        }

        .activity-badge-img {
            width: 20px;
            height: 20px;
            object-fit: contain;
        }

        .insight-content h4 {
            font-size: 14px;
            font-weight: 700;
            color: var(--color-secondary);
            margin-bottom: 6px;
        }

        .insight-content p {
            font-size: 14px;
            color: var(--color-text);
            line-height: 1.5;
            font-style: italic;
        }

        /* Emotion Selector Section */
        .emotion-selector-section {
            background: var(--color-surface);
            border-radius: var(--radius-xl);
            margin-bottom: 24px;
            box-shadow: var(--shadow-card);
            animation: fadeInUp 0.5s var(--ease-smooth) 0.15s backwards;
        }

        /* Journey Section */
        .journey-section {
            margin-bottom: 24px;
            animation: fadeInUp 0.5s var(--ease-smooth) 0.25s backwards;
        }

        .journey-phases {
            display: flex;
            align-items: center;
            padding: 20px 16px;
            background: var(--color-surface);
            border-radius: var(--radius-lg);
            box-shadow: var(--shadow-card);
            overflow-x: auto;
        }

        .journey-phase {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 8px;
            min-width: 70px;
            opacity: 0.4;
            transition: all 0.3s ease;
        }

        .journey-phase.active {
            opacity: 1;
        }

        .journey-phase.completed {
            opacity: 0.7;
        }

        .journey-phase-icon {
            font-size: 28px;
        }

        .journey-phase-icon-img {
            width: 36px;
            height: 36px;
            object-fit: contain;
        }

        .journey-phase-name {
            font-size: 11px;
            font-weight: 700;
            color: var(--color-text);
            text-align: center;
        }

        .journey-phase-connector {
            flex: 1;
            height: 2px;
            min-width: 20px;
            background: var(--color-border);
            margin: 0 4px;
            margin-bottom: 24px;
        }

        .journey-phase.completed + .journey-phase-connector,
        .journey-phase.active + .journey-phase-connector {
            background: var(--color-secondary);
        }

        /* Activity Section */
        .activity-section {
            animation: fadeInUp 0.5s var(--ease-smooth) 0.4s backwards;
        }

        .activity-list .activity-item {
            animation: fadeInUp 0.4s var(--ease-smooth) backwards;
        }

        .activity-list .activity-item:nth-child(1) { animation-delay: 0.35s; }
        .activity-list .activity-item:nth-child(2) { animation-delay: 0.4s; }
        .activity-list .activity-item:nth-child(3) { animation-delay: 0.45s; }

/* ====== progress page styles ====== */
        .progress-page {
            background: var(--gradient-warm);
        }

        .page-content {
            padding: 20px;
        }

        .progress-header {
            margin-bottom: 24px;
            animation: fadeInUp 0.5s var(--ease-smooth);
        }

        .progress-header h1 {
            font-size: 28px;
            font-weight: 800;
            color: var(--color-primary);
            margin-bottom: 4px;
        }

        .header-subtitle {
            font-size: 14px;
            color: var(--color-text-light);
        }

        /* Stats Overview */
        .stats-overview {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 12px;
            margin-bottom: 24px;
            animation: fadeInUp 0.5s var(--ease-smooth) 0.1s backwards;
        }

        /* Weekly Progress */
        .weekly-progress {
            margin-bottom: 24px;
            animation: fadeInUp 0.5s var(--ease-smooth) 0.2s backwards;
        }

        .chart-card {
            padding: 20px;
        }

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

        .chart-header h3 {
            font-size: 16px;
            font-weight: 700;
            color: var(--color-primary);
        }

        .chart-badge {
            background: rgba(16, 185, 129, 0.1);
            color: #10b981;
            padding: 4px 10px;
            border-radius: 12px;
            font-size: 12px;
            font-weight: 700;
        }

        .chart-bars {
            display: flex;
            justify-content: space-between;
            align-items: flex-end;
            height: 100px;
            gap: 8px;
        }

        .chart-bar-wrapper {
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            height: 100%;
        }

        .chart-bar {
            width: 100%;
            max-width: 32px;
            background: var(--color-cream);
            border-radius: 8px 8px 4px 4px;
            transition: all var(--transition-spring);
            margin-bottom: 8px;
        }

        .chart-bar.active {
            background: var(--gradient-primary);
            box-shadow: var(--shadow-glow);
        }

        .chart-day {
            font-size: 11px;
            color: var(--color-text-light);
            font-weight: 600;
        }

        /* Mood Tracker */
        .mood-tracker {
            margin-bottom: 24px;
            animation: fadeInUp 0.5s var(--ease-smooth) 0.3s backwards;
        }

        .mood-timeline {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .mood-entry {
            background: var(--color-surface);
            border-radius: var(--radius-md);
            padding: 14px 16px;
            display: flex;
            align-items: center;
            gap: 14px;
            box-shadow: var(--shadow-sm);
            border-left: 4px solid;
        }

        .mood-entry[data-mood="excellent"] { border-left-color: #4ade80; }
        .mood-entry[data-mood="good"] { border-left-color: #60a5fa; }
        .mood-entry[data-mood="neutral"] { border-left-color: #fbbf24; }
        .mood-entry[data-mood="bad"] { border-left-color: #f87171; }

        .mood-icon {
            font-size: 28px;
        }

        .mood-icon-img {
            width: 36px;
            height: 36px;
            object-fit: contain;
        }

        .stat-icon {
            width: 32px;
            height: 32px;
            object-fit: contain;
        }

        .tool-unlock-icon-img {
            width: 40px;
            height: 40px;
            object-fit: contain;
            flex-shrink: 0;
        }

        .insight-icon-img {
            width: 48px;
            height: 48px;
            flex-shrink: 0;
            object-fit: contain;
        }

        .mood-details {
            flex: 1;
        }

        .mood-details h4 {
            font-size: 15px;
            font-weight: 700;
            color: var(--color-primary);
            margin-bottom: 2px;
        }

        .mood-details p {
            font-size: 13px;
            color: var(--color-text-light);
        }

        /* Tools Section (Non-Gamification) */
        .tools-section {
            margin-bottom: 24px;
            animation: fadeInUp 0.5s var(--ease-smooth) 0.4s backwards;
        }

        .tools-list {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        /* Goals */
        .goals-section {
            margin-bottom: 24px;
            animation: fadeInUp 0.5s var(--ease-smooth) 0.5s backwards;
        }

        .goals-list {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .goal-card {
            padding: 18px;
        }

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

        .goal-header h4 {
            font-size: 15px;
            font-weight: 700;
            color: var(--color-primary);
        }

        .goal-percentage {
            font-size: 14px;
            font-weight: 700;
            color: var(--color-secondary);
        }

        .goal-progress-bar {
            height: 8px;
            background: var(--color-cream);
            border-radius: 4px;
            overflow: hidden;
            margin-bottom: 8px;
        }

        .goal-progress-fill {
            height: 100%;
            background: var(--gradient-primary);
            border-radius: 4px;
            transition: width 0.5s var(--ease-smooth);
        }

        .goal-subtitle {
            font-size: 12px;
            color: var(--color-text-light);
        }

        /* Insight Section */
        .insight-section {
            animation: fadeInUp 0.5s var(--ease-smooth) 0.6s backwards;
        }

        .insight-card {
            padding: 20px;
            display: flex;
            gap: 16px;
        }

        .insight-icon {
            font-size: 32px;
            flex-shrink: 0;
        }

        .insight-content h4 {
            font-size: 14px;
            font-weight: 700;
            color: var(--color-secondary);
            margin-bottom: 6px;
        }

        .insight-content p {
            font-size: 14px;
            color: var(--color-text);
            line-height: 1.5;
        }

/* ====== settings page styles ====== */
        .settings-page {
            background: var(--gradient-warm);
        }

        .page-content {
            padding: 20px;
        }

        .settings-header {
            margin-bottom: 24px;
            animation: fadeInUp 0.5s var(--ease-smooth);
        }

        .settings-header h1 {
            font-size: 28px;
            font-weight: 800;
            color: var(--color-primary);
            margin-bottom: 4px;
        }

        .header-subtitle {
            font-size: 14px;
            color: var(--color-text-light);
        }

        /* Profile Section */
        .profile-section {
            margin-bottom: 28px;
            animation: fadeInUp 0.5s var(--ease-smooth) 0.1s backwards;
        }

        .profile-card {
            padding: 28px;
            text-align: center;
            background: var(--gradient-primary);
            color: white;
        }

        .profile-avatar-wrapper {
            position: relative;
            width: 90px;
            margin: 0 auto 16px;
        }

        .profile-avatar {
            width: 90px;
            height: 90px;
            background: rgba(255, 255, 255, 0.2);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
        }

        .avatar-emoji {
            font-size: 42px;
        }

        .avatar-ring {
            position: absolute;
            inset: -4px;
            border: 3px solid rgba(255, 255, 255, 0.4);
            border-radius: 50%;
            animation: pulse 2s ease-in-out infinite;
        }

        @keyframes pulse {
            0%, 100% { transform: scale(1); opacity: 1; }
            50% { transform: scale(1.05); opacity: 0.7; }
        }

        .edit-avatar-btn {
            position: absolute;
            bottom: 0;
            right: -4px;
            width: 32px;
            height: 32px;
            background: white;
            border: none;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            box-shadow: var(--shadow-md);
            font-size: 14px;
        }

        .profile-name {
            font-size: 24px;
            font-weight: 800;
            margin-bottom: 4px;
        }

        .profile-email {
            font-size: 14px;
            opacity: 0.9;
            margin-bottom: 20px;
        }

        .profile-stats {
            display: flex;
            justify-content: center;
            gap: 24px;
            margin-bottom: 20px;
            padding: 16px 0;
            border-top: 1px solid rgba(255, 255, 255, 0.2);
            border-bottom: 1px solid rgba(255, 255, 255, 0.2);
        }

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

        .stat-value {
            display: block;
            font-size: 22px;
            font-weight: 800;
        }

        .stat-label {
            font-size: 12px;
            opacity: 0.8;
        }

        .edit-profile-btn {
            background: rgba(255, 255, 255, 0.2);
            border: 2px solid rgba(255, 255, 255, 0.3);
            color: white;
            padding: 12px 28px;
            border-radius: var(--radius-lg);
            font-family: 'Nunito', sans-serif;
            font-size: 14px;
            font-weight: 700;
            cursor: pointer;
            transition: all var(--transition-fast);
            backdrop-filter: blur(10px);
        }

        .edit-profile-btn:active {
            background: rgba(255, 255, 255, 0.3);
            transform: scale(0.97);
        }

        /* Settings Groups */
        .settings-groups {
            display: flex;
            flex-direction: column;
            gap: 24px;
        }

        .settings-group {
            animation: fadeInUp 0.5s var(--ease-smooth) backwards;
        }

        .settings-group:nth-child(1) { animation-delay: 0.15s; }
        .settings-group:nth-child(2) { animation-delay: 0.2s; }
        .settings-group:nth-child(3) { animation-delay: 0.25s; }
        .settings-group:nth-child(4) { animation-delay: 0.3s; }
        .settings-group:nth-child(5) { animation-delay: 0.35s; }

        .group-title {
            font-size: 13px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            color: var(--color-text-light);
            margin-bottom: 12px;
            padding-left: 4px;
        }

        .settings-list {
            border-radius: var(--radius-lg);
            overflow: hidden;
            padding: 0;
        }

        .setting-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 14px 16px;
            border-bottom: 1px solid var(--color-border);
            transition: all var(--transition-fast);
        }

        .setting-item:last-child {
            border-bottom: none;
        }

        .setting-item.clickable:active {
            background: var(--color-cream);
        }

        .setting-info {
            display: flex;
            align-items: center;
            gap: 14px;
            flex: 1;
        }

        .setting-icon {
            width: 42px;
            height: 42px;
            border-radius: var(--radius-md);
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            font-size: 20px;
            box-shadow: var(--shadow-sm);
        }

        .setting-text h4 {
            font-size: 15px;
            font-weight: 700;
            color: var(--color-primary);
            margin-bottom: 2px;
        }

        .setting-text p {
            font-size: 12px;
            color: var(--color-text-light);
        }

        .setting-arrow {
            font-size: 22px;
            color: var(--color-text-muted);
            font-weight: 300;
        }

        .version-badge {
            background: var(--color-secondary);
            color: white;
            font-size: 11px;
            font-weight: 700;
            padding: 4px 10px;
            border-radius: 10px;
        }

        /* Toggle Switch */
        .toggle-switch {
            position: relative;
            display: inline-block;
            width: 52px;
            height: 30px;
            flex-shrink: 0;
        }

        .toggle-switch input {
            opacity: 0;
            width: 0;
            height: 0;
        }

        .toggle-slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: var(--color-border);
            transition: all 0.3s var(--ease-smooth);
            border-radius: 30px;
        }

        .toggle-slider:before {
            position: absolute;
            content: "";
            height: 24px;
            width: 24px;
            left: 3px;
            bottom: 3px;
            background: white;
            transition: all 0.3s var(--ease-spring);
            border-radius: 50%;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
        }

        .toggle-switch input:checked + .toggle-slider {
            background: var(--color-secondary);
        }

        .toggle-switch input:checked + .toggle-slider:before {
            transform: translateX(22px);
        }

        /* Logout Section */
        .logout-section {
            margin-top: 32px;
            animation: fadeInUp 0.5s var(--ease-smooth) 0.4s backwards;
        }

        .logout-btn {
            width: 100%;
            background: white;
            border: 2px solid #ef4444;
            color: #ef4444;
            padding: 14px 24px;
            border-radius: var(--radius-lg);
            font-family: 'Nunito', sans-serif;
            font-size: 16px;
            font-weight: 700;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            transition: all var(--transition-fast);
            box-shadow: var(--shadow-sm);
        }

        .logout-btn span {
            font-size: 20px;
        }

        .logout-btn:active {
            background: #fef2f2;
            transform: scale(0.98);
        }

        /* App Info */
        .app-info {
            text-align: center;
            padding: 32px 20px;
            animation: fadeInUp 0.5s var(--ease-smooth) 0.45s backwards;
        }

        .app-logo {
            font-size: 40px;
            margin-bottom: 8px;
        }

        .app-logo-img {
            width: 64px;
            height: 64px;
            margin-bottom: 8px;
            object-fit: contain;
        }

        .avatar-img {
            width: 100%;
            height: 100%;
            object-fit: contain;
        }

        .edit-icon {
            width: 14px;
            height: 14px;
            object-fit: contain;
        }

        .setting-icon-img {
            width: 24px;
            height: 24px;
            object-fit: contain;
        }

        .app-name {
            font-size: 16px;
            font-weight: 800;
            color: var(--color-primary);
            margin-bottom: 4px;
        }

        .app-tagline {
            font-size: 13px;
            color: var(--color-text-light);
        }

        .bottom-spacer {
            height: calc(var(--bottom-nav-height) + 20px);
        }

/* Safe Area Bottom */
.safe-area-bottom {
    height: var(--sab, 0px);
    min-height: env(safe-area-inset-bottom, 0px);
}

/* ============================================
   HOME PAGE HEADER - Logo and Greeting
   ============================================ */
.home-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.header-logo {
    flex-shrink: 0;
}

.header-logo .app-logo {
    height: 40px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
}

.header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.greeting-time {
    font-size: 13px;
    color: var(--color-text-light);
    font-weight: 600;
}

.greeting-name {
    font-size: 18px;
    font-weight: 800;
    color: var(--color-primary);
}

/* ============================================
   BOTTOM NAVIGATION - Hidden (using burger menu instead)
   ============================================ */
.bottom-nav {
    display: none !important;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 16px;
    text-decoration: none;
    color: var(--color-text-muted, #9ca3af);
    transition: all 0.2s ease;
    border-radius: 12px;
    min-width: 64px;
}

.nav-item.active {
    color: var(--color-secondary, #4c9c8a);
}

.nav-item:active {
    transform: scale(0.95);
    background: rgba(76, 156, 138, 0.1);
}

.nav-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    opacity: 0.6;
    transition: all 0.2s ease;
}

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

.nav-label {
    font-size: 11px;
    font-weight: 600;
    text-align: center;
}

/* ============================================
   APP CONTAINER & LAYOUT - Critical Styles
   ============================================ */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--color-background, #f8f6f1);
}

.content-area {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.page-container {
    min-height: 100%;
}

.page {
    min-height: 100%;
}

/* Status Bar */
.status-bar {
    height: env(safe-area-inset-top, 0px);
    background: var(--color-primary, #0e2c25);
}

/* Page Loader */
.page-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    gap: 16px;
    color: var(--color-text-light, #6b7280);
}

.loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-cream, #e8e3ce);
    border-top-color: var(--color-secondary, #4c9c8a);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Install Prompt */
.install-prompt {
    position: fixed;
    bottom: calc(var(--bottom-nav-height, 70px) + 20px + env(safe-area-inset-bottom, 0px));
    left: 16px;
    right: 16px;
    background: var(--color-surface, #ffffff);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.install-prompt.hidden {
    display: none;
}

.install-icon {
    width: 48px;
    height: 48px;
    background: var(--gradient-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.install-icon svg {
    width: 24px;
    height: 24px;
    stroke: white;
}

.install-text {
    flex: 1;
    min-width: 150px;
}

.install-text h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-primary, #0e2c25);
    margin-bottom: 2px;
}

.install-text p {
    font-size: 13px;
    color: var(--color-text-light, #6b7280);
}

.btn-install {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 700;
    font-family: 'Nunito', sans-serif;
    cursor: pointer;
}

.btn-dismiss {
    background: none;
    border: none;
    color: var(--color-text-muted, #9ca3af);
    font-size: 13px;
    font-weight: 600;
    font-family: 'Nunito', sans-serif;
    cursor: pointer;
    padding: 8px;
}

/* Offline Indicator */
.offline-indicator {
    position: fixed;
    top: env(safe-area-inset-top, 20px);
    left: 50%;
    transform: translateX(-50%);
    background: #ef4444;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1002;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.offline-indicator.hidden {
    display: none;
}

.offline-indicator svg {
    width: 16px;
    height: 16px;
}

/* Hidden utility */
.hidden {
    display: none !important;
}

/* ============================================
   ALL IMG ICONS - Force size constraints
   ============================================ */
img.nav-icon,
img.emotion-icon,
img.action-icon-img,
img.activity-icon-img,
img.activity-badge-img,
img.insight-icon-img,
img.journey-phase-icon-img,
img.welcome-icon-img,
img.mood-icon-img,
img.tool-unlock-icon-img,
img.stat-icon,
img.crisis-icon-img,
img.crisis-btn-icon-img,
img.grounding-icon,
img.btn-icon,
img.avatar-icon,
img.avatar-img,
img.message-avatar-img,
img.memory-icon,
img.setting-icon-img,
img.edit-icon,
img.app-logo,
img.app-logo-img {
    max-width: 100%;
    height: auto;
}

img {
    max-width: 100%;
    height: auto;
}

