/* NutriApp - Design System */
/* Modern, clean, lavender-inspired design */

:root {
    /* Colors - Lavender inspired palette */
    --primary: #8B5CF6;
    --primary-light: #A78BFA;
    --primary-dark: #7C3AED;
    --primary-bg: #F5F3FF;
    
    --accent: #A3E635;
    --accent-dark: #84CC16;
    
    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;
    
    /* Neutrals */
    --bg: #F8FAFC;
    --bg-card: #FFFFFF;
    --bg-hover: #F1F5F9;
    
    --text: #1E293B;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;
    
    --border: #E2E8F0;
    --border-focus: var(--primary);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    
    /* 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: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 2rem;
    
    /* Transitions */
    --transition: all 0.2s ease;
    
    /* Bottom nav height */
    --nav-height: 70px;
}

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

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-family);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    padding-bottom: var(--nav-height);
    -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.25;
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }

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

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

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

/* Layout */
.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

.page-header {
    padding: var(--space-lg) 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
}

.page-title {
    font-size: var(--font-size-2xl);
    font-weight: 700;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

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

.card-sm {
    padding: var(--space-md);
    border-radius: var(--radius);
}

.card-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    font-size: var(--font-size-base);
    font-weight: 500;
    border-radius: var(--radius-full);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

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

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

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--border);
}

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

.btn-accent:hover {
    background: var(--accent-dark);
}

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

.btn-sm {
    padding: var(--space-xs) var(--space-md);
    font-size: var(--font-size-sm);
}

.btn-lg {
    padding: var(--space-md) var(--space-xl);
    font-size: var(--font-size-lg);
}

/* Forms */
.form-group {
    margin-bottom: var(--space-md);
}

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

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-base);
    font-family: inherit;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    transition: var(--transition);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

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

/* Nutrition Ring */
.nutrition-ring {
    width: 180px;
    height: 180px;
    position: relative;
    margin: 0 auto;
}

.nutrition-ring svg {
    transform: rotate(-90deg);
}

.nutrition-ring .ring-bg {
    stroke: var(--border);
}

.nutrition-ring .ring-progress {
    stroke: var(--primary);
    stroke-linecap: round;
    transition: stroke-dashoffset 0.5s ease;
}

.nutrition-ring .ring-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.nutrition-ring .ring-value {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.nutrition-ring .ring-value svg {
    width: 24px;
    height: 24px;
    color: var(--warning);
}

.nutrition-ring .ring-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

/* Macro Pills */
.macro-pills {
    display: flex;
    justify-content: center;
    gap: var(--space-md);
    margin-top: var(--space-md);
}

.macro-pill {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--font-size-sm);
}

.macro-pill .icon {
    width: 20px;
    height: 20px;
}

.macro-pill .value {
    font-weight: 600;
}

.macro-pill .unit {
    color: var(--text-muted);
}

/* Tags */
.tag {
    display: inline-flex;
    align-items: center;
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-xs);
    font-weight: 500;
    border-radius: var(--radius-full);
    background: var(--primary-bg);
    color: var(--primary);
}

.tag-accent {
    background: #ECFCCB;
    color: var(--accent-dark);
}

/* Meal Rows */
.meal-row {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-card);
    border-radius: var(--radius);
    margin-bottom: var(--space-sm);
    transition: var(--transition);
}

.meal-row:hover {
    background: var(--bg-hover);
}

