/* ==========================================================================
   HalalCheck — design system (redesign da design_handoff_halalcheck/)
   Palette verde monocromatica, Poppins (titoli) + Manrope (corpo testo).
   Scritto con proprieta' logiche CSS (margin-inline-start, text-align:start,
   ecc.) invece di left/right, cosi' il layout si specchia da solo quando
   <html dir="rtl"> (arabo) - vedi frontend/i18n.js.
   ========================================================================== */

:root {
  /* Colore primario e variante scura (header/bottoni/gradiente) */
  --brand: #2D6A4F;
  --brand-dark: #1B4534;
  --brand-tint: #EAF4EF;
  --brand-border: #BFE0D0;

  --text: #1B3A2C;
  --text-body: #3C4A44;
  --text-muted: #5C6A63;
  --text-faint: #8A968F;
  --border: #E3E8E5;
  --surface: #ffffff;
  --bg: #EFF3F1;

  /* Toni verdetto (bg/bordo/testo) */
  --halal-bg: #EAF4EF; --halal-border: #BFE0D0; --halal-text: #2D6A4F;
  --haram-bg: #FBEAE7; --haram-border: #F1C7C0; --haram-text: #B3382C;
  --mashbooh-bg: #FBF1DC; --mashbooh-border: #EAD9A6; --mashbooh-text: #9C6B0A;
  --unknown-bg: #F1F3F2; --unknown-border: #DDE3E0; --unknown-text: #5C6A63;

  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 11px;
  --radius-pill: 999px;

  --shadow-btn: 0 6px 16px rgba(45, 106, 79, 0.28);
  --shadow-card: 0 2px 10px rgba(45, 106, 79, 0.08);
  --shadow-float: 0 20px 50px rgba(27, 58, 44, 0.14);

  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

h1, h2, h3, .font-display {
  font-family: 'Poppins', 'Manrope', sans-serif;
}

.hidden { display: none !important; }

button, input, select, textarea { font-family: inherit; }

a { color: var(--brand); }

/* --- Shell: su schermi larghi la app resta una "card" telefono-simile
   centrata, come nella vista Desktop del design; su mobile occupa tutto. -- */
.app-shell {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: stretch;
}

@media (min-width: 640px) {
  body { padding: 32px 16px; }
  .app-shell {
    min-height: calc(100vh - 64px);
  }
  .app-frame {
    width: 100%;
    max-width: 430px;
    background: var(--surface);
    border-radius: 22px;
    box-shadow: var(--shadow-float);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 780px;
  }
}

.app-frame {
  width: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  position: relative;
}

/* --- Login (login.html): split-screen su desktop, stesso schema visivo del
   pannello admin (vedi admin.css .admin-login-shell/.admin-login-aside),
   scelto al posto della card stretta usata dalle altre pagine perche'
   richiesto esplicitamente. Attivo SOLO quando login.html aggiunge le
   classi "auth-page"/"auth-shell" (vedi login.html): le altre pagine che
   condividono .app-shell/.app-frame (index.html, verify-email.html,
   reset-password.html, privacy.html) restano con la card centrata di
   sempre, invariata. --- */

.auth-aside { display: none; }

@media (min-width: 900px) {
  body.auth-page { padding: 0; }

  .auth-shell {
    min-height: 100vh;
    align-items: stretch;
    justify-content: flex-start;
  }

  .auth-shell .auth-aside {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 42%;
    max-width: 560px;
    flex-shrink: 0;
    background: linear-gradient(155deg, var(--brand-dark), var(--brand));
    color: #ffffff;
    padding: 56px;
  }

  .auth-aside-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.16);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 22px;
  }

  .auth-aside-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 800;
    font-size: 25px;
    line-height: 1.3;
    margin-bottom: 12px;
    max-width: 340px;
  }

  .auth-aside-sub {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.55;
    max-width: 330px;
  }

  .auth-shell .app-frame {
    flex: 1;
    width: auto;
    max-width: none;
    min-height: 100vh;
    box-shadow: none;
    border-radius: 0;
  }

  .auth-shell .screen { justify-content: center; }

  .auth-shell .lang-pills,
  .auth-shell .screen-body,
  .auth-shell .state-center {
    max-width: 400px;
    width: 100%;
    margin: 0 auto;
  }
}

