/* ═══════════════════════════════════════════════
   SOCCORRITORE READY · AREU 118 Lombardia
   css/app.css — tutti gli stili dell'applicazione
═══════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: #06080f;
  -webkit-tap-highlight-color: transparent;
  font-family: 'Barlow Condensed', sans-serif;
  color: #e2e8f0;
}

#root { min-height: 100vh; }
::-webkit-scrollbar { display: none; }

/* ── Layout root ── */
.app-root {
  font-family: 'Barlow Condensed', sans-serif;
  background: #06080f;
  min-height: 100vh;
  color: #e2e8f0;
  max-width: 540px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

/* ── Buttons ── */
.btn {
  -webkit-appearance: none;
  cursor: pointer;
  font-family: 'Barlow Condensed', sans-serif;
  border: none;
  outline: none;
}
.btn:active { opacity: 0.75; }

.btn-primary {
  width: 100%; padding: 16px 0;
  background: linear-gradient(90deg, #ef4444, #b91c1c);
  border-radius: 9px; color: #fff;
  font-size: 20px; font-weight: 800; letter-spacing: 3px;
}

.btn-secondary {
  width: 100%; padding: 14px 0;
  background: #080c18; border: 1px solid #1a2234;
  border-radius: 9px; color: #e2e8f0;
  font-size: 17px; font-weight: 700; letter-spacing: 2px;
}

.btn-mic {
  width: 100%; padding: 18px 0;
  background: #080c18; border: 2px solid #1d4ed8;
  border-radius: 9px; color: #60a5fa;
  font-size: 22px; font-weight: 800; letter-spacing: 2px;
}

.btn-stop-stt {
  width: 100%; padding: 18px 0;
  background: #1e0606; border: 2px solid #ef4444;
  border-radius: 9px; color: #fca5a5;
  font-size: 20px; font-weight: 800; letter-spacing: 2px;
  animation: pulseBorder 1.2s infinite;
}

.btn-avanti {
  width: 100%; padding: 14px 0;
  background: #0c1a2e; border: 1px solid #1d4ed8;
  border-radius: 9px; color: #60a5fa;
  font-size: 17px; font-weight: 700; letter-spacing: 2px;
}

.btn-avanti:disabled {
  background: #0a0e1a; border-color: #1a2234;
  color: #374151; cursor: not-allowed; opacity: 1;
}

.btn-back {
  background: none; border: 1px solid #1a2234; color: #64748b;
  font-size: 16px; font-weight: 700; padding: 4px 10px;
  border-radius: 5px; flex-shrink: 0;
}

.btn-sm {
  padding: 6px 14px; border-radius: 6px;
  font-size: 13px; font-weight: 700; border: 1px solid;
}

/* ── Scroll area ── */
.scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Top bar ── */
.topbar {
  background: #080c18;
  border-bottom: 1px solid #0f1629;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 50;
}

/* ── Phase pills bar ── */
.phasebar {
  display: flex;
  overflow-x: auto;
  padding: 5px 8px;
  gap: 4px;
  background: #080c18;
  border-bottom: 1px solid #0f1629;
  scrollbar-width: none;
}

.phasepill {
  min-width: 40px;
  padding: 5px 6px;
  border-radius: 5px;
  border: 1px solid #1a2234;
  text-align: center;
  flex-shrink: 0;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

/* ── Cards ── */
.card {
  background: #080c18;
  border: 1px solid #1a2234;
  border-radius: 9px;
  padding: 14px;
}

.card-situ {
  background: #080c18;
  border: 1px solid #1e2a3a;
  border-left: 3px solid #ef4444;
  border-radius: 8px;
  padding: 14px;
}

.card-risposta {
  background: #061c10;
  border: 1px solid #14532d;
  border-radius: 8px;
  padding: 12px;
}

.card-warning {
  background: #1c0a00;
  border: 1px solid #c2410c;
  border-radius: 8px;
  padding: 12px;
}

.card-info {
  background: #0c1220;
  border: 1px solid #1e3a5f;
  border-radius: 8px;
  padding: 10px 12px;
}

/* ── Step list ── */
.step-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 7px;
  border: 1px solid #1a2234;
  background: #0a0e1a;
  transition: border-color 0.3s, background 0.3s;
}

.step-row.matched {
  border-color: #14532d;
  background: #061c10;
}

.step-row.bloccante-warning {
  border-color: #c2410c;
  background: #1c0a00;
  animation: warningPulse 0.8s 3;
}

.step-check {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 2px solid #1a2234;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
  transition: all 0.3s;
}

.step-check.matched {
  background: #10b981;
  border-color: #10b981;
}

.step-check.bloccante {
  border-color: #ef4444;
}

.step-text {
  font-size: 16px;
  color: #94a3b8;
  line-height: 1.5;
  flex: 1;
  transition: color 0.3s;
}

.step-text.matched { color: #4ade80; }
.step-text.bloccante { color: #fca5a5; }

.badge-bloccante {
  font-size: 9px;
  padding: 2px 6px;
  border: 1px solid #ef444444;
  border-radius: 10px;
  background: #1c0606;
  color: #ef4444;
  letter-spacing: 1px;
  flex-shrink: 0;
  align-self: center;
}

/* ── Transcript ── */
.transcript-box {
  min-height: 70px;
  padding: 12px;
  background: #0a0e1a;
  border: 1px solid #1a2234;
  border-radius: 8px;
  font-size: 16px;
  color: #cbd5e1;
  line-height: 1.65;
  transition: border-color 0.3s;
}

.transcript-box.listening { border-color: #1d4ed8; }

/* ── Response bubble ── */
.response-bubble {
  padding: 10px 14px;
  background: #061c10;
  border: 1px solid #14532d;
  border-radius: 8px;
  font-size: 17px;
  color: #4ade80;
  line-height: 1.5;
}

/* ── Speaking indicator ── */
.speaking-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #080c18;
  border: 1px solid #1d4ed8;
  border-radius: 8px;
  animation: speakPulse 1.4s infinite;
}

/* ── Labels ── */
.lbl {
  font-size: 12px;
  color: #64748b;
  letter-spacing: 2px;
  margin-bottom: 6px;
  font-weight: 700;
}

.mono {
  font-family: 'IBM Plex Mono', monospace;
}

mark {
  background: #14532d;
  color: #4ade80;
  border-radius: 3px;
  padding: 0 3px;
}

/* ── EPCR Form ── */
.epcr-header {
  background: linear-gradient(135deg, #1a0000, #7f1d1d);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 2px solid #ef4444;
}

.epcr-badge {
  background: #ef4444;
  color: #fff;
  font-size: 28px;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: 6px;
  letter-spacing: 2px;
  flex-shrink: 0;
}

.epcr-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 14px;
}

.epcr-field {
  background: #0a0e1a;
  border: 1px solid #1a2234;
  border-radius: 7px;
  padding: 9px 11px;
}

.epcr-field.wide {
  grid-column: 1 / -1;
}

.epcr-field-label {
  font-size: 8px;
  color: #475569;
  letter-spacing: 2px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.epcr-field-value {
  font-size: 14px;
  color: #e2e8f0;
  font-weight: 600;
  line-height: 1.4;
}

.epcr-field-value.red   { color: #ef4444; }
.epcr-field-value.green { color: #10b981; }
.epcr-field-value.amber { color: #f59e0b; }
.epcr-field-value.mono  { font-family: 'IBM Plex Mono', monospace; }

.epcr-codice-bar {
  display: flex;
  gap: 6px;
  padding: 0 14px 14px;
}

.codice-chip {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  border: 1px solid;
}

/* ── Disclaimer ── */
.disclaimer-section {
  background: #080c18;
  border: 1px solid #1a2234;
  border-radius: 9px;
  padding: 14px 16px;
  margin-bottom: 10px;
}

.disclaimer-section-title {
  font-size: 10px;
  color: #f59e0b;
  letter-spacing: 3px;
  font-weight: 700;
  margin-bottom: 10px;
}

.disclaimer-step {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.5;
}

.disclaimer-step-num {
  color: #ef4444;
  font-weight: 800;
  flex-shrink: 0;
  width: 16px;
}

.setup-os {
  background: #0a0e1a;
  border: 1px solid #1a2234;
  border-radius: 7px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

.setup-os-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.setup-os-step {
  font-size: 12px;
  color: #64748b;
  line-height: 1.6;
  padding-left: 4px;
}

.legal-box {
  background: #0a0308;
  border: 1px solid #581c87;
  border-radius: 7px;
  padding: 10px 12px;
  font-size: 11px;
  color: #a855f7;
  line-height: 1.6;
  text-align: center;
}

/* ── Score screen ── */
.score-header {
  padding: 40px 20px 24px;
  text-align: center;
}

.score-detail-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
  padding: 8px 10px;
  background: #0a0e1a;
  border-radius: 7px;
}

.score-bar-track {
  flex: 1;
  height: 6px;
  background: #1a2234;
  border-radius: 3px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}

/* ── Animations ── */
@keyframes pulseBorder {
  0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.45); }
  50%      { box-shadow: 0 0 0 10px rgba(239,68,68,0); }
}

@keyframes speakPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(29,78,216,0.4); }
  50%      { box-shadow: 0 0 0 8px rgba(29,78,216,0); }
}

@keyframes warningPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(194,65,12,0.5); }
  50%      { box-shadow: 0 0 0 10px rgba(194,65,12,0); }
}

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

@keyframes checkBounce {
  0%   { transform: scale(0); }
  60%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.fade-in   { animation: fadeIn 0.28s ease; }
.check-anim { animation: checkBounce 0.35s ease forwards; }

/* ── Progress bar ── */
.progress-track {
  height: 3px;
  background: #1a2234;
  border-radius: 2px;
  overflow: hidden;
  flex: 1;
}
.progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* ── Pill tag ── */
.pill-tag {
  font-size: 9px;
  padding: 3px 8px;
  border-radius: 10px;
  border: 1px solid;
  letter-spacing: 0.5px;
  font-weight: 700;
}

/* ── Lampeggio codice colore ePCR ── */
@keyframes blink-giallo {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px #f59e0b; }
  50%       { opacity: 0.35; box-shadow: none; }
}
@keyframes blink-rosso {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px #ef4444; }
  50%       { opacity: 0.35; box-shadow: none; }
}
@keyframes blink-verde {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px #10b981; }
  50%       { opacity: 0.35; box-shadow: none; }
}
@keyframes blink-nero {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}
.blink-GIALLO { animation: blink-giallo 1.2s ease-in-out infinite; }
.blink-ROSSO  { animation: blink-rosso  0.9s ease-in-out infinite; }
.blink-VERDE  { animation: blink-verde  1.5s ease-in-out infinite; }
.blink-NERO   { animation: blink-nero   2.0s ease-in-out infinite; }

/* ── Zoom livelli carattere ── */
.zoom-085 { zoom: 0.85; }
.zoom-100 { zoom: 1.00; }
.zoom-115 { zoom: 1.15; }
.zoom-130 { zoom: 1.30; }

/* ── Barra Vitale (timer step) ── */
@keyframes vitale-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.55; }
}
.vitale-track {
  height: 3px;
  background: #080c18;
  border-radius: 2px;
  overflow: hidden;
  margin: 6px 0 2px;
}
.vitale-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.25s linear, background-color 3s ease;
  animation: vitale-pulse 2s ease-in-out infinite;
}

