/* ======================================================================
 *  食物热量查询 /tool/food-calorie
 *  依赖 home.css 全局变量 + tool-detail.css 公共类，支持黑夜模式
 * ====================================================================== */

[hidden] { display: none !important; }

.fc-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 20px;
    margin-bottom: 24px;
    align-items: start;
}
.fc-card {
    background: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 20px;
}
.fc-title {
    font-size: 15.5px;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin-bottom: 14px;
}

/* ---------- 搜索栏 ---------- */
.fc-search-row {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}
.fc-search-box {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}
.fc-search-icon {
    position: absolute;
    left: 14px;
    font-size: 13px;
    opacity: 0.6;
    pointer-events: none;
}
.fc-search {
    width: 100%;
    height: 44px;
    padding: 0 40px 0 38px;
    font-size: 14px;
    font-family: inherit;
    color: var(--c-text);
    background: var(--c-surface-soft);
    border: 1px solid var(--c-border);
    border-radius: 12px;
    outline: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.fc-search:focus {
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px var(--c-primary-soft);
}
.fc-clear {
    position: absolute;
    right: 12px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(130, 140, 160, 0.18);
    color: var(--c-text-sub);
    font-size: 11px;
    cursor: pointer;
    padding: 0;
}
.fc-clear:hover { background: rgba(130, 140, 160, 0.32); }

.fc-sort-wrap { flex: 0 0 auto; }
.fc-sort {
    height: 44px;
    padding: 0 34px 0 14px;
    font-size: 13px;
    font-family: inherit;
    color: var(--c-text);
    background: var(--c-surface-soft);
    border: 1px solid var(--c-border);
    border-radius: 12px;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a93a8' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
}
.fc-sort:focus { border-color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-primary-soft); }

/* ---------- 分类标签 ---------- */
.fc-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.fc-cat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 12.5px;
    font-family: inherit;
    font-weight: 700;
    color: var(--c-text-sub);
    background: var(--c-surface-soft);
    border: 1px solid var(--c-border);
    border-radius: 99px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.fc-cat:hover { border-color: var(--c-primary); color: var(--c-primary); }
.fc-cat.is-active {
    background: linear-gradient(135deg, rgba(255, 138, 61, 0.18), rgba(255, 138, 61, 0.08));
    border-color: rgba(255, 138, 61, 0.55);
    color: #e06a10;
}
.fc-cat-num {
    font-size: 10.5px;
    font-weight: 700;
    padding: 0 5px;
    border-radius: 99px;
    background: rgba(130, 140, 160, 0.16);
    color: var(--c-text-muted);
}
.fc-cat.is-active .fc-cat-num { background: rgba(255, 138, 61, 0.2); color: #e06a10; }

/* ---------- 结果元信息 ---------- */
.fc-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--c-text-muted);
    padding-bottom: 10px;
    border-bottom: 1px solid var(--c-border);
    margin-bottom: 12px;
}
.fc-meta-tip { font-size: 11.5px; }

