/* ========== 全局基础 ========== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

body {
    background: #f7f8fa;
    color: #333;
    line-height: 1.6;
}

.container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px 16px;
}


/* ========== 标题区 ========== */
.header {
    text-align: center;
    margin-bottom: 24px;
}

.header h1 {
    font-size: 26px;
    font-weight: 600;
    color: #222;
    margin-bottom: 6px;
}

.header p {
    font-size: 14px;
    color: #888;
}

/* ========== 搜索框 ========== */
.search-box {
    margin-bottom: 16px;
}

.search-box input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #b7e4c7;
    border-radius: 12px;
    font-size: 16px;
    background: #f8fff9;
    outline: none;
    transition: border-color 0.2s;
}

.search-box input:focus {
    border-color: #52c41a;
}

/* ========== 分类标签（按钮样式） ========== */
.category-tabs {
    margin-bottom: 12px;
    white-space: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
}

.category-tabs .tab {
    display: inline-block;
    padding: 8px 18px;
    margin: 0 6px 10px 0;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: all 0.2s;
}

.category-tabs .tab.active {
    background: #ffb84d;
    border-color: #ffb84d;
    color: #fff;
}

.category-tabs .tab:hover {
    border-color: #ffb84d;
    color: #ffb84d;
}

.category-tabs .tab.active:hover {
    color: #fff;
}

/* ========== 食材列表 ========== */
.food-list {
    background: #fff;
    border-radius: 12px;
    padding: 8px 0;
    margin-bottom: 20px;
    max-height: 360px;
    overflow-y: auto;
}

.food-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px;
    border-bottom: 1px solid #f5f5f5;
}

.food-item:last-child {
    border-bottom: none;
}

.food-name {
    font-size: 15px;
    color: #333;
}

.food-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.weight-input {
    width: 55px;
    padding: 4px 6px;
    border: 1px solid #eee;
    border-radius: 6px;
    text-align: center;
    font-size: 14px;
    outline: none;
}

.unit {
    font-size: 13px;
    color: #888;
}

/* 添加按钮 */
.add-btn {
    padding: 4px 12px;
    background: #eaefff;
    border: 1px solid #b7bce4;
    color: #2061b0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.add-btn:hover {
    background: #c8e6c9;
}

/* ========== 已选食材区 ========== */
.selected-section {
    background: #fff;
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 20px;
}

.selected-section h3 {
    font-size: 17px;
    margin-bottom: 12px;
    color: #222;
}

.selected-list {
    margin-bottom: 16px;
}

.selected-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #f5f5f5;
}

.selected-item .seq {
    width: 20px;
    font-size: 14px;
    color: #999;
}

.selected-item .name {
    flex: 1;
    font-size: 14px;
}

.selected-item .weight {
    font-size: 14px;
    color: #666;
}

/* 删除按钮 */
.del-btn {
    border: none;
    background: none;
    color: #f48236;
    cursor: pointer;
    font-size: 13px;
    padding: 2px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.del-btn:hover {
    background: #ffebee;
}

.btn-group {
    display: flex;
    gap: 12px;
}

/* 计算按钮 */
.calc-btn {
    flex: 1;
    padding: 12px;
    background: #ffb84d;
    border: none;
    border-radius: 25px;
    color: #fff;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.calc-btn:hover {
    background: #f5a025;
}

/* 清空按钮 */
.clear-btn {
    padding: 12px 22px;
    border: 1px solid #e0e0e0;
    background: #fff;
    color: #666;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.clear-btn:hover {
    border-color: #ffb84d;
    color: #ffb84d;
}

/* ========== 结果区域 ========== */
.result-section {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.result-section h3 {
    font-size: 18px;
    margin-bottom: 16px;
    color: #222;
}

/* 营养素卡片 */
.nutrient-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 24px;
}

.nutrient-card {
    padding: 12px 14px;
    background: #f9fcff;
    border-radius: 8px;
}

.nutrient-name {
    font-size: 15px;
    color: #888;
    margin-bottom: 4px;
}

.nutrient-value {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
}

.nutrient-percent {
    font-size: 13px;
}

.percent-low { color: #f5a623; }
.percent-normal { color: #52c41a; }
.percent-high { color: #ff7d00; }

/* 食材明细 */
.detail-section {
    margin-bottom: 20px;
}

.detail-section h4 {
    font-size: 15px;
    margin-bottom: 10px;
    color: #333;
}

.food-detail-list {
    font-size: 13px;
    color: #555;
    line-height: 1.8;
}

.detail-item {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px dashed #eee;
}

.detail-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.detail-title {
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
}

/* 添加糖管理 */
.sugar-section {
    margin-bottom: 20px;
    padding: 14px;
    background: #fff8e1;
    border-radius: 8px;
}

.sugar-total {
    font-size: 14px;
    color: #754b1d;
    margin-bottom: 8px;
}

.sugar-total strong {
    font-size: 16px;
    color: #e67700;
}

.sugar-note {
    font-size: 12px;
    color: #8d6e63;
    margin-top: 4px;
}

.gi-list {
    margin-top: 10px;
    font-size: 12px;
}

.gi-title {
    color: #5d4037;
    margin-bottom: 6px;
}

.gi-tag {
    display: inline-block;
    padding: 2px 8px;
    margin-right: 6px;
    border-radius: 12px;
    font-size: 12px;
}

.gi-低 { background: #c8e6c9; color: #2e7d32; }
.gi-中 { background: #fff3b2; color: #b6a300; }
.gi-高 { background: #ffe0b2; color: #e67700; }

/* 饮食建议 */
.tips-section {
    margin-bottom: 16px;
}

.tips-section h4 {
    font-size: 15px;
    margin-bottom: 10px;
    color: #333;
}

.tips-box {
    font-size: 13px;
    color: #555;
    line-height: 1.8;
    padding: 14px;
    background: #e8f4ff;
    border-radius: 8px;
}

.tip-item {
    margin-bottom: 6px;
}

/* 免责声明 */
.disclaimer {
    font-size: 12px;
    color: #aaa;
    text-align: center;
    margin: 16px 0;
}

/* 重新计算按钮（蓝色） */
.reset-btn {
    width: 100%;
    padding: 12px;
    background: #2b7fff;
    border: none;
    border-radius: 20px;
    color: #fff;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s;
}

.reset-btn:hover {
    background: #1a66e0;
}

/* ========== 空提示 ========== */
.empty-tip {
    text-align: center;
    color: #aaa;
    font-size: 14px;
    padding: 20px 0;
}