/* ── SOREU Dialog ── */
.soreu-dialog {
  background: #05090f;
  border: 1.5px solid #1d4ed8;
  border-left: 4px solid #38bdf8;
  border-radius: 9px;
  padding: 14px 14px 10px;
  margin-bottom: 10px;
}
.soreu-badge {
  font-size: 9px;
  color: #38bdf8;
  letter-spacing: 3px;
  font-weight: 800;
  margin-bottom: 8px;
}
.soreu-msg {
  font-size: 16px;
  color: #e2e8f0;
  line-height: 1.6;
  font-weight: 600;
}
.soreu-checklist {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.soreu-check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  padding: 5px 8px;
  border-radius: 6px;
  background: #0a0e1a;
}
.soreu-check-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Step states nel report ── */
.step-state-ok     { color: #10b981; }
.step-state-errato { color: #f97316; }
.step-state-saltato{ color: #475569; }
.badge-errato  { background:#1c0a00; color:#fb923c; border:1px solid #c2410c44; font-size:9px; padding:2px 6px; border-radius:8px; font-weight:700; letter-spacing:0.5px; }
.badge-saltato { background:#0a0e1a; color:#475569; border:1px solid #1e293b;   font-size:9px; padding:2px 6px; border-radius:8px; font-weight:700; letter-spacing:0.5px; }

/* ── AVANTI pulsante lampeggiante quando timer scaduto ── */
@keyframes avanti-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
  50%       { box-shadow: 0 0 0 6px rgba(16,185,129,0.25); }
}
.avanti-expired { animation: avanti-pulse 1.2s ease-in-out infinite; }

/* ── Sintesi Parametri C — blink di attenzione ── */
@keyframes sintesi-blink {
  0%, 100% {
    border-color: #f59e0b;
    box-shadow: 0 0 0 0 rgba(245,158,11,0.4);
    background: #0f0a00;
  }
  50% {
    border-color: #fbbf24;
    box-shadow: 0 0 18px rgba(245,158,11,0.35);
    background: #1c1200;
  }
}
.sintesi-blink { animation: sintesi-blink 0.55s ease-in-out infinite; }

/* ── Nota debriefing (ScoreScreen) ── */
.debriefing-nota {
  background: #1a0505;
  border: 1px solid #c2410c66;
  border-left: 3px solid #ef4444;
  border-radius: 7px;
  padding: 10px 12px;
  margin-top: 6px;
}
.debriefing-nota-label {
  font-size: 9px;
  color: #ef4444;
  letter-spacing: 2px;
  font-weight: 700;
  margin-bottom: 4px;
}
.debriefing-nota-text {
  font-size: 13px;
  color: #fca5a5;
  line-height: 1.55;
}
