/* Farmalytica Care — PWA Aderenza (UI anziani, alto contrasto) */

:root {
  --verde: #1B5E20;
  --verde-hover: #144116;
  --arancio: #E65100;
  --arancio-hover: #BF360C;
  --bordeaux: #C62828;
  --testo: #000000;
  --sfondo: #FAFAFA;
  --card: #FFFFFF;
  --bordo: #212121;
  --focus: #0D47A1;
  --raggio: 16px;
  --btn-h: 80px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--sfondo);
  color: var(--testo);
  line-height: 1.35;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: #000;
  color: #fff;
  padding: 12px 16px;
  z-index: 100;
  font-size: 1.25rem;
  font-weight: 700;
}

.skip-link:focus {
  left: 12px;
  top: 12px;
}

/* —— Fascia momento giornata —— */
.fascia-momento {
  background: var(--verde);
  color: #fff;
  text-align: center;
  padding: calc(14px + var(--safe-t)) 16px 18px;
  border-bottom: 4px solid #000;
}

.momento-label {
  margin: 0;
  font-size: 1.75rem; /* ~28px */
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.momento-ora {
  margin: 6px 0 0;
  font-size: 2rem; /* ~32px */
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* —— Layout compito unico —— */
.schermo {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px calc(24px + var(--safe-b));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card-farmaco {
  background: var(--card);
  border: 3px solid var(--bordo);
  border-radius: var(--raggio);
  padding: 16px;
  text-align: center;
}

.foto-box {
  width: 100%;
  max-width: 280px;
  margin: 0 auto 16px;
  aspect-ratio: 1;
  border: 3px solid var(--bordo);
  border-radius: 12px;
  background: #ECEFF1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.foto-confezione {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.nome-farmaco {
  margin: 0 0 10px;
  font-size: 2rem; /* 32px ≈ 32pt display */
  font-weight: 800;
  color: #000;
  line-height: 1.2;
  word-break: break-word;
}

.dosaggio {
  margin: 0;
  font-size: 1.75rem; /* ~28px */
  font-weight: 800;
  color: var(--bordeaux);
  line-height: 1.25;
}

.nota {
  margin: 12px 0 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #212121;
}

.stato {
  margin: 14px 0 0;
  min-height: 1.5em;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--verde);
}

.stato.errore {
  color: var(--bordeaux);
}

.stato.attesa {
  color: var(--arancio);
}

/* —— Pulsanti tocco grande —— */
.azioni {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.btn {
  display: block;
  width: 100%;
  min-height: var(--btn-h);
  padding: 16px 20px;
  border: 3px solid #000;
  border-radius: var(--raggio);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 3px;
}

.btn-preso {
  background: var(--verde);
}

.btn-preso:not(:disabled):active,
.btn-preso:not(:disabled):hover {
  background: var(--verde-hover);
}

.btn-dopo {
  background: var(--arancio);
}

.btn-dopo:not(:disabled):active,
.btn-dopo:not(:disabled):hover {
  background: var(--arancio-hover);
}

/* —— Footer farmacia —— */
.footer-link {
  text-align: center;
  margin-top: 8px;
}

.link-farmacia {
  display: inline-block;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--focus);
  text-decoration: underline;
  text-underline-offset: 4px;
  padding: 12px;
  min-height: 48px;
}

.link-farmacia:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 2px;
}

.privacy-hint {
  margin: 4px 0 0;
  font-size: 0.95rem;
  color: #424242;
  text-align: center;
}

/* —— Toast —— */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + var(--safe-b));
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  background: #000;
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  padding: 14px 20px;
  border-radius: 12px;
  z-index: 50;
  text-align: center;
}

.toast[hidden] {
  display: none;
}

/* Schermo “tutto preso” / vuoto */
.schermo.completato .btn-preso,
.schermo.completato .btn-dopo {
  display: none;
}

@media (min-width: 600px) {
  .nome-farmaco {
    font-size: 2.125rem;
  }
}
