/* ============================================
   NutriScan AI - Design System
   ============================================ */

/* CSS Variables - Light Mode (Default) */
:root {
    /* Primary Colors - Chlorophyll Palette */
    --color-primary: #2D6A1E;
    --color-primary-light: #B8F369;
    --color-primary-dark: #0A1F02;
    --color-accent: #4CAF50;
    
    /* Background Colors */
    --color-bg: #F0FFF0;
    --color-bg-secondary: #FFFFFF;
    --color-bg-tertiary: #E8F5E9;
    --color-surface: rgba(255, 255, 255, 0.85);
    
    /* Text Colors */
    --color-text: #1A1A1A;
    --color-text-secondary: #4A5568;
    --color-text-muted: #718096;
    
    /* Status Colors */
    --color-success: #22C55E;
    --color-warning: #F59E0B;
    --color-danger: #EF4444;
    --color-info: #3B82F6;
    
    /* Rating Colors */
    --rating-excellent: #22C55E;
    --rating-good: #84CC16;
    --rating-moderate: #F59E0B;
    --rating-poor: #F97316;
    --rating-avoid: #EF4444;
    
    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    
    /* Typography */
    --font-display: 'DM Serif Display', serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
    
    /* Safe area for mobile */
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Dark Mode */
[data-theme="dark"] {
    --color-bg: #0A1F02;
    --color-bg-secondary: #1A2F12;
    --color-bg-tertiary: #0D2818;
    --color-surface: rgba(26, 47, 18, 0.85);
    
    --color-text: #F0FFF0;
    --color-text-secondary: #B8F369;
    --color-text-muted: #7CB342;
    
    --glass-bg: rgba(26, 47, 18, 0.75);
    --glass-border: rgba(184, 243, 105, 0.1);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* ============================================
   Base Styles
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

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

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

#app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
    background: var(--color-bg);
}

/* ============================================
   Screen Management
   ============================================ */

.screen {
    display: none;
    min-height: 100vh;
    padding-bottom: 100px;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: block;
}

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

/* ============================================
   Header Styles
   ============================================ */

.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    padding: var(--space-md) var(--space-lg);
}

.app-header.compact {
    padding: var(--space-sm) var(--space-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

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

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.logo-icon svg {
    width: 20px;
    height: 20px;
}

.logo-text {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
}

.header-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text);
}

.header-spacer {
    width: 40px;
}

/* ============================================
   Icon Buttons
   ============================================ */

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    border: none;
    background: var(--color-bg-tertiary);
    color: var(--color-text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.icon-btn svg {
    width: 20px;
    height: 20px;
}

.back-btn {
    background: transparent;
}

/* ============================================
   Main Content
   ============================================ */

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

/* ============================================
   Hero Section
   ============================================ */

.hero-section {
    text-align: center;
    padding: var(--space-2xl) var(--space-md);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    border-radius: var(--radius-xl);
    margin-bottom: var(--space-xl);
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(184, 243, 105, 0.2) 0%, transparent 70%);
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

.hero-title {
    font-family: var(--font-display);
    font-size: 2rem;
    color: white;
    margin-bottom: var(--space-sm);
    position: relative;
    z-index: 1;
}

.hero-subtitle {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95rem;
    margin-bottom: var(--space-xl);
    position: relative;
    z-index: 1;
}

.scan-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    background: white;
    border: none;
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-primary);
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    z-index: 1;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.scan-cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.scan-icon {
    width: 24px;
    height: 24px;
}

/* ============================================
   Quick Stats
   ============================================ */

.quick-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.stat-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    text-align: center;
    box-shadow: var(--glass-shadow);
}

.stat-value {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: var(--space-xs);
}

/* ============================================
   Section Headers
   ============================================ */

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

.section-header h2 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text);
}

