/* =============================================================================
   THE BREAD THERAPIST COLLECTIVE - PROGRESSIVE WEB APP STYLES
   Mobile-First Responsive Design with Accessibility Focus
   ============================================================================= */

/* -----------------------------------------------------------------------------
   CSS Variables - Design Tokens
   ----------------------------------------------------------------------------- */
:root {
    /* Color Palette - Warm Toast Theme */
    --color-primary: #c89350;
    --color-primary-dark: #a67840;
    --color-primary-light: #d4a574;
    
    --color-secondary: #8b6f47;
    --color-accent: #f4d4a0;
    
    --color-bg-main: #f5f0e8;
    --color-bg-card: #ffffff;
    --color-bg-input: #faf8f5;
    --color-bg-hover: #f9f5ef;
    
    --color-text-primary: #2d2416;
    --color-text-secondary: #5a4a35;
    --color-text-tertiary: #8b7b6a;
    --color-text-inverse: #ffffff;
    
    --color-border: rgba(212, 165, 116, 0.3);
    --color-border-focus: #c89350;
    
    --color-success: #10b981;
    --color-error: #ef4444;
    --color-warning: #f59e0b;
    --color-info: #3b82f6;
    
    /* Typography Scale */
    --font-family-base: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --font-family-display: Georgia, 'Times New Roman', serif;
    
    --font-size-xs: 0.75rem;      /* 12px */
    --font-size-sm: 0.875rem;     /* 14px */
    --font-size-base: 1rem;       /* 16px */
    --font-size-lg: 1.125rem;     /* 18px */
    --font-size-xl: 1.25rem;      /* 20px */
    --font-size-2xl: 1.5rem;      /* 24px */
    --font-size-3xl: 1.875rem;    /* 30px */
    --font-size-4xl: 2.25rem;     /* 36px */
    
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    
    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;
    
    /* Spacing Scale */
    --space-1: 0.25rem;   /* 4px */
    --space-2: 0.5rem;    /* 8px */
    --space-3: 0.75rem;   /* 12px */
    --space-4: 1rem;      /* 16px */
    --space-5: 1.25rem;   /* 20px */
    --space-6: 1.5rem;    /* 24px */
    --space-8: 2rem;      /* 32px */
    --space-10: 2.5rem;   /* 40px */
    --space-12: 3rem;     /* 48px */
    --space-16: 4rem;     /* 64px */
    
    /* Layout */
    --max-width-content: 1200px;
    --max-width-reading: 720px;
    --header-height: 64px;
    --chat-input-height: 80px;
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-base: 250ms ease-in-out;
    --transition-slow: 350ms ease-in-out;
    
    /* Z-Index Layers */
    --z-base: 1;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-modal: 400;
    --z-toast: 500;
    --z-tooltip: 600;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-size-adjust: 100%;
}

body {
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
    color: var(--color-text-primary);
    background-color: var(--color-bg-main);
    background-image:
        radial-gradient(circle at 20% 30%, rgba(244, 212, 160, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(232, 190, 140, 0.25) 0%, transparent 50%);
    min-height: 100vh;
    overflow-x: hidden;
}

/* -----------------------------------------------------------------------------
   Typography
   ----------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family-display);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
    color: var(--color-text-primary);
    margin-bottom: var(--space-4);
}

h1 { font-size: var(--font-size-4xl); }
h2 { font-size: var(--font-size-3xl); }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); }
h5 { font-size: var(--font-size-lg); }
h6 { font-size: var(--font-size-base); }

p {
    margin-bottom: var(--space-4);
}

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

a:hover {
    color: var(--color-primary-dark);
}

a:focus-visible {
    outline: 2px solid var(--color-border-focus);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* -----------------------------------------------------------------------------
   App Container
   ----------------------------------------------------------------------------- */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 100vw;
    overflow-x: hidden;
}

/* -----------------------------------------------------------------------------
   Header Navigation
   ----------------------------------------------------------------------------- */
