/* ==========================================================================
   원재료 함량 추정 · 아미노산 추정 · 분석 인사이트
   공통 토큰: common.css (--ing-protein-*, --semantic-*)
   ========================================================================== */

.ing-decompose-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 0 0 22px;
}

.cfl-ing-panel {
    padding: 16px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg, 16px);
    background: var(--surface-card);
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.04);
}

.cfl-ing-panel__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.cfl-ing-panel__title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    font-size: 16px;
    font-weight: var(--font-weight-emphasis, 600);
    line-height: 1.4;
    color: var(--text-primary);
}

.cfl-ing-panel__title .cfl-status-icon {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    font-size: 13px;
    padding: 0;
    line-height: 1;
}

.cfl-ing-panel__title .cfl-status-icon i {
    font-size: 1em;
    line-height: 1;
}

.cfl-ing-help {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: 1px solid var(--border-default);
    border-radius: 50%;
    background: var(--surface-subtle);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: var(--font-weight-emphasis, 600);
    line-height: 1;
    cursor: help;
}

.cfl-ing-panel__meta {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    font-size: 10px;
    font-weight: var(--font-weight-normal, 400);
    line-height: 1.35;
    color: var(--text-muted);
}

.cfl-ing-panel__basis {
    font-weight: var(--font-weight-emphasis, 600);
    color: var(--text-tertiary);
}

.cfl-ing-panel__footer {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin: 12px 0 0;
    font-size: 10px;
    font-weight: var(--font-weight-normal, 400);
    line-height: 1.45;
    color: var(--text-muted);
}

.cfl-ing-panel__footer .fa-circle-info {
    margin-top: 1px;
    flex-shrink: 0;
}

/* ── 원재료 함량: donut + list ── */
.ing-decompose-body {
    display: grid;
    grid-template-columns: minmax(132px, 38%) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.ing-decompose-chart-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.ing-decompose-chart-col .ing-decompose-gauge {
    width: 112px;
    height: 112px;
}

.ing-decompose-chart-col .ing-decompose-gauge .flutd-profile__gauge-num {
    font-size: 24px;
}

.ing-decompose-chart-col .ing-decompose-gauge .flutd-profile__gauge-denom {
    font-size: 11px;
}

.ing-decompose-chart-col .ing-decompose-gauge-caption {
    margin: 0;
    font-size: 11px;
    font-weight: var(--font-weight-emphasis, 600);
    line-height: 1.35;
    color: var(--text-secondary);
    text-align: center;
}

.ing-decompose-plant-badge {
    padding: 5px 10px;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: var(--font-weight-emphasis, 600);
    line-height: 1.35;
    background: var(--ing-protein-plant-soft);
    color: var(--ing-protein-plant-ink);
}

.ing-decompose-list-col__title {
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: var(--font-weight-emphasis, 600);
    line-height: 1.35;
    color: var(--text-primary);
}

.ing-decompose-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ing-decompose-row {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) minmax(72px, 34%) auto 28px;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-secondary);
}

.ing-decompose-row__rank {
    font-size: 10px;
    font-weight: var(--font-weight-emphasis, 600);
    color: var(--text-muted);
    text-align: center;
}

.ing-decompose-row__name {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    overflow: hidden;
    font-weight: var(--font-weight-emphasis, 600);
    color: var(--text-primary);
}

.ing-decompose-row__name > :first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ing-decompose-row__profile {
    font-size: 0.65rem;
    font-weight: 400;
    line-height: 1.2;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ing-decompose-row__bar {
    height: 6px;
    border-radius: 3px;
    background: var(--border-soft);
    overflow: hidden;
}

.ing-decompose-row__bar-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--ing-row-bar, var(--ing-tone-meat));
}

.ing-decompose-row__pct {
    font-variant-numeric: tabular-nums;
    font-weight: var(--font-weight-emphasis, 600);
    color: var(--text-primary);
    text-align: right;
    white-space: nowrap;
}

.ing-decompose-row__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: 12px;
    flex-shrink: 0;
}

.ing-decompose-other {
    margin-top: 8px;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    background: var(--surface-subtle);
    overflow: hidden;
}

