/* ============================================================
   MEDIX CALIBRACAO — Modo Calibração de Voz
   ============================================================ */

/* ── Backdrop ─────────────────────────────────────────────── */
.mcal-backdrop {
  position: fixed; inset: 0; z-index: 9960;
  background: rgba(4, 6, 12, 0.92);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; box-sizing: border-box;
  animation: mcalFadeIn .18s ease-out both;
}
@keyframes mcalFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── Modal ────────────────────────────────────────────────── */
.mcal-modal {
  background: #080b14;
  border: 1px solid #1a2535;
  border-radius: 18px;
  width: min(96vw, 860px);
  max-height: 92vh;
  display: flex; flex-direction: column;
  box-shadow: 0 32px 96px rgba(0,0,0,.85), 0 0 0 1px rgba(255,255,255,.04) inset;
  animation: mcalSlideIn .22s cubic-bezier(.22,1,.36,1) both;
  overflow: hidden;
}
@keyframes mcalSlideIn {
  from { opacity: 0; transform: translateY(18px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Header ───────────────────────────────────────────────── */
.mcal-header {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid #141e2e;
  flex-shrink: 0;
}
.mcal-header-icon {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, #0f2a40, #061828);
  border: 1px solid #1a3a5a;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.mcal-title {
  font-size: 16px; font-weight: 700; color: #cdd6f4;
  letter-spacing: -.015em;
}
.mcal-subtitle {
  font-size: 11px; color: #3a4860; margin-top: 2px;
}
.mcal-close {
  background: none; border: none; color: #2a3850;
  font-size: 18px; cursor: pointer; padding: 4px 8px;
  border-radius: 6px; line-height: 1; transition: all .15s;
  margin-left: auto; flex-shrink: 0;
}
.mcal-close:hover { color: #cdd6f4; background: #1a2035; }

/* ── Aviso técnico (honestidade) ──────────────────────────── */
.mcal-notice {
  margin: 14px 22px 0;
  padding: 10px 14px;
  background: #090d18;
  border: 1px solid #1a2535;
  border-left: 3px solid #2a4a80;
  border-radius: 8px;
  font-size: 11px; color: #4a5880; line-height: 1.55;
  flex-shrink: 0;
}
.mcal-notice strong { color: #5a7aaa; }

/* ── Body (rolável) ───────────────────────────────────────── */
.mcal-body {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 16px 22px; display: flex; flex-direction: column; gap: 14px;
  scrollbar-width: thin; scrollbar-color: #1e2535 transparent;
}

/* ── Seletor de área ──────────────────────────────────────── */
.mcal-area-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.mcal-area-label {
  font-size: 11px; font-weight: 700; color: #3a4860;
  text-transform: uppercase; letter-spacing: .07em;
}
.mcal-area-select {
  background: #0a0d16; border: 1px solid #1a2535; border-radius: 8px;
  color: #cdd6f4; font: 13px 'Segoe UI', sans-serif;
  padding: 7px 12px; outline: none; cursor: pointer;
  transition: border-color .15s;
}
.mcal-area-select:focus { border-color: #2a4a80; }

.mcal-bloco-nav {
  margin-left: auto; display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: #3a4860;
}
.mcal-nav-btn {
  background: #0a0d16; border: 1px solid #1a2535; color: #5a6a8a;
  border-radius: 6px; padding: 4px 10px; font-size: 12px;
  cursor: pointer; transition: all .15s;
}
.mcal-nav-btn:hover:not(:disabled) { background: #141929; color: #8899aa; }
.mcal-nav-btn:disabled { opacity: .35; cursor: not-allowed; }

/* ── Instrução ────────────────────────────────────────────── */
.mcal-instrucao {
  font-size: 11px; color: #3a4860; line-height: 1.5;
  font-style: italic;
}

/* ── Gabarito (texto para leitura) ───────────────────────── */
.mcal-gabarito-wrap {
  background: #f8fafc;
  border: 2px solid #cbd5e1;
  border-radius: 12px;
  padding: 22px 26px;
  position: relative;
}
.mcal-gabarito-label {
  position: absolute; top: -10px; left: 16px;
  background: #f8fafc; padding: 0 6px;
  font-size: 10px; font-weight: 700; color: #64748b;
  text-transform: uppercase; letter-spacing: .08em;
}
.mcal-gabarito-texto {
  font: 19px/1.75 'Calibri', 'Segoe UI', Georgia, serif;
  color: #0f172a;
  white-space: pre-wrap;
  user-select: none;
}
.mcal-gabarito-texto .mcal-termo-chave {
  background: rgba(14, 165, 233, 0.12);
  border-bottom: 1.5px solid #0ea5e9;
  border-radius: 2px;
  padding: 0 1px;
}

/* ── Painel de gravação ───────────────────────────────────── */
.mcal-rec-panel {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.mcal-rec-status {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: #4a5880;
}
.mcal-rec-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #1a2535; flex-shrink: 0;
  transition: background .2s;
}
.mcal-rec-dot.is-rec {
  background: #ef4444;
  animation: mcalPulse 1.1s ease-in-out infinite;
}
@keyframes mcalPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,.6); }
  50%       { box-shadow: 0 0 0 5px rgba(239,68,68,0); }
}
.mcal-transcript-preview {
  flex: 1; min-width: 0;
  font-size: 11px; color: #3a4860; font-style: italic;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 320px;
}

/* ── Botões ───────────────────────────────────────────────── */
.mcal-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 20px; border-radius: 9px;
  font: 600 13px/1 'Segoe UI', sans-serif;
  cursor: pointer; transition: all .15s;
  border: 1px solid transparent; white-space: nowrap;
}
.mcal-btn:active { transform: scale(.97); }
.mcal-btn:disabled { opacity: .4; cursor: not-allowed; transform: none !important; }

.mcal-btn--primary {
  background: linear-gradient(135deg, #0f2a40, #071828);
  color: #38b6e8; border-color: #1a4060;
  box-shadow: 0 0 12px rgba(56,182,232,.15);
}
.mcal-btn--primary:hover:not(:disabled) {
  box-shadow: 0 0 20px rgba(56,182,232,.28);
  transform: translateY(-1px);
}
.mcal-btn--stop {
  background: linear-gradient(135deg, #3a1010, #1a0808);
  color: #f87171; border-color: #602020;
}
.mcal-btn--stop:hover:not(:disabled) { background: linear-gradient(135deg, #4a1414, #220a0a); }
.mcal-btn--secondary {
  background: #0e1220; color: #5a6a8a; border-color: #1a2535;
}
.mcal-btn--secondary:hover:not(:disabled) { background: #141929; color: #8899aa; }
.mcal-btn--memorizar {
  background: linear-gradient(135deg, #1a5c38, #12432a);
  color: #5fd8a5; border-color: #2a6644;
  font-size: 14px; padding: 10px 26px;
  box-shadow: 0 4px 16px rgba(95,216,165,.12);
}
.mcal-btn--memorizar:hover:not(:disabled) {
  box-shadow: 0 6px 22px rgba(95,216,165,.22);
  transform: translateY(-1px);
}

/* ── Painel de revisão de divergências ───────────────────── */
.mcal-review-header {
  font-size: 12px; color: #5a6a8a;
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
}
.mcal-review-badge {
  font-size: 11px; font-weight: 600;
  background: #0e1220; border: 1px solid #1a2535;
  border-radius: 4px; padding: 2px 8px; color: #8899aa;
}
.mcal-review-badge--med { color: #38b6e8; border-color: #1a3050; }

.mcal-div-list {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 300px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: #1e2535 transparent;
}
.mcal-div-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  background: #070a12; border: 1px solid #141e2e;
  cursor: pointer; transition: background .15s, border-color .15s;
}
.mcal-div-item:hover { background: #0a0d1e; border-color: #1e2a40; }
.mcal-div-item input[type=checkbox] {
  width: 15px; height: 15px; flex-shrink: 0; cursor: pointer;
  accent-color: #38b6e8;
}
.mcal-div-star {
  font-size: 13px; flex-shrink: 0; opacity: .9;
}
.mcal-div-pair {
  flex: 1; font-size: 12px; display: flex;
  align-items: center; gap: 8px; min-width: 0;
}
.mcal-div-errado {
  color: #f87171; font-family: monospace; font-size: 11px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px;
}
.mcal-div-arrow { color: #2a3860; flex-shrink: 0; }
.mcal-div-correto {
  color: #5fd8a5; font-family: monospace; font-size: 11px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px;
}
.mcal-div-med { font-size: 10px; color: #38b6e8; flex-shrink: 0; }

/* ── Progresso ────────────────────────────────────────────── */
.mcal-progress {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.mcal-bloco-pip {
  width: 28px; height: 6px; border-radius: 3px;
  background: #1a2535; transition: background .2s;
}
.mcal-bloco-pip.done { background: #5fd8a5; }
.mcal-bloco-pip.current { background: #38b6e8; }

/* ── Footer ───────────────────────────────────────────────── */
.mcal-footer {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 22px 18px;
  border-top: 1px solid #0e1520;
  flex-shrink: 0;
}
.mcal-spacer { flex: 1; }

/* ── Tela de resumo (área completa) ─────────────────────── */
.mcal-summary {
  text-align: center; padding: 24px 16px; display: flex;
  flex-direction: column; align-items: center; gap: 12px;
}
.mcal-summary-icon { font-size: 40px; }
.mcal-summary-title { font-size: 17px; font-weight: 700; color: #5fd8a5; }
.mcal-summary-sub { font-size: 13px; color: #4a5880; }

@media (max-width: 640px) {
  .mcal-gabarito-texto { font-size: 16px; }
  .mcal-modal { border-radius: 14px; }
}
