/* ---- Food barcode scanner (Meals tab) ---- */

/* ---- Food scanner: subtle single-row entry ---- */
.fscan-mini {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px; margin: 0 0 14px;
  cursor: pointer; color: #fff;
}
.fscan-mini:active { transform: scale(.98); }
.fscan-mini svg { width: 24px; height: 24px; color: var(--muted); flex-shrink: 0; }
.fscan-mini span { flex: 1; }
.fscan-mini span b { display: block; font-size: 14px; font-weight: 700; }
.fscan-mini span small { color: var(--muted); font-size: 12px; }
.fscan-mini em {
  font-style: normal; font-size: 13px; font-weight: 700;
  color: var(--red-soft, #ff6b62);
  border: 1px solid rgba(225,6,0,.4); border-radius: 20px;
  padding: 6px 14px; flex-shrink: 0;
}

/* modal */
.scan-modal {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0,0,0,.82);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.scan-modal[hidden] { display: none; }
.scan-box {
  position: relative; width: min(480px, 100%); max-height: 92vh; overflow-y: auto;
  background: #101013; border: 1px solid var(--line); border-radius: 18px;
  padding: 22px 18px 18px;
}
.scan-close {
  position: absolute; top: 8px; right: 12px;
  background: none; border: none; color: var(--muted);
  font-size: 30px; line-height: 1; cursor: pointer; padding: 6px;
}
.scan-close:active { color: #fff; }

/* viewfinder */
.scan-viewfinder { position: relative; border-radius: 14px; overflow: hidden; background: #000; }
.scan-viewfinder video { width: 100%; display: block; aspect-ratio: 4/3; object-fit: cover; background: #000; }
.scan-frame { position: absolute; inset: 0; pointer-events: none; }
.scan-frame .corner { position: absolute; width: 28px; height: 28px; border: 3px solid var(--red); }
.scan-frame .tl { top: 18%; left: 12%; border-right: none; border-bottom: none; border-radius: 8px 0 0 0; }
.scan-frame .tr { top: 18%; right: 12%; border-left: none; border-bottom: none; border-radius: 0 8px 0 0; }
.scan-frame .bl { bottom: 18%; left: 12%; border-right: none; border-top: none; border-radius: 0 0 0 8px; }
.scan-frame .br { bottom: 18%; right: 12%; border-left: none; border-top: none; border-radius: 0 0 8px 0; }
.scan-line {
  position: absolute; left: 12%; right: 12%; top: 18%; height: 2px;
  background: var(--red); box-shadow: 0 0 12px var(--red);
  animation: scanSweep 2.2s ease-in-out infinite;
}
@keyframes scanSweep {
  0%, 100% { top: 18%; } 50% { top: calc(82% - 2px); }
}
.scan-status {
  position: absolute; bottom: 0; left: 0; right: 0;
  margin: 0; padding: 10px; text-align: center;
  font-size: 13px; color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.75));
}

/* manual entry */
.scan-manual { margin-top: 16px; }
.scan-manual label { font-size: 11px; letter-spacing: .12em; color: var(--muted); }
.scan-manual-row { display: flex; gap: 8px; margin-top: 6px; }
.scan-manual-row input {
  flex: 1; background: #0a0a0c; border: 1px solid var(--line);
  border-radius: 10px; padding: 12px; color: #fff; font-size: 16px;
}

/* result card */
.scan-result-box { padding-top: 18px; }
.scan-product-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.scan-product-head img {
  width: 76px; height: 76px; object-fit: contain;
  background: #fff; border-radius: 12px; flex-shrink: 0;
}
.scan-product-head h3 { margin: 0; font-size: 17px; line-height: 1.25; }
.scan-product-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.scan-grade-row { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.scan-grade {
  width: 64px; height: 64px; border-radius: 16px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 34px; font-weight: 900; color: #fff;
}
.scan-grade.gA { background: #22c55e; } .scan-grade.gB { background: #84cc16; }
.scan-grade.gC { background: #eab308; } .scan-grade.gD { background: #f97316; }
.scan-grade.gE { background: #e10600; } .scan-grade.gX { background: #444; }
.scan-grade-label { font-size: 13px; color: var(--muted); }
.scan-grade-label b { color: #fff; display: block; font-size: 14px; }

.scan-nutri-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px;
}
.scan-nutri { background: #0a0a0c; border: 1px solid var(--line); border-radius: 10px; padding: 10px 6px; text-align: center; }
.scan-nutri b { display: block; font-size: 15px; }
.scan-nutri small { color: var(--muted); font-size: 10px; letter-spacing: .06em; }

.scan-nova {
  display: flex; align-items: center; gap: 10px;
  background: #0a0a0c; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 12px; font-size: 13px;
}
.scan-nova .nova-dots { display: flex; gap: 4px; }
.scan-nova .nova-dots i { width: 10px; height: 10px; border-radius: 50%; background: #333; }
.scan-nova .nova-dots i.on { background: var(--red); }

.scan-flags { margin-bottom: 12px; }
.scan-flag {
  display: inline-block; font-size: 12px; font-weight: 700;
  background: rgba(225,6,0,.14); color: #ff8a80;
  border: 1px solid rgba(225,6,0,.4); border-radius: 20px;
  padding: 5px 12px; margin: 0 6px 6px 0;
}

.scan-verdict {
  border-left: 3px solid var(--red); padding: 10px 14px; margin-bottom: 16px;
  background: rgba(225,6,0,.06); border-radius: 0 10px 10px 0;
}
.scan-verdict .eyebrow-red { margin-bottom: 4px; }
.scan-verdict p { margin: 0; font-size: 15px; font-weight: 600; }

.scan-actions { display: flex; flex-direction: column; gap: 8px; }
.scan-log-ok {
  text-align: center; color: #22c55e; font-weight: 700;
  padding: 12px; font-size: 14px;
}
.scan-error { text-align: center; padding: 20px 10px; }
.scan-error p { color: var(--muted); margin: 10px 0 16px; font-size: 14px; }
