/**
 * FitMate - Diet Page Styles
 * 饮食建议页面专用样式
 */

/* ================================================================
   CSS Variables - 颜色变量
   ================================================================ */
:root {
    --primary: #3B82F6;
    --primary-dark: #2563EB;
    --primary-light: #EFF6FF;
    --success: #10B981;
    --success-light: #ECFDF5;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --danger: #EF4444;
    --danger-light: #FEE2E2;
    --background: #F8FAFC;
    --surface: #FFFFFF;
    --border: #E2E8F0;
    --border-light: #F1F5F9;
    --text-primary: #0F172A;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
    --radius: 16px;
    --radius-sm: 8px;
    --transition: 0.2s ease;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif;
}

/* ================================================================
   Page Topbar - 页面顶部
   ================================================================ */
.diet-topbar {
    margin-bottom: 24px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

/* ================================================================
   Card - 卡片
   ================================================================ */
.fit-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: all var(--transition);
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.fit-card:hover {
    box-shadow: var(--shadow-lg);
}

.fit-card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.fit-card-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.fit-card-body {
    padding: 20px 24px 24px;
}

/* ================================================================
   Body Stats - 身体数据
   ================================================================ */
.body-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.stat-item {
    padding: 14px;
    background: var(--background);
    border-radius: var(--radius-sm);
    text-align: center;
}

.stat-item.highlight {
    background: var(--primary-light);
    border: 1px solid rgba(59, 130, 246, 0.15);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    display: block;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-value small {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
}

.stat-status {
    display: inline-block;
    font-size: 12px;
    padding: 2px 10px;
    border-radius: 9999px;
    margin-top: 4px;
}

.stat-status.normal {
    background: var(--success-light);
    color: var(--success);
}

.stat-status.overweight {
    background: var(--warning-light);
    color: var(--warning);
}

.stat-status.obese {
    background: var(--danger-light);
    color: var(--danger);
}

.stat-status.underweight {
    background: var(--warning-light);
    color: var(--warning);
}

/* ================================================================
   Calorie Ring - 热量环形图
   ================================================================ */
.calorie-summary {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
    margin-top: 4px;
}

.current-cal {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.cal-separator {
    font-size: 20px;
    color: var(--text-muted);
}

.target-cal {
    font-size: 18px;
    color: var(--text-secondary);
}

.cal-unit {
    font-size: 14px;
    color: var(--text-muted);
}

#calorieStatus {
    font-size: 14px;
    margin-top: 8px;
}

/* ================================================================
   Nutrition - 营养配比
   ================================================================ */
.nutrition-details {
    margin-top: 16px;
}

.nutrition-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-light);
}

.nutrition-item:last-child {
    border-bottom: none;
}

.nutrition-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.nutrition-dot.protein {
    background: var(--primary);
}
.nutrition-dot.carbs {
    background: var(--success);
}
.nutrition-dot.fat {
    background: var(--warning);
}

.nutrition-label {
    flex: 1;
    font-size: 14px;
    color: var(--text-secondary);
}

.nutrition-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.nutrition-value small {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
}

.nutrition-percent {
    font-size: 13px;
    color: var(--text-muted);
    min-width: 40px;
    text-align: right;
}

/* ================================================================
   Meal Tabs - 三餐标签
   ================================================================ */
.meal-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

.meal-tab {
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
}

.meal-tab:hover {
    background: var(--background);
    color: var(--text-primary);
}

.meal-tab.active {
    background: var(--primary);
    color: white;
}

/* ================================================================
   Meal Content - 餐食内容
   ================================================================ */
.meal-content {
    min-height: 150px;
}

.meal-food-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.meal-food-item {
    padding: 4px 14px;
    background: var(--background);
    border-radius: 9999px;
    font-size: 14px;
    color: var(--text-primary);
}

.meal-nutrition-row {
    display: flex;
    gap: 24px;
    padding: 16px;
    background: var(--background);
    border-radius: var(--radius-sm);
}

.meal-nutrition-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.meal-nutrition-item .label {
    font-size: 12px;
    color: var(--text-muted);
}