.ing-decompose-other > summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    font-size: 11px;
    font-weight: var(--font-weight-emphasis, 600);
    color: var(--text-secondary);
    cursor: pointer;
    list-style: none;
}

.ing-decompose-other > summary::-webkit-details-marker { display: none; }

.ing-decompose-other > summary .fa-chevron-down {
    margin-left: auto;
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.ing-decompose-other[open] > summary .fa-chevron-down {
    transform: rotate(180deg);
}

.ing-decompose-other__pct {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}

.ing-decompose-other__body {
    padding: 0 10px 10px;
    font-size: 10px;
    font-weight: var(--font-weight-normal, 400);
    line-height: 1.45;
    color: var(--text-muted);
}

/* ── 아미노산 카드 그리드 ── */
.ing-amino-panel {
    margin: 0;
    padding: 0;
    border: 0;
}

.ing-amino-panel .cfl-ing-panel__head-link {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: var(--font-weight-emphasis, 600);
    color: var(--semantic-purple-ink);
    text-decoration: none;
    white-space: nowrap;
}

.ing-amino-panel .cfl-ing-panel__head-link:hover {
    text-decoration: underline;
}

.cfl-ing-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: var(--font-weight-emphasis, 600);
    line-height: 1.35;
    background: var(--semantic-purple-bg);
    color: var(--semantic-purple-ink);
}

.ing-amino-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.ing-amino-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 12px;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    background: var(--surface-card);
}

.ing-amino-card__name {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: var(--font-weight-emphasis, 600);
    line-height: 1.35;
    color: var(--text-primary);
}

.ing-amino-card__value-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.ing-amino-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    font-size: 15px;
    line-height: 1;
}

.ing-amino-card__value {
    font-size: 18px;
    font-weight: var(--font-weight-emphasis, 600);
    line-height: 1.2;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.ing-amino-card__unit {
    display: block;
    font-size: 10px;
    font-weight: var(--font-weight-normal, 400);
    color: var(--text-muted);
}

.ing-amino-card__min {
    margin: 0 0 8px;
    font-size: 10px;
    font-weight: var(--font-weight-normal, 400);
    line-height: 1.4;
    color: var(--text-muted);
}

.ing-amino-card__badge {
    margin-top: auto;
    align-self: flex-start;
    padding: 3px 9px;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: var(--font-weight-emphasis, 600);
    line-height: 1.35;
}

.ing-amino-card__badge.is-safe {
    background: var(--semantic-success-bg);
    color: var(--semantic-success-ink);
}

.ing-amino-card__badge.is-good {
    background: var(--semantic-info-bg);
    color: var(--semantic-info-ink);
}

.ing-amino-card__badge.is-warning {
    background: var(--semantic-warning-bg);
    color: var(--semantic-warning-ink);
}

.ing-amino-card__badge.is-danger {
    background: var(--semantic-danger-bg);
    color: var(--semantic-danger-ink);
}

.ing-amino-card--arginine .ing-amino-card__icon {
    background: var(--semantic-purple-bg);
    color: var(--semantic-purple-solid);
}

.ing-amino-card--lysine .ing-amino-card__icon {
    background: var(--semantic-pink-bg);
    color: var(--semantic-pink-solid);
}

.ing-amino-card--methionine .ing-amino-card__icon {
    background: var(--semantic-warning-bg);
    color: var(--semantic-warning-solid);
}

.ing-amino-card--taurine .ing-amino-card__icon {
    background: var(--semantic-info-bg);
    color: var(--semantic-info-solid);
}

.ing-amino-footnotes {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
}

.ing-amino-footnotes p {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin: 0;
    font-size: 10px;
    font-weight: var(--font-weight-normal, 400);
    line-height: 1.45;
    color: var(--text-muted);
}

.ing-amino-footnotes .fa-circle-info {
    margin-top: 1px;
    flex-shrink: 0;
}

/* ── 분석 인사이트 (중립 행 + 아이콘만 소프트 accent) ── */
.cfl-ing-insights {
    padding: 16px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg, 16px);
    background: var(--surface-card);
}

.cfl-ing-insights__title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: var(--font-weight-emphasis, 600);
    line-height: 1.4;
    color: var(--text-primary);
}

