/* ===================================
   NutriKidney - 清新自然风格
   =================================== */

:root {
    /* 清新自然的色彩系统 */
    --primary: #10B981;
    --primary-light: #34D399;
    --primary-dark: #059669;

    /* 风险等级 */
    --risk-low: #22C55E;
    --risk-medium: #F59E0B;
    --risk-high: #EF4444;

    /* 背景 */
    --bg-main: #F0FDF4;
    --bg-card: #FFFFFF;
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    --border: #E5E7EB;
    --border-light: #F3F4F6;

    /* 阴影 */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);

    /* 圆角 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    /* 过渡 */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
}

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

body {
    font-family: 'Noto Sans SC', 'PingFang SC', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ===================================
   面包屑导航
   =================================== */
.breadcrumb {
    padding: 12px 24px;
    margin-bottom: 8px;
}

.breadcrumb ol {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 8px;
    font-size: 14px;
}

.breadcrumb li {
    display: flex;
    align-items: center;
    color: var(--text-muted);
}

.breadcrumb li:not(:last-child)::after {
    content: '>';
    margin-left: 8px;
    color: var(--text-muted);
}

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

.breadcrumb a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.breadcrumb li[aria-current="page"] {
    color: var(--text-secondary);
}

/* ===================================
   主容器
   =================================== */

.app-container {
    min-height: 100vh;
}

/* ===================================
   顶部导航
   =================================== */

.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.logo-icon {
    font-size: 32px;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.logo-sub {
    font-size: 12px;
    color: var(--text-muted);
}

.search-box {
    flex: 1;
    max-width: 400px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border: 2px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 14px;
    background: var(--bg-main);
    transition: var(--transition-normal);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-light);
    background: var(--bg-card);
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

.search-hints {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-top: 8px;
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 50;
}

.search-hints.show {
    display: block;
}

.search-hint-item {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
}

.search-hint-item:hover {
    background: var(--bg-main);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.view-toggle {
    display: flex;
    background: var(--bg-main);
    border-radius: var(--radius-md);
    padding: 4px;
    gap: 2px;
}

.view-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition-fast);
}

.view-btn:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.view-btn.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

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

.export-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-normal);
}

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

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

/* ===================================
   主内容
   =================================== */

.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* ===================================
   分类导航 - 横向排列
   =================================== */

.category-nav {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.category-nav-header {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.category-scroll::-webkit-scrollbar {
    height: 4px;
}

.category-scroll::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.category-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--bg-main);
    border: 2px solid transparent;
    border-radius: var(--radius-full);
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
    flex-shrink: 0;
}

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

.category-chip.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.category-chip .count {
    font-size: 12px;
    padding: 2px 8px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: var(--radius-full);
}

.category-chip.active .count {
    background: rgba(255, 255, 255, 0.25);
}

/* ===================================
   筛选工具栏
   =================================== */

.filter-toolbar {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.filter-sliders {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 20px;
}

.filter-slider-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.filter-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.filter-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    background: rgba(16, 185, 129, 0.1);
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.range-slider {
    position: relative;
    height: 24px;
    display: flex;
    align-items: center;
}

.range-slider input[type="range"] {
    position: absolute;
    width: 100%;
    height: 4px;
    background: transparent;
    -webkit-appearance: none;
    pointer-events: none;
    z-index: 1;
}

.range-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
    transition: transform 0.15s ease;
}

.range-slider input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.range-slider input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    border: none;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

.range-track {
    position: absolute;
    width: 100%;
    height: 6px;
    background: var(--bg-main);
    border-radius: 3px;
}

.range-fill {
    position: absolute;
    height: 100%;
    background: linear-gradient(90deg, var(--primary-light), var(--primary));
    border-radius: 3px;
}

.filter-controls {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

.risk-toggles {
    display: flex;
    gap: 6px;
}

.risk-toggle {
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition-fast);
    border: 1px solid var(--border);
    background: var(--bg-card);
    display: flex;
    align-items: center;
    gap: 6px;
}

.risk-toggle .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.risk-toggle.low .dot { background: var(--risk-low); }
.risk-toggle.medium .dot { background: var(--risk-medium); }
.risk-toggle.high .dot { background: var(--risk-high); }

.risk-toggle.active.low { background: rgba(34, 197, 94, 0.1); border-color: var(--risk-low); color: var(--risk-low); }
.risk-toggle.active.medium { background: rgba(245, 158, 11, 0.1); border-color: var(--risk-medium); color: var(--risk-medium); }
.risk-toggle.active.high { background: rgba(239, 68, 68, 0.1); border-color: var(--risk-high); color: var(--risk-high); }