/* ---------- 食物列表 ---------- */
.fc-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
    gap: 10px;
    max-height: 660px;
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-width: thin;
}
.fc-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 10px;
    text-align: left;
    font-family: inherit;
    padding: 11px 14px;
    background: var(--c-surface-soft);
    border: 1px solid var(--c-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.fc-item:hover {
    border-color: rgba(255, 138, 61, 0.5);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
.fc-item.is-active {
    background: linear-gradient(135deg, rgba(255, 138, 61, 0.14), rgba(255, 138, 61, 0.05));
    border-color: rgba(255, 138, 61, 0.6);
}
.fc-item-main {
    grid-column: 1;
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}
.fc-item-name {
    font-size: 13.5px;
    font-weight: 800;
    color: var(--c-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fc-item-cat {
    flex: 0 0 auto;
    font-size: 10.5px;
    color: var(--c-text-muted);
    padding: 1px 6px;
    border-radius: 99px;
    background: rgba(130, 140, 160, 0.14);
}
.fc-item-nums {
    grid-column: 2;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
}
.fc-item-kcal {
    font-size: 15px;
    font-weight: 800;
    color: var(--c-text);
    line-height: 1;
}
.fc-item-kcal i {
    font-style: normal;
    font-size: 10px;
    font-weight: 600;
    color: var(--c-text-muted);
    margin-left: 2px;
}
.fc-item-macros {
    grid-column: 1 / -1;
    font-size: 11px;
    color: var(--c-text-muted);
    letter-spacing: 0.01em;
}

/* 热量等级 */
.fc-lv {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 99px;
    white-space: nowrap;
}
.fc-lv-1 { background: rgba(52, 199, 89, 0.16); color: #1f9d43; }
.fc-lv-2 { background: rgba(255, 167, 38, 0.18); color: #c47d05; }
.fc-lv-3 { background: rgba(255, 112, 67, 0.18); color: #d94f1e; }
.fc-lv-4 { background: rgba(255, 82, 82, 0.18); color: #d92b2b; }

/* 空状态 */
.fc-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 50px 20px;
    text-align: center;
    color: var(--c-text-muted);
    font-size: 13px;
    line-height: 1.8;
}
.fc-empty .emoji { font-size: 40px; opacity: 0.7; }
.fc-empty b { color: var(--c-text); }

/* ---------- 侧栏 ---------- */
.fc-side {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: sticky;
    top: 76px;
}
.fc-selected { margin-bottom: 14px; }
.fc-selected-empty {
    font-size: 12.5px;
    color: var(--c-text-muted);
    padding: 14px;
    border-radius: 12px;
    background: var(--c-surface-soft);
    border: 1px dashed var(--c-border);
    text-align: center;
}
.fc-selected-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 800;
    color: var(--c-text);
    margin-bottom: 4px;
}
.fc-selected-base { font-size: 12px; color: var(--c-text-muted); }

.fc-field { margin-bottom: 12px; }
.fc-field > label {
    display: block;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--c-text-sub);
    margin-bottom: 7px;
}
.fc-input-wrap { position: relative; display: flex; align-items: center; }
.fc-input {
    width: 100%;
    height: 43px;
    padding: 0 52px 0 14px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    color: var(--c-text);
    background: var(--c-surface-soft);
    border: 1px solid var(--c-border);
    border-radius: 12px;
    outline: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
    -moz-appearance: textfield;
}
.fc-input::-webkit-outer-spin-button,
.fc-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.fc-input:focus { border-color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-primary-soft); }
.fc-suffix {
    position: absolute;
    right: 14px;
    font-size: 12px;
    color: var(--c-text-muted);
    pointer-events: none;
}

.fc-presets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
    margin-bottom: 14px;
}
.fc-preset {
    height: 33px;
    font-size: 12px;
    font-family: inherit;
    font-weight: 700;
    color: var(--c-text-sub);
    background: var(--c-surface-soft);
    border: 1px solid var(--c-border);
    border-radius: 9px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.fc-preset:hover { border-color: var(--c-primary); color: var(--c-primary); }
.fc-preset.active {
    background: rgba(255, 138, 61, 0.14);
    border-color: rgba(255, 138, 61, 0.55);
    color: #e06a10;
}

.fc-bill {
    list-style: none;
    border: 1px solid var(--c-border);
    border-radius: 13px;
    overflow: hidden;
}
.fc-bill li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 15px;
    font-size: 13px;
    border-bottom: 1px solid var(--c-border);
}
.fc-bill li:last-child { border-bottom: none; }
.fc-bill .k { color: var(--c-text-sub); }
.fc-bill .v { font-weight: 700; color: var(--c-text); }
.fc-bill li.total { background: var(--c-surface-soft); }
.fc-bill li.total .v { color: #e06a10; font-size: 15.5px; }

.fc-note { margin-top: 12px; }
.fc-note-line {
    font-size: 12px;
    line-height: 1.75;
    color: var(--c-text-sub);
}
.fc-note-line b { color: #e06a10; }
.fc-note-dim { color: var(--c-text-muted); font-size: 11px; margin-top: 6px; }
.fc-note-bars { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.fc-bar {
    display: grid;
    grid-template-columns: 34px 1fr 34px;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--c-text-muted);
}
.fc-bar-name { white-space: nowrap; }
.fc-bar-track {
    height: 7px;
    border-radius: 99px;
    background: var(--c-surface-soft);
    border: 1px solid var(--c-border);
    overflow: hidden;
}
.fc-bar-fill { display: block; height: 100%; border-radius: 99px; }
.fc-bar-val { text-align: right; font-weight: 700; color: var(--c-text-sub); }

/* 每日参考 */
.fc-ref-desc { font-size: 12.5px; line-height: 1.7; color: var(--c-text-sub); margin-bottom: 10px; }
.fc-ref-list {
    list-style: none;
    border: 1px solid var(--c-border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 10px;
}
.fc-ref-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 14px;
    font-size: 12.5px;
    border-bottom: 1px solid var(--c-border);
}
.fc-ref-list li:last-child { border-bottom: none; }
.fc-ref-list li span { color: var(--c-text-sub); }
.fc-ref-list li b { color: #e06a10; }
.fc-ref-tip { font-size: 11.5px; line-height: 1.75; color: var(--c-text-muted); }
.fc-ref-tip b { color: var(--c-text-sub); }

/* ---------- 免责 / 简介 ---------- */
.fc-disclaim {
    font-size: 12px;
    line-height: 1.85;
    color: var(--c-text-muted);
    background: var(--c-surface-soft);
    border: 1px solid var(--c-border);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 26px;
}
.fc-disclaim b { color: var(--c-text-sub); }
.fc-info { margin-bottom: 26px; }

/* ---------- 滚动条 ---------- */
.fc-list::-webkit-scrollbar { width: 8px; }
.fc-list::-webkit-scrollbar-thumb {
    background: rgba(130, 140, 160, 0.3);
    border-radius: 99px;
}
.fc-list::-webkit-scrollbar-track { background: transparent; }

/* ---------- 响应式 ---------- */
@media (max-width: 1000px) {
    .fc-layout { grid-template-columns: 1fr; }
    .fc-side { position: static; }
    .fc-list { max-height: none; }
}
@media (max-width: 620px) {
    .fc-card { padding: 16px; }
    .fc-search-row { flex-wrap: wrap; }
    .fc-sort-wrap { width: 100%; }
    .fc-sort { width: 100%; }
    .fc-list { grid-template-columns: 1fr; }
    .fc-presets { grid-template-columns: repeat(3, 1fr); }
}

/* ============ 黑夜模式 ============ */
[data-theme="dark"] .fc-search,
[data-theme="dark"] .fc-sort,
[data-theme="dark"] .fc-input,
[data-theme="dark"] .fc-cat,
[data-theme="dark"] .fc-preset,
[data-theme="dark"] .fc-item,
[data-theme="dark"] .fc-selected-empty,
[data-theme="dark"] .fc-bill,
[data-theme="dark"] .fc-ref-list,
[data-theme="dark"] .fc-bar-track { background: rgba(255, 255, 255, 0.04); }
[data-theme="dark"] .fc-sort option { background: #131c31; color: #e5e9f0; }
[data-theme="dark"] .fc-cat.is-active { color: #ffa96b; }
[data-theme="dark"] .fc-cat.is-active .fc-cat-num { color: #ffa96b; }
[data-theme="dark"] .fc-item.is-active {
    background: linear-gradient(135deg, rgba(255, 138, 61, 0.16), rgba(255, 138, 61, 0.06));
}
[data-theme="dark"] .fc-bill li.total { background: rgba(255, 255, 255, 0.05); }
[data-theme="dark"] .fc-bill li.total .v,
[data-theme="dark"] .fc-note-line b,
[data-theme="dark"] .fc-ref-list li b { color: #ffa96b; }
[data-theme="dark"] .fc-preset.active { color: #ffa96b; }
[data-theme="dark"] .fc-lv-1 { background: rgba(52, 199, 89, 0.22); color: #5fdd8b; }
[data-theme="dark"] .fc-lv-2 { background: rgba(255, 167, 38, 0.22); color: #ffc06b; }
[data-theme="dark"] .fc-lv-3 { background: rgba(255, 112, 67, 0.22); color: #ff9b7a; }
[data-theme="dark"] .fc-lv-4 { background: rgba(255, 82, 82, 0.22); color: #ff8a8a; }
[data-theme="dark"] .fc-disclaim { background: rgba(255, 255, 255, 0.03); }
