/* ============================================================================
   IRNSCA Nutrition Application — Calculators (2.2.0)
   Hub of 20 gradient tiles (ranked), category chips, calculator panel with live
   results, gauges, zones, rings and the ℹ information sheet.
   Mobile first; logical properties for RTL; no backdrop-filter on phones and no
   infinite animation on large layers (iOS performance rules, SETUP §22.6).
   ============================================================================ */

#calculators-section .nc-root { display: flex; flex-direction: column; gap: 18px; margin-top: 14px; }

/* ── category chips ─────────────────────────────────────────────────────── */
.nc-cats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.nc-cat {
  --c: #00c2ff;
  min-height: 36px; padding: 6px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
  background: color-mix(in srgb, var(--c) 10%, transparent);
  color: var(--text-primary); font: inherit; font-size: 0.82rem; font-weight: 700;
  transition: transform var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}
.nc-cat:hover { transform: translateY(-1px); }
.nc-cat.is-on { background: var(--c); color: #fff; border-color: transparent; box-shadow: 0 6px 18px color-mix(in srgb, var(--c) 45%, transparent); }
.nc-cat:focus-visible { outline: 2px solid var(--c); outline-offset: 2px; }

/* ── tiles ──────────────────────────────────────────────────────────────── */
.nc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.nc-tile {
  --a: #00c2ff; --b: #9d00ff;
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 12px;
  min-height: 78px; padding: 12px 14px; border-radius: 18px; cursor: pointer; text-align: start;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: linear-gradient(135deg, var(--a), var(--b));
  color: #fff; font: inherit; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--b) 30%, transparent);
  transition: transform .25s cubic-bezier(.2, .8, .2, 1), box-shadow .25s ease, filter .25s ease;
  animation: nc-in .45s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 25ms);
}
.nc-tile::before { /* glassy highlight */
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(70% 60% at 15% 0%, rgba(255, 255, 255, 0.38), transparent 60%);
}
.nc-tile:hover { transform: translateY(-3px) scale(1.015); box-shadow: 0 12px 26px color-mix(in srgb, var(--b) 45%, transparent); }
.nc-tile:active { transform: translateY(0) scale(.99); }
.nc-tile:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.nc-tile.is-on { outline: 3px solid rgba(255, 255, 255, 0.95); outline-offset: -3px; box-shadow: 0 0 0 4px color-mix(in srgb, var(--a) 40%, transparent), 0 12px 28px color-mix(in srgb, var(--b) 50%, transparent); }
.nc-tile.is-hidden { display: none; }
.nc-tile__rank {
  position: absolute; top: 6px; inset-inline-end: 8px; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; background: rgba(0, 0, 0, 0.28); font-size: 0.7rem; font-weight: 800; line-height: 22px; text-align: center;
  font-family: system-ui, sans-serif;
}
.nc-tile__ico {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.2); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}
.nc-tile__ico svg { width: 26px; height: 26px; }
.nc-tile.is-on .nc-tile__ico { animation: nc-pulse 2.4s ease-in-out infinite; }
.nc-tile__txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding-inline-end: 18px; }
.nc-tile__txt b { font-size: 0.95rem; line-height: 1.25; font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-weight: 800; letter-spacing: .1px; text-align: start; }
.nc-tile__txt small { font-size: 0.74rem; opacity: 0.92; line-height: 1.35; }
.nc-tile__shine { /* sweep on hover only — no permanent animation */
  position: absolute; inset: -40% auto -40% -60%; width: 45%; z-index: -1; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  transform: skewX(-18deg) translateX(-120%); opacity: 0;
}
.nc-tile:hover .nc-tile__shine { animation: nc-shine .9s ease; }
@keyframes nc-shine { 0% { opacity: 0; transform: skewX(-18deg) translateX(-120%); } 30% { opacity: 1; } 100% { opacity: 0; transform: skewX(-18deg) translateX(420%); } }
@keyframes nc-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes nc-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