.special-toggles {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.special-toggle {
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 13px;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg-card);
    transition: var(--transition-fast);
}

.special-toggle:hover {
    border-color: var(--primary-light);
}

.special-toggle.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.reset-btn {
    padding: 8px 14px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.reset-btn:hover {
    background: var(--bg-main);
    color: var(--text-primary);
}

/* ===================================
   统计栏
   =================================== */

.stats-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    flex: 1;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-xs);
}

.stat-icon {
    font-size: 24px;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

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

/* ===================================
   食物网格
   =================================== */

.food-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.food-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 14px;
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border-light);
    position: relative;
}
    transition: var(--transition-normal);
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border-light);
    position: relative;
}

.food-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

/* 顶部风险色条 */
.food-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 14px;
    right: 14px;
    height: 2px;
    border-radius: 0 0 2px 2px;
}

.food-card.risk-low::before { background: var(--risk-low); }
.food-card.risk-medium::before { background: var(--risk-medium); }
.food-card.risk-high::before { background: var(--risk-high); }

.food-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    padding-top: 2px;
}

.food-info {
    flex: 1;
}

.food-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.food-alias {
    display: inline;
    font-size: 12px;
    color: var(--text-muted);
}

.food-category {
    font-size: 12px;
    color: var(--text-muted);
}

.risk-tag {
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 500;
}

.risk-tag.low { background: rgba(34, 197, 94, 0.1); color: var(--risk-low); }
.risk-tag.medium { background: rgba(245, 158, 11, 0.1); color: var(--risk-medium); }
.risk-tag.high { background: rgba(239, 68, 68, 0.1); color: var(--risk-high); }

/* 营养条形图 */
.nutrient-bars {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nutrient-bar-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

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

.nutrient-bar-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.nutrient-bar-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.nutrient-bar-track {
    height: 8px;
    background: var(--bg-main);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.nutrient-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.4s ease;
}

.food-tags {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}

.tag {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
}

.tag-recommended { background: rgba(34, 197, 94, 0.1); color: var(--risk-low); }
.tag-restricted { background: rgba(239, 68, 68, 0.1); color: var(--risk-high); }

.food-footer {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
}

.view-detail {
    color: var(--primary);
    font-weight: 500;
    opacity: 0;
    transition: var(--transition-fast);
}

.food-card:hover .view-detail {
    opacity: 1;
}

/* ===================================
   骨架屏
   =================================== */

.food-card.skeleton {
    pointer-events: none;
}

.skeleton-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-top: 4px;
}

.skeleton-line {
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

.skeleton-icon {
    width: 50%;
    height: 20px;
}

.skeleton-badge {
    width: 60px;
    height: 24px;
    border-radius: var(--radius-full);
}

.skeleton-bars {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.skeleton-bar {
    height: 26px;
    width: 100%;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===================================
   表格视图
   =================================== */

.food-table-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table-wrapper {
    overflow-x: auto;
}

.food-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.food-table th {
    background: var(--bg-main);
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    border-bottom: 2px solid var(--border);
}

.food-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: var(--transition-fast);
}

.food-table th.sortable:hover {
    color: var(--primary);
}

.food-table th.sortable::after {
    content: '↕';
    margin-left: 4px;
    opacity: 0.3;
    font-size: 12px;
}

.food-table th.sort-asc::after {
    content: '↑';
    opacity: 1;
}

.food-table th.sort-desc::after {
    content: '↓';
    opacity: 1;
}

.food-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.food-table tbody tr {
    transition: var(--transition-fast);
}

.food-table tbody tr:hover {
    background: var(--bg-main);
}

.food-table .food-name-cell {
    font-weight: 500;
    color: var(--text-primary);
}

.food-table .food-name-cell span {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: normal;
    margin-top: 2px;
}

.food-table .alias-tag {
    display: inline;
    background: var(--bg-main);
    padding: 1px 4px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--primary-dark);
}

.food-table .risk-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
}

.food-table .risk-badge.low {
    background: rgba(34, 197, 94, 0.1);
    color: var(--risk-low);
}

.food-table .risk-badge.medium {
    background: rgba(245, 158, 11, 0.1);
    color: var(--risk-medium);
}

.food-table .risk-badge.high {
    background: rgba(239, 68, 68, 0.1);
    color: var(--risk-high);
}

.food-table .nutrient-cell {
    font-variant-numeric: tabular-nums;
}

.food-table .action-btn {
    padding: 6px 12px;
    background: var(--bg-main);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--primary);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.food-table .action-btn:hover {
    background: var(--primary);
    color: white;
}

.food-table .tag-cell {
    display: flex;
    gap: 6px;
}

.food-table .tag {
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 500;
}