.app-header {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    background-color: var(--color-bg-card);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4);
    max-width: var(--max-width-content);
    margin: 0 auto;
    height: var(--header-height);
}

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

.logo-icon {
    font-size: var(--font-size-2xl);
}

.logo-text {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    margin: 0;
}

/* Mobile: Hide text, show only icon */
@media (max-width: 640px) {
    .logo-text {
        display: none;
    }
}

.header-nav {
    display: flex;
    gap: var(--space-2);
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-3);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    min-width: 60px;
}

.nav-btn:hover {
    background-color: var(--color-bg-hover);
    color: var(--color-primary);
}

.nav-btn:focus-visible {
    outline: 2px solid var(--color-border-focus);
    outline-offset: 2px;
}

.nav-btn.active {
    color: var(--color-primary);
    background-color: var(--color-accent);
}

.nav-icon {
    font-size: var(--font-size-xl);
}

.nav-label {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
}

/* Mobile: Hide labels */
@media (max-width: 640px) {
    .nav-label {
        display: none;
    }
    .nav-btn {
        min-width: 44px; /* WCAG touch target minimum */
    }
}

/* -----------------------------------------------------------------------------
   Main Content
   ----------------------------------------------------------------------------- */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: var(--space-6) var(--space-4);
    max-width: var(--max-width-content);
    margin: 0 auto;
    width: 100%;
}

@media (max-width: 640px) {
    .app-main {
        padding: var(--space-4) var(--space-3);
    }
}

/* Screen Management */
.screen {
    display: none;
    animation: fadeIn var(--transition-base);
}

.screen.active {
    display: block;
}

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

/* -----------------------------------------------------------------------------
   Authentication Screen
   ----------------------------------------------------------------------------- */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - var(--header-height) - var(--space-12));
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background-color: var(--color-bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    box-shadow: var(--shadow-lg);
}

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

.auth-icon {
    font-size: 4rem;
    margin-bottom: var(--space-4);
}

.auth-title {
    font-size: var(--font-size-3xl);
    margin-bottom: var(--space-2);
}

.auth-subtitle {
    font-size: var(--font-size-base);
    color: var(--color-text-secondary);
    margin-bottom: 0;
}

.auth-tabs {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-6);
    border-bottom: 2px solid var(--color-border);
}

.tab-btn {
    flex: 1;
    padding: var(--space-3) var(--space-4);
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--color-text-secondary);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: var(--color-primary);
}

.tab-btn.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

/* -----------------------------------------------------------------------------
   Form Elements
   ----------------------------------------------------------------------------- */
.form-group {
    margin-bottom: var(--space-5);
}

label {
    display: block;
    margin-bottom: var(--space-2);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-size: var(--font-size-base);
    font-family: var(--font-family-base);
    color: var(--color-text-primary);
    background-color: var(--color-bg-input);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
    border-color: var(--color-primary-light);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-border-focus);
    background-color: var(--color-bg-card);
    box-shadow: 0 0 0 3px rgba(200, 147, 80, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--color-text-tertiary);
}

/* -----------------------------------------------------------------------------
   Buttons
   ----------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    font-family: var(--font-family-base);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    min-height: 44px; /* WCAG touch target */
}

.btn:focus-visible {
    outline: 2px solid var(--color-border-focus);
    outline-offset: 2px;
}

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

.btn-primary {
    background-color: var(--color-primary);
    color: var(--color-text-inverse);
}

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

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

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

.btn-secondary:hover:not(:disabled) {
    background-color: var(--color-primary);
    color: var(--color-text-inverse);
}

.btn-danger {
    background-color: var(--color-error);
    color: var(--color-text-inverse);
}

.btn-danger:hover:not(:disabled) {
    background-color: #dc2626;
}

.btn-large {
    padding: var(--space-4) var(--space-8);
    font-size: var(--font-size-lg);
}