.meal-nutrition-item .value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.meal-nutrition-item .value small {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
}

/* ================================================================
   Goal Guide - 饮食指导
   ================================================================ */
.goal-guide {
    margin-top: 16px;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--primary-light), var(--success-light));
    border-radius: var(--radius-sm);
}

.goal-guide-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.goal-guide-tips {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 12px;
}

.goal-tip {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.goal-tip i {
    color: var(--success);
}

/* ================================================================
   Diet Preference - 饮食习惯
   ================================================================ */
.diet-preference-card .pref-item {
    border-bottom: 1px solid var(--border-light);
    padding: 4px 0;
}

.diet-preference-card .pref-item:last-child {
    border-bottom: none;
}

/* ================================================================
   Diet History - 饮食记录
   ================================================================ */
.history-item {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
}

.history-item:last-child {
    border-bottom: none;
}

/* ================================================================
   Photo Recognition - 拍照识别
   ================================================================ */
.photo-preview {
    min-height: 120px;
    background: var(--background);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--border);
    padding: 12px;
    transition: border-color var(--transition);
}

.photo-preview img {
    max-height: 150px;
    border-radius: 8px;
    width: 100%;
    object-fit: cover;
}

.photo-preview .empty-state {
    text-align: center;
    color: var(--text-muted);
}

.photo-preview .empty-state i {
    font-size: 32px;
    display: block;
    margin-bottom: 8px;
}

.recognition-result {
    min-height: 120px;
    background: var(--background);
    border-radius: var(--radius-sm);
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.recognition-result .empty-state {
    text-align: center;
    color: var(--text-muted);
}

.recognition-result .empty-state i {
    font-size: 32px;
    display: block;
    margin-bottom: 8px;
}

.recognition-card {
    width: 100%;
}

.recognition-calories {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.recognition-calories::after {
    content: ' kcal';
    font-size: 14px;
    font-weight: 400;
    color: var(--text-muted);
}

.recognition-details {
    background: var(--background);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
}

/* ================================================================
   Modal - 弹窗样式
   ================================================================ */
.modal-content {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border-light);
    padding: 16px 24px;
}

.modal-header .modal-title {
    font-weight: 600;
    font-size: 18px;
}

.modal-body {
    padding: 20px 24px;
}

.modal-footer {
    border-top: 1px solid var(--border-light);
    padding: 12px 24px;
}

/* ================================================================
   Buttons - 按钮
   ================================================================ */
.btn-primary {
    background: var(--primary);
    border: none;
    transition: all var(--transition);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.btn-outline-primary {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: white;
}

.btn-outline-secondary {
    border-color: var(--border);
    color: var(--text-secondary);
}

.btn-outline-secondary:hover {
    background: var(--background);
    border-color: var(--text-muted);
}

.btn-outline-danger {
    border-color: var(--danger);
    color: var(--danger);
}

.btn-outline-danger:hover {
    background: var(--danger);
    color: white;
}

.btn-outline-success {
    border-color: var(--success);
    color: var(--success);
}

.btn-outline-success:hover {
    background: var(--success);
    color: white;
}

/* ================================================================
   Responsive - 响应式
   ================================================================ */
@media (max-width: 992px) {
    .body-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .goal-guide-tips {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .body-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .meal-tabs {
        flex-wrap: wrap;
    }

    .meal-tab {
        flex: 1;
        text-align: center;
        padding: 8px 12px;
        font-size: 13px;
    }

    .meal-nutrition-row {
        flex-wrap: wrap;
        gap: 12px;
    }

    .stat-value {
        font-size: 16px;
    }

    .photo-preview {
        min-height: 80px;
    }

    .recognition-result {
        min-height: 80px;
    }

    .recognition-calories {
        font-size: 20px;
    }
}

@media (max-width: 576px) {
    .body-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .stat-item {
        padding: 10px;
    }

    .stat-value {
        font-size: 14px;
    }
}

/* ================================================================
   Animations - 动画
   ================================================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

.spinner-border-sm {
    animation: spin 0.8s linear infinite;
}