/* ── panel ──────────────────────────────────────────────────────────────── */
.nc-panel { --a: #00c2ff; --b: #9d00ff; position: relative; padding: 0 !important; overflow: hidden; border-radius: var(--radius-lg); }
.nc-panel::before { content: ''; display: block; height: 5px; background: linear-gradient(90deg, var(--a), var(--b)); }
.nc-panel__head { display: flex; align-items: center; gap: 14px; padding: 18px 20px 6px; }
.nc-panel__ico { flex: 0 0 52px; width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--a), var(--b)); box-shadow: 0 8px 20px color-mix(in srgb, var(--b) 40%, transparent); }
.nc-panel__ico svg { width: 28px; height: 28px; }
.nc-panel__titles { flex: 1; min-width: 0; }
.nc-panel__titles h3 { font-size: 1.25rem; line-height: 1.25; font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-weight: 800; text-align: start; }
.nc-panel__titles p { color: var(--text-secondary); font-size: 0.85rem; margin-top: 2px; }
.nc-info-btn {
  position: relative; flex: 0 0 44px; width: 44px; height: 44px; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; border: 0; color: #fff;
  background: linear-gradient(135deg, #ffb020, #ff3d7f); box-shadow: 0 6px 16px rgba(255, 61, 127, 0.35);
  transition: transform var(--transition-fast);
}
.nc-info-btn svg { display: none; }
.nc-info-btn span { font-size: 1.35rem; font-weight: 900; font-family: Georgia, 'Times New Roman', serif; line-height: 1; }
.nc-info-btn::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid rgba(255, 176, 32, 0.55); animation: nc-ring 2.6s ease-out infinite; }
.nc-info-btn:hover { transform: scale(1.08) rotate(-6deg); }
.nc-info-btn:focus-visible { outline: 3px solid #ffb020; outline-offset: 2px; }
@keyframes nc-ring { 0% { transform: scale(.9); opacity: .9; } 80%, 100% { transform: scale(1.35); opacity: 0; } }
.nc-fill { padding: 0 20px; color: var(--text-muted); font-size: 0.8rem; }

/* form */
.nc-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 14px; padding: 14px 20px 4px; }
.nc-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.nc-field--seg, .nc-field--food { grid-column: 1 / -1; }
.nc-label { font-size: 0.8rem; font-weight: 700; color: var(--text-secondary); }
.nc-label em { font-style: normal; font-weight: 500; color: var(--text-muted); }
.nc-inputwrap { position: relative; display: flex; align-items: center; }
.nc-input {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 12px; font: inherit; font-size: 1rem; font-weight: 700;
  color: var(--text-primary); background: rgba(127, 127, 127, 0.08); border: 1px solid var(--glass-border);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
select.nc-input { font-weight: 600; font-size: 0.9rem; cursor: pointer; }
.nc-inputwrap .nc-input { padding-inline-end: 64px; }
.nc-unit { position: absolute; inset-inline-end: 10px; font-size: 0.72rem; font-weight: 700; color: var(--text-muted); pointer-events: none; max-width: 56px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nc-input:focus { outline: none; border-color: var(--a); box-shadow: 0 0 0 3px color-mix(in srgb, var(--a) 30%, transparent); }
.nc-field.is-bad .nc-input { border-color: #ff4d6d; box-shadow: 0 0 0 3px rgba(255, 77, 109, 0.18); }
.nc-seg { display: inline-flex; flex-wrap: wrap; gap: 6px; padding: 4px; border-radius: 14px; background: rgba(127, 127, 127, 0.1); width: fit-content; max-width: 100%; }
.nc-seg button { min-height: 40px; padding: 6px 16px; border-radius: 10px; border: 0; cursor: pointer; font: inherit; font-weight: 700; font-size: 0.88rem; color: var(--text-secondary); background: transparent; transition: background var(--transition-fast), color var(--transition-fast); }
.nc-seg button.is-on { color: #fff; background: linear-gradient(135deg, var(--a), var(--b)); box-shadow: 0 4px 12px color-mix(in srgb, var(--b) 35%, transparent); }
.nc-foodrow { display: grid; grid-template-columns: 1fr 90px 130px; gap: 8px; }
.nc-input--sm { font-size: 0.9rem; }
.nc-foodmsg { color: #f59e0b; font-size: 0.75rem; min-height: 1em; }

.nc-actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 20px 4px; }
.nc-actions .btn { min-height: 44px; }
.nc-calc-btn { background: linear-gradient(135deg, var(--a), var(--b)) !important; border: 0 !important; }

/* results */
.nc-result { padding: 10px 20px 6px; }
.nc-result.is-pop .nc-result__in { animation: nc-in .35s cubic-bezier(.2, .8, .2, 1); }
.nc-empty { display: flex; align-items: center; gap: 10px; padding: 16px; border-radius: 14px; border: 1px dashed var(--glass-border); color: var(--text-muted); font-size: 0.88rem; }
.nc-empty svg { width: 22px; height: 22px; flex: 0 0 22px; color: var(--a); }
.nc-empty.is-warn { border-color: rgba(255, 77, 109, 0.5); color: #ff6b81; }
.nc-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.nc-kpi {
  --k: #00c2ff;
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 16px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--k) 16%, transparent), rgba(127, 127, 127, 0.05));
  border: 1px solid color-mix(in srgb, var(--k) 35%, transparent);
}
.nc-kpi::before { content: ''; position: absolute; inset-block: 10px; inset-inline-start: 0; width: 4px; border-radius: 4px; background: var(--k); }
.nc-kpi--big { grid-column: 1 / -1; }
.nc-kpi__lbl { font-size: 0.75rem; font-weight: 700; color: var(--text-secondary); line-height: 1.35; }
.nc-kpi__val { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; }
.nc-kpi__val b { font-size: 1.45rem; font-weight: 900; color: var(--text-primary); font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; letter-spacing: -.3px; }
html[lang="fa"] .nc-kpi__val b, html[lang="ar"] .nc-kpi__val b { font-family: var(--font-fa); }
.nc-kpi--big .nc-kpi__val b { font-size: 2.3rem; background: linear-gradient(90deg, var(--k), color-mix(in srgb, var(--k) 55%, #fff)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nc-kpi__val small { font-size: 0.78rem; color: var(--text-muted); font-weight: 700; }
.nc-kpi__sub { font-size: 0.74rem; color: var(--text-secondary); line-height: 1.45; }
.nc-sub { margin: 18px 0 8px; font-size: 0.95rem; }
.nc-note { margin-top: 12px; font-size: 0.8rem; color: var(--text-secondary); line-height: 1.7; padding: 10px 12px; border-radius: 12px; background: rgba(127, 127, 127, 0.07); }
.nc-warn { margin-top: 12px; font-size: 0.82rem; color: #ffb4c0; line-height: 1.7; padding: 10px 12px; border-radius: 12px; background: rgba(255, 77, 109, 0.12); border: 1px solid rgba(255, 77, 109, 0.35); }
[data-theme="light"] .nc-warn { color: #b4233a; }
.nc-disclaimer { padding: 6px 20px 18px; font-size: 0.72rem; color: var(--text-muted); }
.nc-legacy { display: none; }

/* split: donut + list */
.nc-split { display: grid; grid-template-columns: minmax(220px, 280px) 1fr; gap: 14px; align-items: center; }
.nc-split__list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.nc-chart { width: 100%; height: 240px; }
.nc-chart--line { height: 240px; margin-top: 12px; }

/* gauge */
.nc-gauge { position: relative; margin: 26px 4px 6px; }
.nc-gauge__track { display: flex; height: 14px; border-radius: 999px; overflow: hidden; box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3); }
.nc-gauge__track i { display: block; height: 100%; }
.nc-gauge__pin { position: absolute; top: -8px; width: 0; height: 30px; transform: translateX(-50%); transition: inset-inline-start .6s cubic-bezier(.2, .8, .2, 1); }
[dir="rtl"] .nc-gauge__pin { transform: translateX(50%); }
.nc-gauge__pin::before { content: ''; position: absolute; top: 4px; left: -2px; width: 4px; height: 22px; border-radius: 4px; background: var(--text-primary); box-shadow: 0 0 0 2px var(--bg-dark), 0 2px 8px rgba(0, 0, 0, 0.4); }
.nc-gauge__pin span { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); padding: 2px 8px; border-radius: 8px; background: var(--text-primary); color: var(--bg-dark); font-size: 0.72rem; font-weight: 800; white-space: nowrap; }
.nc-gauge__legend { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 12px; font-size: 0.72rem; color: var(--text-secondary); }
.nc-gauge__legend span { display: inline-flex; align-items: center; gap: 6px; }
.nc-gauge__legend span::before { content: ''; width: 10px; height: 10px; border-radius: 3px; background: var(--c); }

/* zones (heart rate) */
.nc-zones { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.nc-zone { display: grid; grid-template-columns: 46px 1fr auto; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: linear-gradient(90deg, color-mix(in srgb, var(--z) 22%, transparent), transparent 80%); border: 1px solid color-mix(in srgb, var(--z) 35%, transparent); animation: nc-in .4s both; animation-delay: calc(var(--i) * 60ms); }
[dir="rtl"] .nc-zone { background: linear-gradient(270deg, color-mix(in srgb, var(--z) 22%, transparent), transparent 80%); }
.nc-zone__n { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--z); color: #fff; font-weight: 900; font-family: system-ui, sans-serif; }
.nc-zone__body { display: flex; flex-direction: column; min-width: 0; }
.nc-zone__body b { font-size: 0.9rem; }
.nc-zone__body small { font-size: 0.74rem; color: var(--text-secondary); }
.nc-zone__v { font-weight: 900; font-size: 1rem; white-space: nowrap; }

/* range bar */
.nc-range { margin-top: 14px; }
.nc-range__track { position: relative; height: 12px; border-radius: 999px; background: rgba(127, 127, 127, 0.15); }
.nc-range__track i { position: absolute; top: 0; bottom: 0; border-radius: 999px; background: linear-gradient(90deg, color-mix(in srgb, var(--c) 60%, #fff), var(--c)); box-shadow: 0 0 12px color-mix(in srgb, var(--c) 60%, transparent); }
.nc-range span { display: block; margin-top: 6px; font-size: 0.75rem; color: var(--text-secondary); }

/* tables, chips, glasses */
.nc-table-wrap { overflow-x: auto; margin-top: 14px; border-radius: 14px; border: 1px solid var(--glass-border); }
.nc-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.nc-table th, .nc-table td { padding: 9px 12px; text-align: start; border-bottom: 1px solid var(--glass-border); white-space: nowrap; }
.nc-table th { font-size: 0.74rem; color: var(--text-muted); font-weight: 800; background: rgba(127, 127, 127, 0.06); }
.nc-table tr:last-child td { border-bottom: 0; }
.nc-table tr.is-hi td { background: color-mix(in srgb, var(--a) 14%, transparent); font-weight: 700; }
.nc-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.nc-chip { padding: 6px 12px; border-radius: 999px; background: rgba(127, 127, 127, 0.1); border: 1px solid var(--glass-border); font-size: 0.8rem; }
.nc-glasses { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.nc-glasses i { width: 18px; height: 26px; border-radius: 3px 3px 6px 6px; background: linear-gradient(180deg, rgba(56, 189, 248, 0.25) 0 25%, #38bdf8 25% 100%); box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.6); animation: nc-in .3s both; }
.nc-num { font-variant-numeric: tabular-nums; }

/* ── ℹ information sheet (shared with the food-metric info, see features.css) ── */

/* ── mobile ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .nc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .nc-tile { grid-template-columns: 1fr; gap: 6px; min-height: 104px; padding: 10px; align-content: start; box-shadow: 0 4px 10px color-mix(in srgb, var(--b) 25%, transparent); }
  .nc-tile__ico { width: 38px; height: 38px; border-radius: 12px; }
  .nc-tile__ico svg { width: 22px; height: 22px; }
  .nc-tile__txt { padding-inline-end: 0; }
  .nc-tile__txt b { font-size: 0.82rem; }
  .nc-tile__txt small { font-size: 0.68rem; }
  .nc-cats { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .nc-cats::-webkit-scrollbar { display: none; }
  .nc-cat { flex: 0 0 auto; }
  .nc-panel__head { padding: 14px 14px 4px; gap: 10px; }
  .nc-panel__ico { flex-basis: 44px; width: 44px; height: 44px; }
  .nc-panel__titles h3 { font-size: 1.05rem; }
  .nc-form { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px 14px 4px; gap: 10px; }
  .nc-form select.nc-input { font-size: 0.82rem; }
  .nc-fill, .nc-disclaimer { padding-inline: 14px; }
  .nc-actions, .nc-result { padding-inline: 14px; }
  .nc-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nc-kpi__val b { font-size: 1.2rem; }
  .nc-kpi--big .nc-kpi__val b { font-size: 1.9rem; }
  .nc-split { grid-template-columns: 1fr; }
  .nc-split__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nc-foodrow { grid-template-columns: 1fr 70px; }
  .nc-foodrow select[data-f="food"] { grid-column: 1 / -1; }
  .nc-zone { grid-template-columns: 38px 1fr; }
  .nc-zone__n { width: 38px; height: 38px; }
  .nc-zone__v { grid-column: 2; }
}
@media (max-width: 380px) {
  .nc-form { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .nc-tile, .nc-zone, .nc-glasses i, .nc-result.is-pop .nc-result__in { animation: none !important; }
  .nc-tile.is-on .nc-tile__ico, .nc-info-btn::after, .nc-tile:hover .nc-tile__shine { animation: none !important; }
  .nc-gauge__pin { transition: none; }
}

/* English names inside right-to-left layouts sit on the reading side */
[dir="rtl"] .nc-tile__txt b[dir="ltr"], [dir="rtl"] .nc-panel__titles h3[dir="ltr"], [dir="rtl"] .nutri-info__hero h3[dir="ltr"] { text-align: right; }