.btn-icon {
    padding: var(--space-2);
    min-width: 44px;
    min-height: 44px;
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    font-size: var(--font-size-2xl);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

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

/* -----------------------------------------------------------------------------
   Intake Assessment
   ----------------------------------------------------------------------------- */
.intake-container {
    max-width: 720px;
    margin: 0 auto;
}

.intake-card {
    background-color: var(--color-bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    box-shadow: var(--shadow-lg);
}

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

.intake-header h2 {
    margin-bottom: var(--space-2);
}

.intake-header p {
    color: var(--color-text-secondary);
    margin-bottom: var(--space-6);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--color-bg-input);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: var(--space-3);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary-light), var(--color-primary));
    border-radius: var(--radius-full);
    transition: width var(--transition-base);
}

.progress-text {
    font-size: var(--font-size-sm);
    color: var(--color-text-tertiary);
    text-align: center;
    margin: 0;
}

.intake-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.intake-question {
    animation: slideIn var(--transition-base);
}

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

.question-text {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--space-4);
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.option-label {
    display: flex;
    align-items: center;
    padding: var(--space-4);
    background-color: var(--color-bg-input);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.option-label:hover {
    border-color: var(--color-primary-light);
    background-color: var(--color-bg-card);
}

.option-label input[type="radio"] {
    margin-right: var(--space-3);
    min-width: 20px;
    min-height: 20px;
}

.option-label input[type="radio"]:checked + span {
    font-weight: var(--font-weight-semibold);
}

.option-label:has(input:checked) {
    border-color: var(--color-primary);
    background-color: rgba(200, 147, 80, 0.1);
}

.intake-nav {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
    margin-top: var(--space-6);
}

/* -----------------------------------------------------------------------------
   Therapist Selection
   ----------------------------------------------------------------------------- */
.therapist-container {
    max-width: 100%;
}

.section-title {
    text-align: center;
    margin-bottom: var(--space-2);
}

.section-subtitle {
    text-align: center;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-8);
}

.recommended-section {
    margin-bottom: var(--space-8);
    padding: var(--space-6);
    background: linear-gradient(135deg, rgba(200, 147, 80, 0.1), rgba(212, 165, 116, 0.1));
    border-radius: var(--radius-xl);
    border: 2px solid var(--color-primary-light);
}

.recommended-title {
    text-align: center;
    color: var(--color-primary);
    margin-bottom: var(--space-4);
}

.recommended-note {
    text-align: center;
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin-top: var(--space-4);
    margin-bottom: 0;
}

.therapist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-6);
}

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

.therapist-card {
    background-color: var(--color-bg-card);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    transition: all var(--transition-base);
    cursor: pointer;
}

.therapist-card:hover {
    border-color: var(--color-primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.therapist-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.therapist-emoji {
    font-size: 3rem;
}

.therapist-card-info h3 {
    font-size: var(--font-size-xl);
    margin-bottom: var(--space-1);
}

.therapist-approach {
    font-size: var(--font-size-sm);
    color: var(--color-primary);
    font-weight: var(--font-weight-semibold);
    margin: 0;
}

.therapist-description {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    line-height: var(--line-height-relaxed);
    margin-bottom: var(--space-4);
}

.therapist-personality {
    font-size: var(--font-size-sm);
    color: var(--color-text-tertiary);
    font-style: italic;
    margin-bottom: var(--space-4);
}

.therapist-select-btn {
    width: 100%;
}

/* -----------------------------------------------------------------------------
   Chat Screen
   ----------------------------------------------------------------------------- */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height) - var(--space-12));
    max-width: var(--max-width-reading);
    margin: 0 auto;
    width: 100%;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4);
    background-color: var(--color-bg-card);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border: 2px solid var(--color-border);
    border-bottom: none;
}

.chat-therapist-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.chat-therapist-info .therapist-emoji {
    font-size: var(--font-size-3xl);
}

.chat-therapist-info .therapist-name {
    font-size: var(--font-size-lg);
    margin: 0;
}

.chat-therapist-info .therapist-approach {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin: 0;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-6);
    background-color: var(--color-bg-card);
    border-left: 2px solid var(--color-border);
    border-right: 2px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.welcome-message {
    text-align: center;
    padding: var(--space-12) var(--space-4);
    color: var(--color-text-secondary);
}

