/**
 * Check-in: lo stesso aspetto di FamilyOk.
 *
 * I token qui sotto sono quelli di FamilyOk (src/styles/tokens.css), copiati
 * identici: è un sistema grafico che esiste già e che Fabio riconosce, quindi
 * si applica, non si reinventa. Se cambiano là, vanno riallineati qui.
 *
 * Prefisso tmd- per non incrociare le classi del tema o del resto del plugin.
 */

/* UN TEMA SOLO, DICHIARATO: chiaro.
   L'app del check-in ha ottantadue colori scritti nel markup riga per riga,
   tutti pensati per un fondo chiaro. Dare alla pagina dei token scuri col
   tema di sistema lasciava dentro testo scuro su fondo scuro — "Seleziona il
   tipo di checkin" spariva. Finché quei colori non passano tutti dai token
   qui sotto, il tema scuro non si può accendere a metà: color-scheme lo dice
   anche al browser, così campi e menu restano chiari. */
:root {
  color-scheme: light;
  --tmd-bg:       #EDF0FA;
  --tmd-surface:  #FFFFFF;
  --tmd-surface2: #F6F7FD;
  --tmd-ink:      #161933;
  --tmd-muted:    #5D6382;
  --tmd-line:     #DCE0F0;
  --tmd-g:        #6B4EFF;
  --tmd-g-soft:   #E6E0FF;
  --tmd-s:        #FF6B35;
  --tmd-s-soft:   #FFE4D7;
  --tmd-ok:       #0E9F6E;
  --tmd-ok-soft:  #D5F5E8;
  --tmd-alert:      #E0413F;
  --tmd-alert-soft: #FDE3E2;
  --tmd-radius-xl: 30px;
  --tmd-radius-l:  20px;
  --tmd-radius-m:  14px;
  --tmd-display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --tmd-body:    "Figtree", "Segoe UI", system-ui, sans-serif;
}

/* ── La pagina: del tema non resta niente ──────────────────────────────
   Come nel template a pagina piena di FamilyOk. La barra di WordPress va
   via per tutti, amministratori compresi: questa è un'app a tutto schermo
   che si usa col telefono in mano, non una pagina del sito. */
body.tmd-page #wpadminbar,
body.tmd-page #main-header,
body.tmd-page #top-header,
body.tmd-page .et-fixed-header,
body.tmd-page #main-footer,
body.tmd-page #footer-bottom,
body.tmd-page .site-header,
body.tmd-page .site-footer,
body.tmd-page nav.main-navigation,
body.tmd-page .hamburger-menu,
body.tmd-page .et_pb_section.et_pb_fullwidth_header { display: none !important; }

html.tmd-html,
body.tmd-page {
  background: var(--tmd-bg) !important;
  color: var(--tmd-ink);
  font-family: var(--tmd-body) !important;
  margin: 0;
  padding: 0 !important;
}
body.tmd-page #page-container,
body.tmd-page #et-main-area,
body.tmd-page .et_pb_section,
body.tmd-page .entry-content,
body.tmd-page .et_pb_row {
  background: transparent !important;
  padding-top: 0 !important;
  margin-top: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
}
/* Il titolo della pagina WordPress sopra l'app non serve a nessuno. */
body.tmd-page .entry-title,
body.tmd-page .et_pb_title_container { display: none !important; }

body.tmd-page * { box-sizing: border-box; }

/* ── Accesso ────────────────────────────────────────────────────────── */

.tmd-login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  padding-block: 32px;
  padding-top: max(32px, env(safe-area-inset-top));
  font-family: var(--tmd-body);
}

.tmd-box { width: 100%; max-width: 380px; }

.tmd-brand {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 36px;
}
.tmd-brand span {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--tmd-g-soft);
  font-size: 19px;
  flex: none;
}
.tmd-brand b {
  font-family: var(--tmd-display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: var(--tmd-ink);
}

.tmd-login h1 {
  font-family: var(--tmd-display);
  font-weight: 800;
  font-size: 40px;
  line-height: 1.02;
  letter-spacing: -0.03em;
  margin: 0 0 12px;
  color: var(--tmd-ink);
  text-wrap: balance;
}
.tmd-login p.tmd-sub {
  color: var(--tmd-muted);
  margin: 0 0 28px;
  font-size: 16px;
  line-height: 1.45;
}

.tmd-label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--tmd-muted);
  margin-bottom: 8px;
}