.text-btn {
    background: none;
    border: none;
    color: var(--color-primary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

/* ============================================
   Recent Scans
   ============================================ */

.recent-scans {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.product-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    display: flex;
    gap: var(--space-md);
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--glass-shadow);
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

.product-image {
    width: 80px;
    height: 80px;
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-placeholder {
    font-size: 2rem;
}

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

.product-name {
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: var(--space-xs);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-brand {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-sm);
}

.product-meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.health-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.health-badge.excellent {
    background: rgba(34, 197, 94, 0.15);
    color: var(--rating-excellent);
}

.health-badge.good {
    background: rgba(132, 204, 22, 0.15);
    color: var(--rating-good);
}

.health-badge.moderate {
    background: rgba(245, 158, 11, 0.15);
    color: var(--rating-moderate);
}

.health-badge.poor {
    background: rgba(249, 115, 22, 0.15);
    color: var(--rating-poor);
}

.product-time {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

/* ============================================
   Insights Card
   ============================================ */

.insights-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    box-shadow: var(--glass-shadow);
}

.insight-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--glass-border);
}

.insight-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.insight-item:first-child {
    padding-top: 0;
}

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

.insight-icon.good {
    background: rgba(34, 197, 94, 0.15);
    color: var(--color-success);
}

.insight-icon.warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--color-warning);
}

.insight-icon svg {
    width: 20px;
    height: 20px;
}

.insight-content {
    flex: 1;
}

.insight-title {
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 2px;
}

.insight-desc {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}

/* ============================================
   Scan Screen
   ============================================ */

.scan-content {
    padding: var(--space-md);
}

.scan-modes {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    padding: 4px;
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-full);
}

.scan-mode {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    border: none;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--color-text-secondary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.scan-mode.active {
    background: var(--color-bg-secondary);
    color: var(--color-text);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.camera-container {
    position: relative;
    margin-bottom: var(--space-lg);
}

.camera-viewport {
    aspect-ratio: 4/3;
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-xl);
    overflow: hidden;
    position: relative;
}

.camera-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.scan-frame {
    width: 70%;
    aspect-ratio: 1;
    position: relative;
}

.scan-corner {
    position: absolute;
    width: 30px;
    height: 30px;
    border-color: var(--color-primary-light);
    border-style: solid;
    border-width: 0;
}

.scan-corner.tl {
    top: 0;
    left: 0;
    border-top-width: 4px;
    border-left-width: 4px;
}

.scan-corner.tr {
    top: 0;
    right: 0;
    border-top-width: 4px;
    border-right-width: 4px;
}

.scan-corner.bl {
    bottom: 0;
    left: 0;
    border-bottom-width: 4px;
    border-left-width: 4px;
}

.scan-corner.br {
    bottom: 0;
    right: 0;
    border-bottom-width: 4px;
    border-right-width: 4px;
}

.scan-line {
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--color-primary-light), transparent);
    animation: scan 2s ease-in-out infinite;
}

@keyframes scan {
    0%, 100% { transform: translateY(-100px); opacity: 0; }
    50% { transform: translateY(100px); opacity: 1; }
}

.scan-hint {
    margin-top: var(--space-lg);
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.camera-simulation {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    opacity: 0.9;
}

.capture-btn {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 70px;
    height: 70px;
    border-radius: var(--radius-full);
    background: var(--color-bg-secondary);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transition: all var(--transition-base);
}

.capture-btn:hover {
    transform: translateX(-50%) scale(1.05);
}

.capture-ring {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-full);
    border: 4px solid var(--color-primary);
}

.scan-options {
    display: flex;
    justify-content: center;
    gap: var(--space-xl);
    margin-top: var(--space-2xl);
}

.option-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    background: none;
    border: none;
    color: var(--color-text);
    cursor: pointer;
}

.option-btn svg {
    width: 24px;
    height: 24px;
    padding: var(--space-md);
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-full);
}