.welcome-icon {
    font-size: 4rem;
    margin-bottom: var(--space-4);
}

.welcome-message p {
    margin-bottom: var(--space-2);
}

.welcome-subtitle {
    font-size: var(--font-size-sm);
    color: var(--color-text-tertiary);
}

/* Message wrapper for layout */
.message-wrapper {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    max-width: 75%;
    transition: opacity var(--transition-base), transform var(--transition-base);
}

.message-wrapper.therapist-wrapper {
    align-self: flex-start;
}

.message-wrapper.user-wrapper {
    align-self: flex-end;
}

/* Sender label above message */
.message-sender {
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--color-text-secondary);
    padding: 0 var(--space-3);
}

.user-wrapper .message-sender {
    text-align: right;
    color: var(--color-primary);
}

.therapist-wrapper .message-sender {
    text-align: left;
}

/* Message bubble */
.message-bubble {
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    word-wrap: break-word;
}

.therapist-message {
    background-color: var(--color-bg-input);
    border-bottom-left-radius: var(--space-2);
}

.user-message {
    background-color: var(--color-primary);
    color: var(--color-text-inverse);
    border-bottom-right-radius: var(--space-2);
}

.message-content {
    line-height: var(--line-height-relaxed);
    margin-bottom: var(--space-2);
}

.message-time {
    font-size: var(--font-size-xs);
    color: var(--color-text-tertiary);
    display: block;
}

.user-message .message-time {
    color: rgba(255, 255, 255, 0.7);
    text-align: right;
}

.therapist-message .message-time {
    text-align: left;
}

/* Typing indicator */
.typing-dots {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-2) 0;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background-color: var(--color-text-tertiary);
    border-radius: var(--radius-full);
    animation: typingBounce 1.4s infinite;
}

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

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

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* Legacy message styles - keeping for compatibility */
.message {
    display: flex;
    gap: var(--space-3);
    animation: messageSlide var(--transition-base);
}

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

.chat-input-container {
    padding: var(--space-4);
    background-color: var(--color-bg-card);
    border: 2px solid var(--color-border);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.chat-form {
    display: flex;
    gap: var(--space-3);
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    padding: var(--space-3) var(--space-4);
    font-size: var(--font-size-base);
    font-family: var(--font-family-base);
    color: var(--color-text-primary);
    background-color: var(--color-bg-input);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    resize: none;
    max-height: 120px;
    transition: all var(--transition-fast);
}

.chat-input:focus {
    outline: none;
    border-color: var(--color-border-focus);
    box-shadow: 0 0 0 3px rgba(200, 147, 80, 0.1);
}

.chat-send-btn {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background-color: var(--color-primary);
    color: var(--color-text-inverse);
    border: none;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xl);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-send-btn:hover:not(:disabled) {
    background-color: var(--color-primary-dark);
    transform: scale(1.05);
}

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

/* -----------------------------------------------------------------------------
   History Screen
   ----------------------------------------------------------------------------- */
.history-container {
    max-width: var(--max-width-reading);
    margin: 0 auto;
}

.history-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-8);
}

.stat-card {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-6);
    background-color: var(--color-bg-card);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
}

.stat-icon {
    font-size: var(--font-size-4xl);
}

.stat-value {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-primary);
    margin: 0;
}

.stat-label {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin: 0;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.history-card {
    padding: var(--space-6);
    background-color: var(--color-bg-card);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.history-card:hover {
    border-color: var(--color-primary-light);
    box-shadow: var(--shadow-md);
}

.history-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: var(--space-3);
}

.history-card-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    margin: 0;
}

.history-card-date {
    font-size: var(--font-size-sm);
    color: var(--color-text-tertiary);
}

.history-card-meta {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
}

/* -----------------------------------------------------------------------------
   Profile Screen
   ----------------------------------------------------------------------------- */
.profile-container {
    max-width: var(--max-width-reading);
    margin: 0 auto;
}