.tmd-field {
  width: 100%;
  height: 60px;
  border-radius: var(--tmd-radius-m);
  border: 2px solid var(--tmd-line);
  background: var(--tmd-surface);
  color: var(--tmd-ink);
  padding: 0 18px;
  font-size: 18px;
  font-family: inherit;
  max-width: 100%;
  min-width: 0;
  -webkit-appearance: none;
  appearance: none;
}
.tmd-field:focus { border-color: var(--tmd-g); outline: none; }

.tmd-btn {
  width: 100%;
  height: 62px;
  border-radius: var(--tmd-radius-m);
  border: 0;
  background: var(--tmd-ink);
  color: var(--tmd-bg);
  font-family: inherit;
  font-weight: 700;
  font-size: 18px;
  text-align: center;
  margin-top: 14px;
  cursor: pointer;
  transition: transform .12s;
}
.tmd-btn:active { transform: scale(.98); }
.tmd-btn:disabled { opacity: .35; cursor: not-allowed; }

.tmd-link {
  display: block;
  width: 100%;
  background: none;
  border: 0;
  color: var(--tmd-muted);
  font-family: inherit;
  font-size: 15px;
  margin-top: 18px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  text-align: center;
}

/* Il codice in sei caselle: si legge mentre si digita, e su mobile è
   l'unico modo per non perdere il segno con la tastiera numerica. */
.tmd-code {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.tmd-code input {
  height: 66px;
  border-radius: var(--tmd-radius-m);
  border: 2px solid var(--tmd-line);
  background: var(--tmd-surface);
  color: var(--tmd-ink);
  text-align: center;
  font-family: var(--tmd-display);
  font-size: 28px;
  font-weight: 700;
  width: 100%;
  min-width: 0;
  -webkit-appearance: none;
  appearance: none;
}
.tmd-code input:focus { border-color: var(--tmd-g); outline: none; }

.tmd-error {
  margin: 14px 0 0;
  background: var(--tmd-alert-soft);
  color: var(--tmd-alert);
  border-radius: var(--tmd-radius-m);
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 600;
}
.tmd-ok {
  margin: 0 0 16px;
  background: var(--tmd-ok-soft);
  color: var(--tmd-ok);
  border-radius: var(--tmd-radius-m);
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 600;
}

.tmd-foot {
  text-align: center;
  font-size: 14px;
  color: var(--tmd-muted);
  margin-top: 20px;
  line-height: 1.5;
}

.tmd-admin {
  max-width: 380px;
  margin: 0 auto 40px;
  padding: 0 24px;
  font-family: var(--tmd-body);
}
.tmd-admin summary {
  font-size: 14px;
  color: var(--tmd-muted);
  cursor: pointer;
  text-align: center;
}
.tmd-admin .login-username label,
.tmd-admin .login-password label {
  display: block; font-size: 14px; font-weight: 700;
  color: var(--tmd-muted); margin-bottom: 6px;
}
.tmd-admin input[type="text"],
.tmd-admin input[type="password"] {
  width: 100%; height: 54px; border-radius: var(--tmd-radius-m);
  border: 2px solid var(--tmd-line); background: var(--tmd-surface);
  color: var(--tmd-ink); padding: 0 16px; font-size: 16px; margin-bottom: 12px;
  -webkit-appearance: none; appearance: none;
}
.tmd-admin input[type="submit"] {
  width: 100%; height: 54px; border: 0; border-radius: var(--tmd-radius-m);
  background: var(--tmd-ink); color: var(--tmd-bg);
  font-weight: 700; font-size: 16px; cursor: pointer;
}
.tmd-admin .login-remember { font-size: 14px; color: var(--tmd-muted); margin-bottom: 12px; }

@media (max-width: 360px) {
  .tmd-login h1 { font-size: 34px; }
  .tmd-code { gap: 5px; }
  .tmd-code input { height: 58px; font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .tmd-btn { transition: none; }
}

/* ── L'app dopo l'accesso ───────────────────────────────────────────────
   Qui non si riscrivono gli stili interni dell'app, che funzionano e sono
   scritti riga per riga nel markup: si porta la cornice sugli stessi
   valori — sfondo, font, angoli, pulsanti — così le due schermate
   appartengono allo stesso posto. */
#tm-checkin-app {
  font-family: var(--tmd-body) !important;
  color: var(--tmd-ink);
  padding-top: max(20px, env(safe-area-inset-top));
}
#tm-checkin-app h2,
#tm-checkin-app h3 {
  font-family: var(--tmd-display) !important;
  letter-spacing: -0.02em;
  font-weight: 800;
}
#tm-checkin-app button,
#tm-checkin-app input,
#tm-checkin-app select { font-family: var(--tmd-body) !important; }