.food-table .tag-recommended {
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary);
}

.food-table .tag-restricted {
    background: rgba(239, 68, 68, 0.1);
    color: var(--risk-high);
}

/* ===================================
   空状态
   =================================== */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
}

.empty-icon {
    font-size: 56px;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.btn-primary {
    padding: 10px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

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

/* ===================================
   分页控件
   =================================== */

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    padding: 16px 24px;
    margin-top: 24px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.pagination-info {
    font-size: 14px;
    color: var(--text-secondary);
}

.pagination-info strong {
    color: var(--primary);
    font-weight: 600;
}

.pagination-count {
    margin-left: 4px;
    color: var(--text-muted);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    height: 40px;
    padding: 0 16px;
    background: linear-gradient(135deg, var(--bg-main) 0%, #ffffff 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-normal);
}

.pagination-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.page-numbers {
    display: flex;
    align-items: center;
    gap: 4px;
}

.page-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.page-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: white;
    transform: translateY(-1px);
}

.page-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.page-ellipsis {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    color: var(--text-muted);
    font-size: 14px;
}

@media (max-width: 640px) {
    .pagination {
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
    }

    .pagination-controls {
        justify-content: center;
        flex-wrap: wrap;
    }

    .page-numbers {
        order: -1;
        margin-bottom: 8px;
    }
}

/* ===================================
   分页
   =================================== */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 24px 0;
}

.page-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.page-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

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

.page-info {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ===================================
   弹窗
   =================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    max-width: 520px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    animation: modalIn 0.3s ease;
}

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

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

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.modal-header h2 .modal-alias {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-muted);
}

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

.modal-close:hover {
    background: var(--border);
}

.modal-close svg {
    width: 18px;
    height: 18px;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(90vh - 72px);
}

.detail-section {
    margin-bottom: 24px;
}

.detail-section:last-child {
    margin-bottom: 0;
}

.detail-section h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-tags {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.detail-tag {
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 500;
}

.detail-tag.recommended { background: rgba(34, 197, 94, 0.1); color: var(--risk-low); }
.detail-tag.restricted { background: rgba(239, 68, 68, 0.1); color: var(--risk-high); }

.risk-progress {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.risk-progress-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.risk-progress-header {
    display: flex;
    justify-content: space-between;
}

.risk-progress-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.risk-progress-value {
    font-size: 14px;
    font-weight: 600;
}

.risk-progress-bar {
    height: 10px;
    background: var(--bg-main);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.risk-progress-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
}

.risk-progress-fill.low { background: var(--risk-low); }
.risk-progress-fill.medium { background: var(--risk-medium); }
.risk-progress-fill.high { background: var(--risk-high); }

.nutrient-table {
    width: 100%;
    border-collapse: collapse;
}

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

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

.nutrient-table td {
    padding: 12px 0;
    font-size: 14px;
}

.nutrient-table td:last-child {
    text-align: right;
    font-weight: 500;
}

.risk-indicator {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 11px;
    margin-left: 8px;
}

.risk-indicator.low { background: rgba(34, 197, 94, 0.1); color: var(--risk-low); }
.risk-indicator.medium { background: rgba(245, 158, 11, 0.1); color: var(--risk-medium); }
.risk-indicator.high { background: rgba(239, 68, 68, 0.1); color: var(--risk-high); }

.remark-section {
    background: var(--bg-main);
    padding: 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    line-height: 1.8;
}

.remark-section.warning { border-left: 4px solid var(--risk-high); }
.remark-section.tip { border-left: 4px solid var(--risk-low); }

/* ===================================
   移动端筛选按钮
   =================================== */

.mobile-filter-btn {
    display: none;
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 14px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    z-index: 90;
}

/* ===================================
   响应式
   =================================== */

@media (max-width: 1200px) {
    .filter-sliders {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 992px) {
    .mobile-filter-btn {
        display: block;
    }

    .category-nav {
        display: none;
    }

    .category-nav.show {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 200;
        border-radius: 0;
        overflow-y: auto;
        padding: 60px 24px 24px;
    }

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

    .filter-sliders {
        grid-template-columns: 1fr;
    }

    .filter-controls {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 768px) {
    .header-inner {
        flex-wrap: wrap;
        gap: 12px;
    }

    .search-box {
        order: 3;
        max-width: 100%;
        flex-basis: 100%;
    }

    .main-content {
        padding: 16px;
    }

    .food-grid {
        grid-template-columns: 1fr;
    }

    .filter-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .special-toggles {
        margin-left: 0;
    }

    .stats-bar {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-value {
        font-size: 18px;
    }
}

/* ===================================
   加载动画
   =================================== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.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); }
}