.profile-header {
    text-align: center;
    padding: var(--space-8);
    background-color: var(--color-bg-card);
    border-radius: var(--radius-xl);
    margin-bottom: var(--space-6);
}

.profile-avatar {
    width: 100px;
    height: 100px;
    margin: 0 auto var(--space-4);
    background-color: var(--color-primary-light);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
}

.profile-name {
    margin-bottom: var(--space-2);
}

.profile-since {
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
    margin: 0;
}

.profile-section {
    background-color: var(--color-bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
}

.profile-section-title {
    font-size: var(--font-size-xl);
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 2px solid var(--color-border);
}

.goals-container,
.notes-container {
    min-height: 100px;
}

.goal-item,
.note-item {
    padding: var(--space-4);
    background-color: var(--color-bg-input);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-3);
}

.empty-state-text {
    text-align: center;
    color: var(--color-text-tertiary);
    font-style: italic;
    padding: var(--space-6);
}

.settings-group {
    margin-bottom: var(--space-4);
}

/* -----------------------------------------------------------------------------
   Toast Notifications
   ----------------------------------------------------------------------------- */
.toast-container {
    position: fixed;
    top: calc(var(--header-height) + var(--space-4));
    right: var(--space-4);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    max-width: 400px;
}

@media (max-width: 640px) {
    .toast-container {
        left: var(--space-4);
        right: var(--space-4);
        max-width: none;
    }
}

.toast {
    padding: var(--space-4) var(--space-5);
    background-color: var(--color-bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    border-left: 4px solid var(--color-primary);
    animation: toastSlide var(--transition-base);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

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

.toast.success {
    border-left-color: var(--color-success);
}

.toast.error {
    border-left-color: var(--color-error);
}

.toast.warning {
    border-left-color: var(--color-warning);
}

.toast.info {
    border-left-color: var(--color-info);
}

.toast-icon {
    font-size: var(--font-size-2xl);
}

.toast-message {
    flex: 1;
    margin: 0;
}

.toast-close {
    background: transparent;
    border: none;
    font-size: var(--font-size-xl);
    color: var(--color-text-tertiary);
    cursor: pointer;
    padding: var(--space-1);
}

/* -----------------------------------------------------------------------------
   Loading States
   ----------------------------------------------------------------------------- */
.loading-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: var(--space-4);
    z-index: var(--z-modal);
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--color-primary);
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
}

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

.loading-overlay p {
    color: white;
    font-size: var(--font-size-lg);
    margin: 0;
}

/* -----------------------------------------------------------------------------
   Offline Indicator
   ----------------------------------------------------------------------------- */
.offline-indicator {
    position: fixed;
    bottom: var(--space-4);
    left: 50%;
    transform: translateX(-50%);
    padding: var(--space-3) var(--space-6);
    background-color: var(--color-text-primary);
    color: white;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-xl);
    display: none;
    align-items: center;
    gap: var(--space-2);
    z-index: var(--z-toast);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
}

.offline-indicator.active {
    display: flex;
}

/* -----------------------------------------------------------------------------
   Utility Classes
   ----------------------------------------------------------------------------- */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

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

.mt-4 { margin-top: var(--space-4); }
.mb-4 { margin-bottom: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-6 { margin-bottom: var(--space-6); }

/* -----------------------------------------------------------------------------
   Print Styles
   ----------------------------------------------------------------------------- */
@media print {
    .app-header,
    .header-nav,
    .chat-input-container,
    .btn,
    .toast-container,
    .loading-overlay {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    .chat-messages {
        border: none;
    }
}

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

/* -----------------------------------------------------------------------------
   High Contrast Mode Support
   ----------------------------------------------------------------------------- */
@media (prefers-contrast: high) {
    :root {
        --color-border: #000;
        --color-text-secondary: #000;
    }
    
    .btn {
        border-width: 3px;
    }
}

/* -----------------------------------------------------------------------------
   Dark Mode Support (Future Enhancement)
   ----------------------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
    /* Dark mode variables can be added here in future iterations */
}
