/* Ingredient Checker - loaded after emi-calculator.css and finance-tools.css */

.ic-seg { margin-bottom: 1rem; }
.ic-pick { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin: .25rem 0 .75rem; }
.ic-pick label.ic-pick-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem;
    padding: 1rem .5rem; border: 2px dashed var(--border); border-radius: var(--radius-md);
    background: var(--bg-primary); color: var(--text-primary); font-weight: 600; font-size: .95rem;
    cursor: pointer; text-align: center; margin: 0; transition: var(--transition);
}
.ic-pick label.ic-pick-btn:hover, .ic-pick label.ic-pick-btn:focus-within { border-color: var(--primary); color: var(--primary); }
.ic-pick label.ic-pick-btn svg { width: 28px; height: 28px; }
.ic-pick label.ic-pick-btn small { font-weight: 400; color: var(--text-secondary); font-size: .78rem; }
.ic-pick input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.ic-thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-bottom: .75rem; }
.ic-thumbs:empty { display: none; }
.ic-thumb { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: var(--bg-primary); }
.ic-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ic-thumb button {
    position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0;
    background: rgba(15,23,42,.75); color: #fff; font-size: 16px; line-height: 26px; cursor: pointer; padding: 0;
}
.ic-count { font-size: .85rem; color: var(--text-secondary); margin-bottom: .75rem; }

.ic-consent { margin: .5rem 0 .9rem; font-size: .88rem; }
.ic-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.ic-turnstile { margin: .25rem 0 .9rem; min-height: 65px; }

.btn[disabled] { opacity: .6; cursor: not-allowed; }

/* Loading */
.ic-loading { text-align: center; padding: 2rem 1rem; }
.ic-spinner { width: 46px; height: 46px; margin: 0 auto 1rem; border-radius: 50%; border: 4px solid var(--border); border-top-color: var(--primary); animation: icspin 0.9s linear infinite; }
@keyframes icspin { to { transform: rotate(360deg); } }
.ic-loading p { color: var(--text-secondary); }

/* Result header */
.ic-hero { display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.ic-hero h2 { font-family: 'Outfit', sans-serif; font-size: 1.35rem; color: var(--text-primary); margin: 0 0 .25rem; }
.ic-hero p { color: var(--text-secondary); margin: 0; line-height: 1.6; }
.ic-badge { display: inline-block; padding: .35rem .8rem; border-radius: 999px; font-weight: 700; font-size: .85rem; white-space: nowrap; }
.r-good    { background: rgba(22,163,74,.14);  color: #15803d; }
.r-neutral { background: rgba(100,116,139,.15); color: var(--text-secondary); }
.r-caution { background: rgba(234,179,8,.18);  color: #a16207; }
.r-avoid   { background: rgba(220,38,38,.14);  color: #b91c1c; }
[data-theme="dark"] .r-good { color: #4ade80; }
[data-theme="dark"] .r-caution { color: #facc15; }
[data-theme="dark"] .r-avoid { color: #f87171; }

/* Pros / cons table */
.ic-pc { width: 100%; border-collapse: collapse; table-layout: fixed; }
.ic-pc th { text-align: left; padding: .6rem .75rem; font-size: .95rem; }
.ic-pc th.pro { background: rgba(22,163,74,.12); color: #15803d; border-radius: 10px 0 0 0; }
.ic-pc th.con { background: rgba(220,38,38,.1); color: #b91c1c; border-radius: 0 10px 0 0; }
[data-theme="dark"] .ic-pc th.pro { color: #4ade80; }
[data-theme="dark"] .ic-pc th.con { color: #f87171; }
.ic-pc td { vertical-align: top; padding: .55rem .75rem; border-bottom: 1px solid var(--border); color: var(--text-primary); font-size: .92rem; line-height: 1.5; }
.ic-pc td:first-child { border-right: 1px solid var(--border); }

/* Ingredient & nutrition tables (override the right-aligned, no-wrap schedule table) */
.ic-tbl { white-space: normal; }
.ic-tbl th, .ic-tbl td { text-align: left !important; vertical-align: top; }
.ic-tbl td { line-height: 1.45; }
.ic-tbl .ic-badge { white-space: nowrap; }
.ic-tbl td { min-width: 70px; }
.ic-ing td:first-child { min-width: 140px; }
/* Ingredient table */
.ic-ing td:nth-child(3) { white-space: nowrap; }
.ic-ing td { vertical-align: top; line-height: 1.45; }
.ic-ing td small { color: var(--text-secondary); display: none; }

.ic-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.ic-chip { padding: .3rem .7rem; border-radius: 999px; font-size: .85rem; background: rgba(220,38,38,.1); color: var(--text-primary); border: 1px solid rgba(220,38,38,.3); }
.ic-chip.ok { background: rgba(22,163,74,.1); border-color: rgba(22,163,74,.3); }

.ic-note { font-size: .82rem; color: var(--text-secondary); margin-top: .75rem; line-height: 1.55; }
.ic-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .25rem; }
.ic-actions .btn { width: auto; flex: 1 1 140px; white-space: nowrap; }
.btn-outline { background: transparent !important; color: var(--primary) !important; border: 2px solid var(--primary) !important; }

@media (max-width: 560px) {
    .ic-thumbs { grid-template-columns: repeat(4, 1fr); }
    .ic-pc th, .ic-pc td { padding: .5rem; font-size: .86rem; }
    .ic-ing td:nth-child(2) { display: none; }
    .ic-ing th:nth-child(2) { display: none; }
    .ic-ing td small { display: inline; }
}

/* Check-for-me chips */
.ic-prof { display: flex; flex-wrap: wrap; gap: .45rem; margin: .2rem 0 .4rem; }
.ic-prof-chip { position: relative; margin: 0 !important; cursor: pointer; }
.ic-prof-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ic-prof-chip span {
    display: inline-block; padding: .42rem .8rem; border-radius: 999px; border: 1px solid var(--border);
    background: var(--bg-primary); color: var(--text-primary); font-size: .85rem; font-weight: 500; transition: var(--transition);
}
.ic-prof-chip input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.ic-prof-chip input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Grade */
.ic-hero { flex-wrap: nowrap; justify-content: flex-start; }
.ic-grade {
    flex: 0 0 auto; width: 82px; height: 82px; border-radius: 50%; color: #fff;
    display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
}
.ic-grade b { font-family: 'Outfit', sans-serif; font-size: 2.1rem; font-weight: 800; }
.ic-grade span { font-size: .72rem; font-weight: 600; opacity: .95; margin-top: .2rem; }
.g-A { background: #16a34a; } .g-B { background: #65a30d; } .g-C { background: #ca8a04; } .g-D { background: #ea580c; } .g-E { background: #dc2626; }
.ic-verdict { margin-top: .85rem; }
.ic-pflags td { vertical-align: top; }
.ic-pflags td small { display: inline !important; color: var(--text-secondary); }
@media (max-width: 560px) { .ic-grade { width: 68px; height: 68px; } .ic-grade b { font-size: 1.7rem; } }