.option-btn span {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

/* ============================================
   Analysis Screen
   ============================================ */

.analysis-content {
    padding: var(--space-md);
}

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

.analysis-product-image {
    width: 120px;
    height: 120px;
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-lg);
    margin: 0 auto var(--space-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
}

.analysis-product-name {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--color-text);
    margin-bottom: var(--space-xs);
}

.analysis-product-brand {
    color: var(--color-text-muted);
    margin-bottom: var(--space-md);
}

/* Health Score Circle */
.health-score-container {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-xl);
}

.score-circle-large {
    position: relative;
    width: 150px;
    height: 150px;
}

.score-circle-large svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.score-bg {
    fill: none;
    stroke: var(--color-bg-tertiary);
    stroke-width: 8;
}

.score-progress {
    fill: none;
    stroke: var(--color-primary);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease;
}

.score-value-large {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-primary);
}

.score-label-large {
    text-align: center;
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin-top: var(--space-sm);
}

/* Rating Badge */
.rating-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.9rem;
}

.rating-badge.excellent {
    background: rgba(34, 197, 94, 0.15);
    color: var(--rating-excellent);
}

.rating-badge.good {
    background: rgba(132, 204, 22, 0.15);
    color: var(--rating-good);
}

.rating-badge.moderate {
    background: rgba(245, 158, 11, 0.15);
    color: var(--rating-moderate);
}

.rating-badge.poor {
    background: rgba(249, 115, 22, 0.15);
    color: var(--rating-poor);
}

.rating-badge.avoid {
    background: rgba(239, 68, 68, 0.15);
    color: var(--rating-avoid);
}

/* Analysis Sections */
.analysis-section {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
    box-shadow: var(--glass-shadow);
}

.section-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* Ingredient List */
.ingredient-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.ingredient-item {
    padding: var(--space-md);
    background: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--color-primary);
}

.ingredient-item.concerning {
    border-left-color: var(--color-warning);
}

.ingredient-item.harmful {
    border-left-color: var(--color-danger);
}

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

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

.ingredient-purpose {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-sm);
}

.ingredient-impact {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}

/* Warning Cards */
.warning-card {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
}

.warning-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--color-danger);
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.warning-list {
    list-style: none;
    padding-left: 0;
}

.warning-list li {
    padding: var(--space-xs) 0;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.warning-list li::before {
    content: '•';
    color: var(--color-danger);
    font-weight: bold;
}

/* Diet Compatibility */
.diet-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
}

.diet-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    background: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
}

.diet-item.compatible {
    color: var(--color-success);
}

.diet-item.incompatible {
    color: var(--color-danger);
}

.diet-item svg {
    width: 18px;
    height: 18px;
}

/* Nutrition Facts */
.nutrition-table {
    width: 100%;
    border-collapse: collapse;
}

.nutrition-table tr {
    border-bottom: 1px solid var(--glass-border);
}

.nutrition-table tr:last-child {
    border-bottom: none;
}

.nutrition-table td {
    padding: var(--space-sm) 0;
    font-size: 0.9rem;
}

.nutrition-table td:last-child {
    text-align: right;
    font-weight: 600;
}

.nutrition-table .highlight {
    color: var(--color-primary);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-xl);
}

.action-btn {
    flex: 1;
    padding: var(--space-md);
    border-radius: var(--radius-lg);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
}

.action-btn.primary {
    background: var(--color-primary);
    color: white;
    border: none;
}

.action-btn.secondary {
    background: var(--color-bg-tertiary);
    color: var(--color-text);
    border: none;
}

.action-btn svg {
    width: 20px;
    height: 20px;
}

/* ============================================
   AI Assistant Screen
   ============================================ */

.chat-content {
    padding: var(--space-md);
    padding-bottom: 100px;
    height: calc(100vh - 140px);
    overflow-y: auto;
}

.chat-welcome {
    text-align: center;
    padding: var(--space-2xl) var(--space-md);
}

.ai-avatar {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-lg);
    color: white;
}

.ai-avatar svg {
    width: 40px;
    height: 40px;
}

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