/* --- App vera e propria (index.html: home/scansione/risultato/ecc.): su
   desktop un vero layout a piu' colonne (proporzioni vicine al pannello
   admin, vedi admin.css .admin-container max-width:1180px), non solo una
   card mobile allargata. Tutto qui sotto e' SOLO CSS, applicato via le
   classi "app-page" (body) gia' presenti in index.html insieme agli
   id/classi stabili usati da app.js: nessuna modifica a struttura HTML o
   JS, per non rischiare di rompere la navigazione tra le schermate. La
   scansione (#scan-section, fotocamera a schermo intero scuro) resta
   invariata: un mirino di fotocamera non ha bisogno di un layout a piu'
   colonne. --- */
@media (min-width: 900px) {
  /* "min(92vw, 1400px)" invece di un numero fisso: la card si allarga
     insieme alla finestra del browser (schermo piccolo o grande, non
     resta mai piccola e "persa" al centro con bordi grigi enormi
     intorno), ma non diventa mai assurdamente larga su monitor molto
     grandi grazie al tetto di 1400px. */
  body.app-page .app-frame {
    width: min(92vw, 1400px);
    max-width: min(92vw, 1400px);
    min-height: 86vh;
  }

  /* Intestazioni (banner verde home, topbar delle altre schermate): un
     filo piu' di respiro laterale ora che la card e' molto piu' larga. */
  body.app-page .home-header,
  body.app-page .screen-topbar {
    padding-left: 28px;
    padding-right: 28px;
  }

  /* Navigazione: da barra in basso stile telefono (icone sotto etichetta,
     spaziate a tutta larghezza) a barra di schede orizzontale IN ALTO,
     sopra il contenuto della schermata attiva - "order: -1" la sposta
     prima nel flusso flex di ".screen" senza spostare nulla nell'HTML,
     quindi la logica di app.js (che aggiunge/toglie solo la classe
     "active" sui bottoni) resta identica. */
  body.app-page .bottom-nav {
    order: -1;
    justify-content: flex-start;
    gap: 6px;
    padding: 14px 28px;
    border-top: none;
    border-bottom: 1px solid var(--border);
  }

  body.app-page .bottom-nav button {
    flex-direction: row;
    gap: 7px;
    padding: 9px 16px;
    border-radius: var(--radius-pill);
  }

  body.app-page .bottom-nav button.active {
    background: var(--brand-tint);
  }

  /* Home: la card "scansiona" a sinistra, le scansioni recenti a destra -
     invece di stare tutte impilate in un'unica colonna strettissima. */
  body.app-page #home-section .screen-body {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 28px;
    align-items: start;
    padding-top: 28px;
  }

  body.app-page #home-section .scan-cta-card {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  body.app-page #home-section .section-title-row {
    grid-column: 2;
    grid-row: 1;
    margin-top: 0;
  }

  body.app-page #home-section #home-recent-list {
    grid-column: 2;
    grid-row: 2;
  }

  /* Risultato scansione: verdetto e messaggio introduttivo a tutta
     larghezza in alto ("column-span: all"), il resto (ingredienti da
     verificare, alternative, ecc.) si dispone da solo su due colonne
     con "column-count" - qualunque sia il sottoinsieme di blocchi
     visibile per QUESTO prodotto (non tutti i risultati mostrano tutti
     i blocchi), perche' "column-count" ignora semplicemente gli
     elementi con display:none, senza bisogno di elencarli uno per uno. */
  body.app-page #result-section .screen-body.narrow-pad {
    column-count: 2;
    column-gap: 28px;
    padding-top: 24px;
  }

  body.app-page #result-section .screen-body.narrow-pad > * {
    break-inside: avoid;
  }

  body.app-page #result-section #verdict-banner,
  body.app-page #result-section #result-message,
  body.app-page #result-section #favorite-toggle-btn,
  body.app-page #result-section #result-disclaimer,
  body.app-page #result-section #scan-again-btn {
    column-span: all;
  }

  /* Cronologia / preferiti / negozi vicini: righe elenco disposte in
     griglia (piu' colonne se lo spazio lo permette) invece di un'unica
     colonna lunghissima. */
  body.app-page #history-list,
  body.app-page #favorites-list,
  body.app-page #nearby-stores-list,
  body.app-page #home-recent-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
  }

  body.app-page #history-list .list-row,
  body.app-page #favorites-list .list-row,
  body.app-page #nearby-stores-list .store-card,
  body.app-page #home-recent-list .list-row {
    margin-bottom: 0;
  }
}

.screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* --- Header con logo (login/splash) -------------------------------------- */

.brand-mark {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
}

.brand-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-name {
  font-family: 'Poppins', sans-serif;
  font-weight: 800;
  font-size: 18px;
  color: var(--text);
}

.brand-tagline {
  font-size: 12px;
  color: var(--text-faint);
  letter-spacing: 0.02em;
}

/* --- Verifica anti-bot (Turnstile) su login.html: visibile subito, in
   alto e ben centrata, prima che i campi email/password si sblocchino
   (vedi login.js e login.html). --- */
.turnstile-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.turnstile-gate-note {
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
}

.turnstile-gate-note.error { color: var(--haram-text); }

/* --- Selettore lingua (pillole IT/EN/AR) ---------------------------------- */

.lang-pills {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  padding: 18px 20px 0;
}

.lang-pill {
  border: 1px solid var(--border);
  background: transparent;
  color: #6B7873;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.lang-pill.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
}

/* --- Card generica (usata anche fuori dal frame, es. pagine standalone) -- */

.card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 20px;
  margin: 16px;
  box-shadow: var(--shadow-card);
}

.standalone-page {
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: 2rem;
}

.standalone-header {
  background: linear-gradient(155deg, var(--brand), var(--brand-dark));
  color: #ffffff;
  padding: 28px 20px;
  text-align: center;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.standalone-header .brand-icon { background: rgba(255, 255, 255, 0.16); }
.standalone-header .brand-name { color: #ffffff; }

/* --- Segmented control (tab Accedi/Registrati) ---------------------------- */

.segmented {
  display: flex;
  background: #F1F4F2;
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 22px;
}

.segmented button {
  flex: 1;
  border: none;
  cursor: pointer;
  background: transparent;
  color: var(--text-faint);
  font-weight: 700;
  font-size: 13.5px;
  padding: 10px;
  border-radius: 9px;
}

.segmented button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* --- Form ------------------------------------------------------------------ */

.form-field { margin-bottom: 12px; }

.form-field label {
  display: block;
  font-size: 12px;
  color: var(--text-faint);
  margin-bottom: 4px;
  font-weight: 600;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--brand);
}

.password-field { position: relative; }

.password-field input { padding-inline-end: 44px; }

.password-toggle {
  position: absolute;
  inset-inline-end: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  color: #6B7873;
}

.field-hint-row {
  text-align: end;
  margin-bottom: 12px;
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--brand);
  font-weight: 600;
}