.cfl-ing-insights__title-icon {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1;
}

.cfl-ing-insights__list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cfl-ing-insight {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--insight-row-border, var(--border-soft));
    background: var(--insight-row-bg, var(--surface-subtle));
}

.cfl-ing-insight__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    font-size: 14px;
    line-height: 1;
    background: var(--surface-card);
    border: 1px solid var(--border-soft);
}

.cfl-ing-insight.is-success .cfl-ing-insight__icon {
    color: var(--semantic-success-solid);
    background: color-mix(in srgb, var(--semantic-success-bg) 55%, var(--surface-card));
    border-color: color-mix(in srgb, var(--semantic-success-border) 65%, var(--border-soft));
}

.cfl-ing-insight.is-purple .cfl-ing-insight__icon {
    color: var(--semantic-purple-solid);
    background: color-mix(in srgb, var(--semantic-purple-bg) 55%, var(--surface-card));
    border-color: color-mix(in srgb, var(--semantic-purple-border) 65%, var(--border-soft));
}

.cfl-ing-insight.is-warning .cfl-ing-insight__icon {
    color: var(--semantic-warning-solid);
    background: color-mix(in srgb, var(--semantic-warning-bg) 55%, var(--surface-card));
    border-color: color-mix(in srgb, var(--semantic-warning-border) 65%, var(--border-soft));
}

.cfl-ing-insight.is-info .cfl-ing-insight__icon {
    color: var(--semantic-info-solid);
    background: color-mix(in srgb, var(--semantic-info-bg) 55%, var(--surface-card));
    border-color: color-mix(in srgb, var(--semantic-info-border) 65%, var(--border-soft));
}

.cfl-ing-insight__text {
    min-width: 0;
}

.cfl-ing-insight__title {
    margin: 0 0 4px;
    font-size: 12px;
    font-weight: var(--font-weight-emphasis, 600);
    line-height: 1.45;
    color: var(--text-primary);
}

.cfl-ing-insight__desc {
    margin: 0;
    font-size: 11px;
    font-weight: var(--font-weight-normal, 400);
    line-height: 1.45;
    color: var(--text-tertiary);
}

.ing-decompose-disclaimer {
    margin: 0;
    font-size: 10px;
    font-weight: var(--font-weight-normal, 400);
    line-height: 1.45;
    color: var(--text-muted);
    text-align: center;
}

/* nutrition_search 컨테이너 내부 — 박스 중첩 제거 */
.ns-ingredients-section .ing-decompose-stack {
    margin-bottom: 0;
}

.ns-ingredients-section .cfl-ing-panel,
.ns-ingredients-section .cfl-ing-insights {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.04);
}

@media (min-width: 768px) {
    .ing-amino-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .cfl-ing-panel__head {
        flex-direction: column;
        align-items: stretch;
    }

    .cfl-ing-panel__meta {
        flex-direction: row;
        align-items: center;
        justify-content: flex-end;
        gap: 6px;
    }

    .cfl-ing-panel__title {
        font-size: 15px;
    }

    .ing-decompose-body {
        grid-template-columns: 1fr;
    }

    .ing-decompose-chart-col {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .ing-decompose-row {
        grid-template-columns: 16px 1fr auto 26px;
        grid-template-rows: auto auto;
        gap: 4px 6px;
    }

    .ing-decompose-row__rank { grid-row: 1; grid-column: 1; }
    .ing-decompose-row__name { grid-row: 1; grid-column: 2; }
    .ing-decompose-row__pct { grid-row: 1; grid-column: 3; }
    .ing-decompose-row__icon { grid-row: 1; grid-column: 4; }
    .ing-decompose-row__bar { grid-row: 2; grid-column: 1 / -1; }

    .ing-amino-card__value {
        font-size: 16px;
    }
}

@media (min-width: 992px) {
    .cfl-ing-panel__title,
    .cfl-ing-insights__title {
        font-size: 18px;
    }

    .ing-decompose-chart-col .ing-decompose-gauge {
        width: 118px;
        height: 118px;
    }

    .ing-decompose-chart-col .ing-decompose-gauge .flutd-profile__gauge-num {
        font-size: 28px;
    }
}
