/* theme: manual light/dark (html.theme-light / html.theme-dark) */
/* E-number guide and label checker (enumbers.php, enumber.php, label.php). Builds on style.css. */

.food-page .card { margin-bottom: 16px; }
.food-page .card h2 { font-size: 1.1rem; margin: 0 0 10px; }
.food-page h2 label { display: inline; font-size: inherit; font-weight: inherit; color: inherit; margin: 0; }
.food-lead { color: var(--muted); line-height: 1.5; margin: 0 0 18px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.food-page a { color: var(--green-700); }
@media (prefers-color-scheme: dark) { html:not(.theme-light) .food-page a { color: #7fd1b8; } }
html.theme-dark .food-page a { color: #7fd1b8; }

.food-page a.btn { color: var(--text); }
.food-page a.btn.primary { color: #fff; }

/* the tab row under the logo */
.food-tabs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin: -4px 0 18px; }
.food-tabs a { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; font-size: .9rem; font-weight: 600; }
.food-tabs a.active { background: var(--green-700); border-color: var(--green-700); color: #fff; }

/* tick-boxes as chips */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.food-page label.chip { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 6px 11px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg); color: var(--text); font-size: .88rem; font-weight: 500; cursor: pointer; user-select: none; }
.food-page label.chip input { margin: 0; accent-color: var(--green-700); }
.food-page label.chip:has(input:checked) { background: var(--green-100); border-color: var(--green-600); }

/* guide */
.food-search .add-row input[type="search"] { flex: 1 1 200px; width: auto; min-width: 0; }
.food-search .add-row .btn.primary { width: auto; margin-top: 0; flex: 0 0 auto; }
.ad-risk-filter { margin-top: 12px; }
.ad-risk-filter summary { cursor: pointer; font-weight: 600; font-size: .9rem; margin-bottom: 8px; }
.ad-jump { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.ad-jump a { font-size: .82rem; padding: 4px 10px; border-radius: 999px; background: var(--green-100); text-decoration: none; }
.ad-group { scroll-margin-top: 12px; }
.ad-group h2 small { font-weight: 500; font-size: .8rem; }
.ad-list { list-style: none; margin: 0; padding: 0; }
.ad-item { padding: 8px 0; border-top: 1px solid var(--border); }
.ad-item:first-child { border-top: 0; }
.ad-item > a { text-decoration: none; display: block; }
.ad-item .small { margin-top: 2px; }
.ad-item.ad-flash { animation: adFlash 1.8s ease-out; }
@keyframes adFlash { 0%, 35% { background-color: rgba(255, 193, 7, .35); } 100% { background-color: transparent; } }
@media (prefers-reduced-motion: reduce) { .ad-item.ad-flash { animation: none; } }
.ad-count { scroll-margin-top: 12px; margin: 10px 0 0; }

.ad-risk { display: inline-block; font-size: .7rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; border: 1px solid transparent; vertical-align: 1px; margin-left: 2px; }
.ad-risk-u { background: #c0392b; color: #fff; }
.ad-risk-p { background: #fff3cd; color: #664d03; border-color: #ffe69c; }
@media (prefers-color-scheme: dark) { html:not(.theme-light) .ad-risk-p { background: #332701; color: #ffda6a; border-color: #664d03; } }
html.theme-dark .ad-risk-p { background: #332701; color: #ffda6a; border-color: #664d03; }


.ad-detail h2 { margin-top: 16px !important; }
.ad-detail h2:first-child { margin-top: 0 !important; }
.ad-risk-list { list-style: none; padding: 0; margin: 0 0 12px; }
.ad-risk-list li { padding: 6px 0; border-top: 1px solid var(--border); }
.ad-risk-list li:first-child { border-top: 0; }
.ad-note { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.food-tip { background: var(--green-100); border-radius: 10px; padding: 10px 12px; }
.ad-related ul { margin: 0 0 12px; padding-left: 18px; }
.ad-related li { margin: 3px 0; }
.ad-prevnext { display: flex; justify-content: space-between; gap: 10px; }

/* checker */
.lc-scan-buttons { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.lc-scan-buttons .btn.primary { width: auto; margin-top: 0; }
.lc-scan-buttons select { padding: 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: .95rem; }
.lc-bc-row input { flex: 1 1 160px; width: auto; min-width: 0; }
.lc-bc-row .btn { flex: 0 0 auto; }
.lc-preview { display: block; max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; background: #fff; }
.lc-progress { height: 8px; background: var(--border); border-radius: 999px; overflow: hidden; margin-bottom: 6px; }
.lc-progress-bar { height: 100%; width: 0; background: var(--green-600); transition: width .2s; }
.lc-item p { margin: 0 0 8px; }
.food-page textarea { width: 100%; font: inherit; font-size: 1rem; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); resize: vertical; min-height: 120px; }
.food-page textarea:focus { outline: 2px solid var(--green-600); outline-offset: 1px; }
.lc-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.lc-actions .btn.primary { width: auto; margin-top: 0; }
.lc-actions .link-btn { padding: 0 6px; }

.lc-note { border-radius: 10px; padding: 10px 12px; margin: 8px 0; line-height: 1.45; border-left: 4px solid var(--muted); background: var(--bg); }
.lc-note div { margin-top: 4px; }
.lc-note .btn { margin-top: 8px; padding: 8px 12px; font-size: .9rem; }
.lc-note-ok { border-color: #21876f; }
.lc-note-warn { border-color: #e0a800; }
.lc-note-error { border-color: #c0392b; }
.lc-note-info { border-color: #3b7dd8; }

.lc-result { scroll-margin-top: 12px; }
.lc-summary { list-style: none; margin: 0 0 10px; padding: 0; }
.lc-verdict { padding: 8px 12px; border-left: 4px solid var(--muted); border-radius: 6px; margin-bottom: 6px; background: var(--bg); }
.lc-verdict.lc-found { border-color: #c0392b; }
.lc-verdict.lc-possible { border-color: #e0a800; }
.lc-verdict.lc-trace { border-color: #3b7dd8; }
.lc-text { white-space: pre-wrap; line-height: 1.9; overflow-wrap: anywhere; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
mark.lc-mark { padding: .1em .3em; border-radius: .3em; color: inherit; }
mark.lc-contains { background: #f8d7da; box-shadow: inset 0 -2px 0 #dc3545; }
mark.lc-check { background: #fff3cd; box-shadow: inset 0 -2px 0 #ffc107; }
mark.lc-trace { background: #cfe2ff; box-shadow: inset 0 -2px 0 #0d6efd; }
mark.lc-claim { background: #d1e7dd; box-shadow: inset 0 -2px 0 #198754; }
mark.lc-info, mark.lc-other { background: #e2e3e5; box-shadow: inset 0 -2px 0 #6c757d; }
mark.lc-additive { background: #e7e0f5; box-shadow: inset 0 -2px 0 #6f42c1; }
.lc-findings { list-style: none; margin: 0 0 10px; padding: 0; }
.lc-findings > li { padding: 10px 0; border-top: 1px solid var(--border); }
.lc-find-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; }
.lc-badge { font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; color: #212529; background: #e2e3e5; }
.lc-badge.lc-contains { background: #f8d7da; } .lc-badge.lc-check { background: #fff3cd; } .lc-badge.lc-trace { background: #cfe2ff; }
.lc-badge.lc-claim { background: #d1e7dd; } .lc-badge.lc-additive { background: #e7e0f5; }
.lc-details { margin: 8px 0; }
.lc-details summary { cursor: pointer; }
@media (prefers-color-scheme: dark) {
  html:not(.theme-light) mark.lc-contains { background: #58151c; color: #f1aeb5; } html:not(.theme-light) mark.lc-check { background: #332701; color: #ffda6a; } html:not(.theme-light) mark.lc-trace { background: #031633; color: #9ec5fe; }
  html:not(.theme-light) mark.lc-claim { background: #051b11; color: #75b798; } html:not(.theme-light) mark.lc-info, html:not(.theme-light) mark.lc-other { background: #343a40; color: #dee2e6; } html:not(.theme-light) mark.lc-additive { background: #2c1f4f; color: #cbb6f2; }
  html:not(.theme-light) .lc-badge { color: #fff; background: #495057; } html:not(.theme-light) .lc-badge.lc-contains { background: #58151c; } html:not(.theme-light) .lc-badge.lc-check { background: #664d03; } html:not(.theme-light) .lc-badge.lc-trace { background: #052c65; }
  html:not(.theme-light) .lc-badge.lc-claim { background: #0f5132; } html:not(.theme-light) .lc-badge.lc-additive { background: #432874; }
}
html.theme-dark mark.lc-contains { background: #58151c; color: #f1aeb5; } html.theme-dark mark.lc-check { background: #332701; color: #ffda6a; } html.theme-dark mark.lc-trace { background: #031633; color: #9ec5fe; }
  html.theme-dark mark.lc-claim { background: #051b11; color: #75b798; } html.theme-dark mark.lc-info, html.theme-dark mark.lc-other { background: #343a40; color: #dee2e6; } html.theme-dark mark.lc-additive { background: #2c1f4f; color: #cbb6f2; }
  html.theme-dark .lc-badge { color: #fff; background: #495057; } html.theme-dark .lc-badge.lc-contains { background: #58151c; } html.theme-dark .lc-badge.lc-check { background: #664d03; } html.theme-dark .lc-badge.lc-trace { background: #052c65; }
  html.theme-dark .lc-badge.lc-claim { background: #0f5132; } html.theme-dark .lc-badge.lc-additive { background: #432874; }


/* live barcode camera: a wide, low frame instead of the QR square */
#bc-sheet .scan-video-wrap { aspect-ratio: 4 / 3; }
#bc-sheet .scan-video-wrap::after { display: none; }
.bc-frame { position: absolute; left: 10%; right: 10%; top: 32%; bottom: 32%; border: 3px solid rgba(255,255,255,.85); border-radius: 12px; pointer-events: none; }

/* homepage "check what's in your food" section and the two menu links in the top bar */
.tools { padding: 8px 0 48px; scroll-margin-top: 70px; }
.tools h2 { font-size: clamp(1.5rem, 4vw, 2.1rem); letter-spacing: -.01em; margin: 0 0 8px; text-wrap: balance; }
.tools-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.tool-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; align-items: flex-start; }
.tool-card h3 { margin: 0 0 6px; font-size: 1.1rem; }
.tool-card p { color: var(--muted); line-height: 1.5; margin: 0 0 10px; font-size: .95rem; }
.tool-card ul { color: var(--muted); margin: 0 0 16px; padding-left: 18px; line-height: 1.5; font-size: .93rem; }
.tool-card .btn { margin-top: auto; width: auto; text-decoration: none; display: inline-flex; }
.tools-hint { margin: 14px 0 0; }
.home-nav-tools { display: none; }
@media (max-width: 760px) {
  .home-nav > a.home-nav-food { display: none; }
  .home-nav > a.home-nav-tools { display: inline-block; }
}
.home-nav > a.home-nav-tools svg { display: none; }
@media (max-width: 420px) {
  .home-nav > a { padding: 8px 4px; font-size: .84rem; }
  .home-nav > a.home-nav-tools { display: inline-flex; align-items: center; padding: 4px; }
  .home-nav > a.home-nav-tools svg { display: block; width: 22px; height: 22px; color: var(--green-700); }
  .home-nav > a.home-nav-tools span { display: none; }
  .home-logo { padding: 3px 6px; }
  .home-logo img { height: 25px; }
}

/* Right-to-left languages (Arabic) */
[dir="rtl"] .lc-note, [dir="rtl"] .lc-verdict { border-left: 0; border-right: 4px solid var(--muted); }
[dir="rtl"] .ad-related ul, [dir="rtl"] .tool-card ul { padding-left: 0; padding-right: 18px; }