.consent-field {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.consent-field label {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  cursor: pointer;
  line-height: 1.4;
}

.consent-field input {
  margin-top: 2px;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: var(--brand);
}

.consent-field a { font-weight: 600; }

/* --- Bottoni ---------------------------------------------------------------- */

.btn {
  border: none;
  cursor: pointer;
  border-radius: 12px;
  font-size: 15px;
  padding: 14px;
  width: 100%;
  transition: opacity 0.15s ease, transform 0.05s ease;
}

.btn:active { opacity: 0.85; }
.btn:disabled { opacity: 0.6; cursor: default; }

.btn-primary {
  background: var(--brand);
  color: #ffffff;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  box-shadow: var(--shadow-btn);
}

.btn-secondary {
  background: transparent;
  color: var(--brand);
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  border: 1.5px solid var(--brand);
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
  font-weight: 600;
}

.btn-danger-outline {
  background: transparent;
  color: var(--haram-text);
  border: 1.5px solid var(--haram-border);
  font-weight: 600;
}

.btn-icon { width: auto; flex: 0 0 auto; padding: 12px; }

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 13px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  width: 100%;
}

.or-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0;
  font-size: 12px;
  color: var(--text-faint);
}

.or-divider::before,
.or-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-row { display: flex; gap: 10px; }

/* --- Contenuto scorrevole con padding standard ------------------------------ */

.screen-body {
  flex: 1;
  overflow: auto;
  padding: 14px 24px 32px;
  display: flex;
  flex-direction: column;
}

.screen-body.narrow-pad { padding: 6px 20px 24px; }

.screen-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 10px;
  flex-shrink: 0;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

[dir="rtl"] .flip-rtl { transform: scaleX(-1); }

.screen-title {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 17px;
  color: var(--brand);
}

/* --- Home -------------------------------------------------------------- */

.home-header {
  background: linear-gradient(155deg, var(--brand), var(--brand-dark));
  padding: 24px 20px 22px;
  border-radius: 0 0 28px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  color: #ffffff;
}

.home-header-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.home-header-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.14);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

.home-header-text { display: flex; flex-direction: column; min-width: 0; }
.home-header-text strong { font-family: 'Poppins', sans-serif; font-weight: 800; font-size: 17px; }
.home-header-text span { font-size: 11.5px; color: rgba(255, 255, 255, 0.7); }

.home-header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.round-icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: none; display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; color: #ffffff;
}

.scan-cta-card {
  border: 2px dashed var(--brand-border);
  border-radius: var(--radius-lg);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  background: var(--surface);
}

.scan-cta-icon {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--brand);
  display: flex; align-items: center; justify-content: center;
}

.scan-cta-title { font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 17px; color: var(--text); }
.scan-cta-sub { font-size: 13px; color: var(--text-muted); line-height: 1.4; }

.section-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 26px 0 12px;
}

.section-title {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}