.chat-welcome p {
    color: var(--color-text-muted);
    margin-bottom: var(--space-xl);
}

.quick-questions {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.quick-q {
    padding: var(--space-md);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    text-align: left;
    font-size: 0.95rem;
    color: var(--color-text);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.quick-q:hover {
    background: var(--color-bg-tertiary);
    border-color: var(--color-primary-light);
}

/* Chat Messages */
.chat-messages {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.chat-message {
    display: flex;
    gap: var(--space-sm);
    max-width: 85%;
}

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--color-bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.8rem;
    font-weight: 600;
}

.chat-message.ai .message-avatar {
    background: var(--color-primary);
    color: white;
}

.message-content {
    padding: var(--space-md);
    border-radius: var(--radius-lg);
    font-size: 0.95rem;
    line-height: 1.5;
}

.chat-message.ai .message-content {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-bottom-left-radius: 4px;
}

.chat-message.user .message-content {
    background: var(--color-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

/* Chat Input */
.chat-input-container {
    position: fixed;
    bottom: 80px;
    left: 0;
    right: 0;
    padding: var(--space-md);
    background: var(--color-bg);
    border-top: 1px solid var(--glass-border);
    z-index: 50;
}

.chat-input-wrapper {
    max-width: 480px;
    margin: 0 auto;
    display: flex;
    gap: var(--space-sm);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-full);
    padding: var(--space-xs);
    padding-left: var(--space-md);
}

.chat-input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--color-text);
    outline: none;
}

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

.chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.chat-send-btn:hover {
    background: var(--color-primary-dark);
}

.chat-send-btn svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   Reports Screen
   ============================================ */

.report-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    margin-bottom: var(--space-xl);
    box-shadow: var(--glass-shadow);
}

.report-card.summary {
    text-align: center;
}

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

.report-header h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
}

.report-date {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.health-score-large {
    margin-bottom: var(--space-xl);
}

.score-circle {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto;
}

.score-circle svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.score-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-primary);
}

.score-label {
    margin-top: var(--space-sm);
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.score-breakdown {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.breakdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.breakdown-label {
    width: 80px;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}

.breakdown-bar {
    flex: 1;
    height: 8px;
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.breakdown-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: var(--radius-full);
    transition: width 1s ease;
}

.breakdown-fill.warning {
    background: var(--color-warning);
}

.breakdown-value {
    width: 30px;
    text-align: right;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
}

/* Report List */
.report-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.report-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.report-item:hover {
    background: var(--color-bg-tertiary);
}

.report-icon {
    width: 44px;
    height: 44px;
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
}

.report-icon svg {
    width: 22px;
    height: 22px;
}

.report-info {
    flex: 1;
}

.report-title {
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 2px;
}

.report-meta {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.report-arrow {
    width: 20px;
    height: 20px;
    color: var(--color-text-muted);
}

.export-btn {
    width: 100%;
    margin-top: var(--space-xl);
    padding: var(--space-md);
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.export-btn:hover {
    background: var(--color-primary-dark);
}

.export-btn svg {
    width: 20px;
    height: 20px;
}

/* ============================================
   Profile Screen
   ============================================ */

.profile-header {
    text-align: center;
    padding: var(--space-xl) 0;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: var(--space-xl);
}

.profile-avatar {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-md);
    color: white;
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
}

.profile-name {
    font-family: var(--font-display);
    font-size: 1.5rem;
    margin-bottom: var(--space-xs);
}

.profile-email {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-bottom: var(--space-lg);
}

.profile-stats {
    display: flex;
    justify-content: center;
    gap: var(--space-xl);
}

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

.p-stat-value {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
}

.p-stat-label {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* Profile Sections */
.profile-section {
    margin-bottom: var(--space-xl);
}

.profile-section h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    margin-bottom: var(--space-md);
}

.profile-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.profile-row {
    display: flex;
    justify-content: space-between;
    padding: var(--space-md);
    border-bottom: 1px solid var(--glass-border);
}

.profile-row:last-child {
    border-bottom: none;
}

.profile-row span:first-child {
    color: var(--color-text-muted);
}

.profile-row span:last-child {
    font-weight: 600;
}

/* Diet Tags */
.diet-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.diet-tag {
    padding: var(--space-sm) var(--space-md);
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.diet-tag.active {
    background: var(--color-primary);
    color: white;
}

/* Allergy List */
.allergy-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.allergy-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
}

.allergy-severity {
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
}

.allergy-severity.high {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-danger);
}

.allergy-severity.medium {
    background: rgba(245, 158, 11, 0.15);
    color: var(--color-warning);
}

/* Goal Card */
.goal-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
}

.goal-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-sm);
}