.meal-row .meal-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.meal-row .meal-icon.breakfast { background: #FEF3C7; }
.meal-row .meal-icon.lunch { background: #DCFCE7; }
.meal-row .meal-icon.dinner { background: #E0E7FF; }
.meal-row .meal-icon.snack { background: #FCE7F3; }

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

.meal-row .meal-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.meal-row .meal-calories {
    font-weight: 600;
    color: var(--primary);
}

/* Shopping List */
.shopping-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-card);
    border-radius: var(--radius);
    margin-bottom: var(--space-sm);
    transition: var(--transition);
}

.shopping-item.checked {
    opacity: 0.5;
}

.shopping-item.checked .item-name {
    text-decoration: line-through;
}

.shopping-item .checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.shopping-item .checkbox.checked {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.shopping-item .item-info {
    flex: 1;
}

.shopping-item .item-name {
    font-weight: 500;
}

.shopping-item .item-quantity {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

/* Category Header */
.category-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) 0;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Calendar Grid */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: var(--space-xs);
}

.calendar-day {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: var(--space-sm);
    min-height: 120px;
}

.calendar-day.today {
    border: 2px solid var(--primary);
}

.calendar-day-header {
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-align: center;
    padding-bottom: var(--space-xs);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-xs);
}

.calendar-day-header .day-name {
    color: var(--text-secondary);
}

.calendar-day-header .day-number {
    color: var(--text);
}

.calendar-meal {
    font-size: var(--font-size-xs);
    padding: var(--space-xs);
    border-radius: var(--radius-sm);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.calendar-meal.breakfast { background: #FEF3C7; }
.calendar-meal.lunch { background: #DCFCE7; }
.calendar-meal.dinner { background: #E0E7FF; }
.calendar-meal.snack { background: #FCE7F3; }
.calendar-meal.empty { 
    background: var(--bg-hover);
    color: var(--text-muted);
    border: 1px dashed var(--border);
}
.calendar-meal.skipped {
    background: var(--bg-hover);
    color: var(--text-muted);
    font-style: italic;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 var(--space-sm);
    z-index: 100;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: var(--space-sm);
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
    border-radius: var(--radius);
}

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

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

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

.nav-item span {
    font-size: var(--font-size-xs);
    font-weight: 500;
}

/* Chat */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--nav-height) - 60px);
}

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

.chat-message {
    max-width: 85%;
    padding: var(--space-md);
    border-radius: var(--radius-lg);
    line-height: 1.4;
}

.chat-message.user {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: var(--radius-sm);
}

.chat-message.assistant {
    align-self: flex-start;
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    border-bottom-left-radius: var(--radius-sm);
}

.chat-input-container {
    padding: var(--space-md);
    background: var(--bg);
    border-top: 1px solid var(--border);
}

.chat-input-wrapper {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    background: var(--bg-card);
    border-radius: var(--radius-full);
    padding: var(--space-xs) var(--space-sm);
    box-shadow: var(--shadow);
}

.chat-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: var(--space-sm);
    font-size: var(--font-size-base);
    font-family: inherit;
}

.chat-input:focus {
    outline: none;
}

.chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

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

.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
}

.chat-suggestion {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: var(--transition);
}

.chat-suggestion:hover {
    background: var(--primary-bg);
    border-color: var(--primary);
}

/* Recipe Card */
.recipe-card {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-md);
    transition: var(--transition);
}

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

.recipe-card .recipe-image {
    width: 80px;
    height: 80px;
    border-radius: var(--radius);
    background: var(--primary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    flex-shrink: 0;
}

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

.recipe-card .recipe-name {
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.recipe-card .recipe-meta {
    display: flex;
    gap: var(--space-md);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.recipe-card .recipe-tags {
    display: flex;
    gap: var(--space-xs);
    margin-top: var(--space-sm);
}

.recipe-card .favorite-btn {
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.recipe-card .favorite-btn:hover,
.recipe-card .favorite-btn.active {
    color: var(--error);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: var(--space-md);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

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

.modal-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-hover);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.modal-footer {
    padding: var(--space-lg);
    border-top: 1px solid var(--border);
    display: flex;
    gap: var(--space-sm);
    justify-content: flex-end;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-secondary);
}

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
}

.empty-state p {
    margin-bottom: var(--space-lg);
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
}

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

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

/* Toast */
.toast-container {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-md);
    left: var(--space-md);
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    animation: slideIn 0.3s ease;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--error); }
.toast.warning { border-left: 4px solid var(--warning); }

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

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }

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

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

.hidden { display: none !important; }

/* Responsive - Mobile First is default */
@media (min-width: 768px) {
    .container {
        max-width: 720px;
    }
    
    .calendar-day {
        min-height: 150px;
    }
}