.section-link {
  font-size: 12.5px;
  color: var(--brand);
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.list-empty {
  font-size: 13px;
  color: var(--text-faint);
  text-align: center;
  padding: 20px 0;
}

/* --- Liste (scansioni recenti, cronologia, preferiti) ----------------------- */

.thumb {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  background: repeating-linear-gradient(45deg, #e4e4e4, #e4e4e4 6px, #eeeeee 6px, #eeeeee 12px);
  object-fit: contain;
}

.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  text-align: start;
  width: 100%;
  margin-bottom: 10px;
}

.list-row-info { flex: 1; min-width: 0; }

.list-row-name {
  font-size: 13.5px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.list-row-meta { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }

.chip {
  font-size: 11px; font-weight: 700; padding: 5px 10px;
  border-radius: var(--radius-pill); flex-shrink: 0;
}

.chip.halal { background: var(--halal-bg); color: var(--halal-text); }
.chip.haram { background: var(--haram-bg); color: var(--haram-text); }
.chip.mashbooh { background: var(--mashbooh-bg); color: var(--mashbooh-text); }
.chip.unknown { background: var(--unknown-bg); color: var(--unknown-text); }

.list-row-action {
  flex-shrink: 0;
  border: 1.5px solid var(--border);
  background: transparent;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
}

/* --- Bottom nav -------------------------------------------------------------- */

.bottom-nav {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 10px 12px 18px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.bottom-nav button {
  background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 6px 12px;
  color: #9AA6A0;
}

.bottom-nav button.active { color: var(--brand); }
.bottom-nav button span { font-size: 10.5px; font-weight: 600; }

/* --- Scanning ---------------------------------------------------------------- */

.scan-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #0E1512;
  position: relative;
  color: #ffffff;
}

.scan-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 20px 10px; position: relative; z-index: 2;
}

.scan-topbar .icon-btn { background: rgba(255, 255, 255, 0.12); border: none; color: #fff; }
.scan-topbar-title { font-size: 13px; font-weight: 600; letter-spacing: 0.03em; }

.scan-viewfinder-wrap {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px;
  position: relative;
}

#reader {
  width: 250px;
  height: 250px;
  border-radius: 26px;
  border: 3px solid #4F9373;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.35);
}

#reader video { object-fit: cover; }

@keyframes scanline {
  0% { top: 10%; opacity: 0.4; }
  50% { top: 86%; opacity: 1; }
  100% { top: 10%; opacity: 0.4; }
}

.scan-viewfinder-wrap::before {
  content: "";
  position: absolute;
  top: 10%;
  left: calc(50% - 117px);
  width: 234px;
  height: 2.5px;
  background: #4F9373;
  box-shadow: 0 0 10px 2px rgba(79, 147, 115, 0.8);
  animation: scanline 2.2s ease-in-out infinite;
  z-index: 3;
  pointer-events: none;
}

.scan-instruction { color: rgba(255, 255, 255, 0.8); font-size: 13.5px; }

.scan-footer {
  padding: 14px 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  z-index: 2;
}

.scan-secondary-actions { display: flex; gap: 8px; justify-content: center; }

.scan-chip-btn {
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12.5px; font-weight: 600; padding: 8px 14px; border-radius: var(--radius-pill);
  cursor: pointer;
}

.scan-manual-wrap { text-align: center; }

.scan-manual-label {
  font-size: 11.5px; color: rgba(255, 255, 255, 0.5); text-transform: uppercase;
  letter-spacing: 0.06em; margin-bottom: 10px;
}

.scan-manual-form { display: flex; gap: 8px; }

.scan-manual-form input {
  flex: 1; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  font-size: 14px;
  min-width: 0;
}

.scan-manual-form input::placeholder { color: rgba(255, 255, 255, 0.4); }

.scan-error-dark {
  background: rgba(179, 56, 44, 0.18);
  border: 1px solid rgba(241, 199, 192, 0.4);
  color: #F1C7C0;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12.5px;
  text-align: center;
}

/* --- Errori / stato generico ------------------------------------------------- */

.scan-error {
  background: var(--haram-bg);
  border-inline-start: 4px solid var(--haram-text);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
  margin: 0.75rem 0 0;
  color: var(--haram-text);
}

.spinner {
  width: 36px; height: 36px;
  border: 4px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  margin: 0 auto 0.75rem;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.state-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 24px; gap: 12px; }

.state-icon-circle {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--brand-tint);
  display: flex; align-items: center; justify-content: center;
}

/* --- Risultato scansione -------------------------------------------------- */