.goal-name {
    font-weight: 600;
}

.goal-progress {
    color: var(--color-primary);
    font-weight: 600;
}

.goal-bar {
    height: 8px;
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: var(--space-sm);
}

.goal-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: var(--radius-full);
    transition: width 1s ease;
}

.goal-target {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* Settings */
.settings-list {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    border-bottom: 1px solid var(--glass-border);
}

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

/* Toggle Switch */
.toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

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

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

.logout-btn {
    width: 100%;
    padding: var(--space-md);
    background: transparent;
    border: 1px solid var(--color-danger);
    color: var(--color-danger);
    border-radius: var(--radius-lg);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-top: var(--space-xl);
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* ============================================
   Bottom Navigation
   ============================================ */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: var(--space-sm) 0 calc(var(--space-sm) + var(--safe-bottom));
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: var(--space-sm) var(--space-md);
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 0.7rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex: 1;
}

.nav-item svg {
    width: 24px;
    height: 24px;
}

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

.nav-item.active svg {
    stroke-width: 2.5;
}

.nav-scan-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-top: -20px;
    box-shadow: 0 4px 15px rgba(45, 106, 30, 0.4);
}

.nav-scan-icon svg {
    width: 24px;
    height: 24px;
}

/* ============================================
   Comparison Screen
   ============================================ */

.compare-content {
    padding: var(--space-md);
}

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

.compare-products {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.compare-product {
    flex: 1;
    text-align: center;
    padding: var(--space-md);
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-lg);
}

.compare-product.winner {
    border-color: var(--color-success);
    background: rgba(34, 197, 94, 0.05);
}

.compare-product-image {
    width: 80px;
    height: 80px;
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-md);
    margin: 0 auto var(--space-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
}

.compare-product-name {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: var(--space-xs);
}

.compare-product-score {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
}

.compare-product.winner .compare-product-score {
    color: var(--color-success);
}

.compare-section {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
}

.compare-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--glass-border);
}

.compare-row:last-child {
    border-bottom: none;
}

.compare-label {
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.compare-values {
    display: flex;
    gap: var(--space-lg);
}

.compare-value {
    text-align: center;
    min-width: 60px;
}

.compare-value.winner {
    color: var(--color-success);
    font-weight: 600;
}

.compare-verdict {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    text-align: center;
    color: white;
    margin-top: var(--space-xl);
}

.compare-verdict h3 {
    font-family: var(--font-display);
    margin-bottom: var(--space-sm);
}

/* ============================================
   Animations
   ============================================ */

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

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

.animate-in {
    animation: slideUp 0.4s ease forwards;
}

/* Stagger children */
.stagger-children > * {
    opacity: 0;
    animation: slideUp 0.4s ease forwards;
}

.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }

/* ============================================
   Responsive Adjustments
   ============================================ */

@media (max-width: 380px) {
    .hero-title {
        font-size: 1.75rem;
    }
    
    .stat-value {
        font-size: 1.75rem;
    }
    
    .product-image {
        width: 70px;
        height: 70px;
    }
}

/* Hide scrollbar but keep functionality */
::-webkit-scrollbar {
    width: 0;
    height: 0;
}

/* Selection color */
::selection {
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
}