/* ═══════════════════════════════════════════════
   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;
  transition: transform 0.1s ease, opacity 0.1s ease;
}
.btn:active {
  opacity: 0.82;
  transform: scale(0.96);
}

/* Tap feedback per tutti i button inline (non solo .btn) */
button:active {
  transform: scale(0.97);
  opacity: 0.85;
  transition: transform 0.08s ease, opacity 0.08s ease;
}

.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: 16px 0;
  background: #0e1520;
  border: 1px solid rgba(59,158,255,0.3);
  border-radius: 6px; color: #3b9eff;
  font-size: 15px; font-weight: 700;
  letter-spacing: 2px;
  font-family: 'Archivo Narrow', sans-serif;
}

.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: #1a7fe8;
  border: none;
  border-radius: 6px; color: white;
  font-size: 14px; font-weight: 800;
  letter-spacing: 1.5px;
  font-family: 'Archivo Narrow', sans-serif;
  text-transform: uppercase;
}

.btn-avanti:disabled {
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.2); cursor: not-allowed; opacity: 1;
}

.btn-back {
  background: none; border: 1px solid #1a2234; color: #7c8ea3;
  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: #0e1520;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  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 10px;
  gap: 4px;
  background: #080c12;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  scrollbar-width: none;
}

.phasepill {
  min-width: 38px;
  padding: 5px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.07);
  text-align: center;
  flex-shrink: 0;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1.2;
  font-family: 'DM Mono', monospace;
}

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

.card-situ {
  background: #0e1520;
  border: 1px solid rgba(255,255,255,0.07);
  border-left: 3px solid #ef4444;
  border-radius: 6px;
  padding: 12px 14px;
}

.card-risposta {
  background: rgba(46,204,128,0.05);
  border: 1px solid rgba(46,204,128,0.15);
  border-left: 3px solid #2ecc80;
  border-radius: 6px;
  padding: 11px 13px;
}

.card-warning {
  background: rgba(232,57,74,0.05);
  border: 1px solid rgba(232,57,74,0.2);
  border-left: 3px solid #e8394a;
  border-radius: 6px;
  padding: 11px 13px;
}

.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 12px;
  border-radius: 5px;
  border: 1px solid rgba(255,255,255,0.06);
  background: #0e1520;
  transition: border-color 0.3s, background 0.3s;
}

.step-row.matched {
  border-color: rgba(46,204,128,0.2);
  background: rgba(46,204,128,0.04);
}

.step-row.bloccante-warning {
  border-color: rgba(232,57,74,0.3);
  background: rgba(232,57,74,0.05);
  animation: warningPulse 0.8s 3;
}

.step-check {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1.5px solid rgba(255,255,255,0.12);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  transition: all 0.3s;
}

.step-check.matched {
  background: #2ecc80;
  border-color: #2ecc80;
}

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

.step-text {
  font-size: 14px;
  font-family: 'Archivo Narrow', sans-serif;
  font-weight: 500;
  color: rgba(255,255,255,0.6);
  line-height: 1.5;
  flex: 1;
  transition: color 0.3s;
}

.step-text.matched { color: #2ecc80; }
.step-text.bloccante { color: #e8394a; }

.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: 9px;
  font-family: 'DM Mono', monospace;
  color: rgba(255,255,255,0.4);
  letter-spacing: 2.5px;
  margin-bottom: 6px;
  font-weight: 700;
  text-transform: uppercase;
}

.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: #7c8ea3;
  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: #7c8ea3;
  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: #7c8ea3; }
.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:#7c8ea3; 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;
}

/* ══════════════════════════════════════════════════════
   NUOVE ANIMAZIONI — patch multi-feature
══════════════════════════════════════════════════════ */

/* #13 — Pulsante attenzione (PROSEGUI / FASE SUCCESSIVA) */
@keyframes btn-attention {
  0%   { box-shadow: 0 0 0 0  rgba(96,165,250,0.7); border-color: #3b82f6; }
  50%  { box-shadow: 0 0 0 8px rgba(96,165,250,0);  border-color: #60a5fa; }
  100% { box-shadow: 0 0 0 0  rgba(96,165,250,0);   border-color: #1d4ed8; }
}
.btn-attention {
  animation: btn-attention 0.8s ease-in-out 4;
}
@keyframes btn-green-attention {
  0%   { box-shadow: 0 0 0 0  rgba(74,222,128,0.7); border-color: #4ade80; }
  50%  { box-shadow: 0 0 0 8px rgba(74,222,128,0);  border-color: #86efac; }
  100% { box-shadow: 0 0 0 0  rgba(74,222,128,0);   border-color: #10b981; }
}
.btn-green-attention {
  animation: btn-green-attention 0.8s ease-in-out 4;
}

/* #6 — ECG Timer */
.ecg-container {
  margin: 6px 0 2px;
  position: relative;
}
.ecg-svg {
  display: block;
  width: 100%;
  height: 50px;
  overflow: visible;
}
@keyframes ecg-glow {
  0%, 100% { filter: drop-shadow(0 0 2px rgba(239,68,68,0.8)); }
  50%       { filter: drop-shadow(0 0 6px rgba(239,68,68,0.4)); }
}
.ecg-live { animation: ecg-glow 1s ease-in-out infinite; }

/* ECG amplitude shrink — 60fps via CSS, triggered by React key */
@keyframes ecg-shrink {
  from { transform: scaleY(1); }
  to   { transform: scaleY(0); }
}

/* #11 — Barre animate ePCR (waveform radio) */
@keyframes waveBar1 { 0%,100%{height:6px}  40%{height:18px} 70%{height:10px} }
@keyframes waveBar2 { 0%,100%{height:12px} 30%{height:6px}  60%{height:20px} }
@keyframes waveBar3 { 0%,100%{height:18px} 50%{height:8px}  80%{height:14px} }
@keyframes waveBar4 { 0%,100%{height:8px}  20%{height:16px} 65%{height:6px}  }
@keyframes waveBar5 { 0%,100%{height:14px} 35%{height:6px}  75%{height:20px} }
.wave-bar {
  width: 3px;
  border-radius: 2px;
  display: inline-block;
  transform-origin: bottom;
  align-self: flex-end;
}

/* #5 — SOREU choice */
.soreu-choice-btn {
  flex: 1;
  padding: 14px 10px;
  border-radius: 9px;
  border: 1.5px solid;
  background: #080c18;
  cursor: pointer;
  text-align: center;
  font-family: 'Barlow Condensed', sans-serif;
  transition: background 0.2s;
}
.soreu-choice-btn:active { opacity: 0.8; }

/* #16 — Box SOREU spontanea */
.soreu-spontanea-box {
  background: #050d1a;
  border: 1.5px solid #1d4ed8;
  border-left: 4px solid #38bdf8;
  border-radius: 9px;
  padding: 12px 14px;
  animation: fadeIn 0.3s ease;
}

/* Step saltati — visivo rosso potenziato */
.step-row.skipped-forced {
  border-color: #ef444466 !important;
  background: #1c0606 !important;
  pointer-events: none;
  user-select: none;
}

.step-row.skipped-timer {
  border-color: #ef444466 !important;
  background: #1c0606 !important;
  pointer-events: none;
  user-select: none;
}
.step-row.skipped-timer .step-text {
  color: #ef4444 !important;
  text-decoration: line-through !important;
  opacity: 0.8;
}