.result-header-row {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 20px 14px; flex-shrink: 0; background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.result-header-info { flex: 1; min-width: 0; }

.result-header-name {
  font-size: 14.5px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.result-header-meta { font-size: 11.5px; color: var(--text-faint); }

.verdict-banner {
  border-radius: 20px;
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.verdict-banner.halal { background: var(--halal-bg); border: 1px solid var(--halal-border); }
.verdict-banner.haram { background: var(--haram-bg); border: 1px solid var(--haram-border); }
.verdict-banner.mashbooh { background: var(--mashbooh-bg); border: 1px solid var(--mashbooh-border); }
.verdict-banner.unknown { background: var(--unknown-bg); border: 1px solid var(--unknown-border); }

.verdict-glyph {
  width: 54px; height: 54px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: #ffffff; font-size: 26px; font-weight: 700;
}

.verdict-banner.halal .verdict-glyph { background: var(--halal-text); }
.verdict-banner.haram .verdict-glyph { background: var(--haram-text); }
.verdict-banner.mashbooh .verdict-glyph { background: var(--mashbooh-text); }
.verdict-banner.unknown .verdict-glyph { background: var(--unknown-text); }

.verdict-label { font-family: 'Poppins', sans-serif; font-weight: 800; font-size: 24px; }
.verdict-sub { font-size: 13px; opacity: 0.85; }

.verdict-banner.halal .verdict-label, .verdict-banner.halal .verdict-sub { color: var(--halal-text); }
.verdict-banner.haram .verdict-label, .verdict-banner.haram .verdict-sub { color: var(--haram-text); }
.verdict-banner.mashbooh .verdict-label, .verdict-banner.mashbooh .verdict-sub { color: var(--mashbooh-text); }
.verdict-banner.unknown .verdict-label, .verdict-banner.unknown .verdict-sub { color: var(--unknown-text); }

.result-block { margin-top: 24px; }

.eyebrow {
  font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-faint); margin-bottom: 8px;
}

.result-summary-text { font-size: 14px; color: var(--text-body); line-height: 1.5; }

.ingredient-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 8px;
}

.ingredient-row-main { display: flex; align-items: center; gap: 10px; }

.ingredient-badge {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800;
}

.ingredient-badge.ok { background: var(--halal-bg); color: var(--halal-text); }
.ingredient-badge.flag { background: var(--haram-bg); color: var(--haram-text); }
.ingredient-badge.unsure { background: var(--mashbooh-bg); color: var(--mashbooh-text); }

.ingredient-name { font-size: 13.5px; color: var(--text); font-weight: 500; }

.ingredient-note {
  font-size: 12px; margin-top: 6px; margin-inline-start: 34px; font-style: italic;
}

.certified-banner {
  margin-top: 24px;
  background: var(--halal-bg);
  border: 1px solid var(--halal-border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.certified-icon {
  width: 38px; height: 38px; border-radius: 50%; background: var(--brand);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

.certified-label { font-size: 11px; color: var(--brand); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; }
.certified-name { font-size: 13.5px; color: var(--text); font-weight: 600; }

.alt-scroller { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; }

.alt-card {
  min-width: 140px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 12px; flex-shrink: 0;
}

.alt-thumb {
  width: 100%; height: 60px; border-radius: 10px;
  background: repeating-linear-gradient(45deg, #e4e4e4, #e4e4e4 6px, #eeeeee 6px, #eeeeee 12px);
  margin-bottom: 10px;
}

.alt-name { font-size: 12.5px; font-weight: 700; color: var(--text); }
.alt-brand { font-size: 11px; color: var(--text-faint); margin: 2px 0 8px; }

.alt-halal-tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--halal-bg); border: 1px solid var(--halal-border); color: var(--halal-text);
  font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: var(--radius-pill);
}

.admin-preview-note {
  font-size: 11px;
  color: var(--text-faint);
  background: var(--unknown-bg);
  border-radius: 8px;
  padding: 6px 10px;
  margin-bottom: 10px;
}

.favorite-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-body);
  cursor: pointer;
  margin-top: 16px;
}

.favorite-toggle.active {
  background: var(--mashbooh-bg);
  border-color: var(--mashbooh-border);
  color: var(--mashbooh-text);
}

.photo-upload-block {
  margin-top: 24px;
  background: #F6F8F7;
  border-radius: var(--radius-md);
  padding: 16px;
}

.photo-upload-block p { margin-top: 0; font-size: 13px; color: var(--text-body); }

.photo-video, .photo-preview {
  width: 100%; max-height: 320px; object-fit: cover;
  border-radius: var(--radius-sm); margin-bottom: 10px; background: #000; display: block;
}

.photo-upload-block input[type="file"] { display: block; margin-bottom: 10px; width: 100%; font-size: 13px; }

.disclaimer {
  font-size: 0.72rem; color: var(--text-faint); border-top: 1px solid var(--border);
  padding-top: 16px; margin-top: 24px;
}

/* --- Vicini (Nearby) ---------------------------------------------------------- */

.nearby-map-placeholder {
  width: 100%; height: 140px; border-radius: 18px;
  background: repeating-linear-gradient(45deg, #dfe6e2, #dfe6e2 10px, #eef2ef 10px, #eef2ef 20px);
  position: relative; display: flex; align-items: center; justify-content: center; margin-bottom: 16px;
}

.nearby-map-label {
  font-family: monospace; font-size: 11px; color: var(--text-muted);
  background: rgba(255, 255, 255, 0.7); padding: 4px 10px; border-radius: 6px;
}

.nearby-pin {
  position: absolute; width: 12px; height: 12px; border-radius: 50%;
  background: var(--brand); border: 2px solid #ffffff;
}

.store-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 14px; margin-bottom: 12px;
}

.store-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.store-name { font-size: 14px; font-weight: 700; color: var(--text); }
.store-meta { font-size: 12px; color: var(--text-faint); margin-top: 2px; }

.store-status {
  font-size: 10.5px; font-weight: 700; padding: 4px 9px; border-radius: var(--radius-pill);
  white-space: nowrap; flex-shrink: 0;
}

.store-status.open { background: var(--halal-bg); color: var(--halal-text); }
.store-status.closed { background: #ECECEC; color: #8A8A8A; }

.store-stock { font-size: 12px; color: var(--text-body); margin-top: 10px; }

/* --- Lingua -------------------------------------------------------------- */

.lang-option {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border: 1.5px solid var(--border); border-radius: 14px;
  padding: 16px; cursor: pointer; text-align: start; width: 100%; margin-bottom: 10px;
}

.lang-option.selected { border-color: var(--brand); }

.lang-option-native { font-size: 15px; font-weight: 700; color: var(--text); }
.lang-option-label { font-size: 12px; color: var(--text-faint); }

.lang-radio {
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border);
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
}

.lang-option.selected .lang-radio { border-color: var(--brand); background: var(--brand); }
.lang-radio-dot { width: 8px; height: 8px; border-radius: 50%; background: #ffffff; }

/* --- Account / consenso / email non confermata ---------------------------- */

.account-summary {
  display: flex; align-items: center; gap: 12px; margin-bottom: 22px;
}

.account-avatar {
  width: 48px; height: 48px; border-radius: 50%; background: var(--brand);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 18px; flex-shrink: 0;
}

.account-email { font-size: 14.5px; font-weight: 700; color: var(--text); word-break: break-all; }
.account-since { font-size: 12px; color: var(--text-faint); margin-top: 2px; }

.status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: var(--radius-pill);
  margin-bottom: 20px;
}

.status-pill.verified { background: var(--halal-bg); color: var(--halal-text); }
.status-pill.unverified { background: var(--mashbooh-bg); color: var(--mashbooh-text); }

.account-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }

/* --- Barra utente semplice sopra la Home (link rapidi) --------------------- */

.top-account-bar {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 10px 20px 0;
}

.top-account-bar button {
  background: none; border: none; color: rgba(255, 255, 255, 0.85);
  font-size: 11.5px; font-weight: 600; cursor: pointer; padding: 4px;
}

/* --- Testo lungo (privacy) ------------------------------------------------ */

.text-page h2 { margin-top: 0; }
.text-page h3 { font-size: 1rem; margin-bottom: 0.25rem; }
.text-page p { font-size: 0.9rem; line-height: 1.5; color: var(--text-body); }

/* --- Footer disclaimer ---------------------------------------------------- */

.app-footer {
  text-align: center; font-size: 0.72rem; color: var(--text-faint); padding: 1rem;
}
