/* ============================================================
   COCAR SAGRADO — Modal de Agendamento
   ============================================================ */

/* Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* Sobe como sheet no mobile, centraliza no desktop */
.modal-container {
  background: #fff;
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 940px;
  max-height: 95vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(48px);
  transition: transform 0.35s cubic-bezier(0.34, 1.08, 0.64, 1);
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.22);
}

@media (min-width: 640px) {
  .modal-overlay {
    align-items: center;
    padding: 20px;
  }
  .modal-container {
    border-radius: 20px;
    max-height: 90vh;
    transform: scale(0.95) translateY(20px);
    box-shadow: 0 28px 72px rgba(0, 0, 0, 0.28);
  }
}

.modal-overlay.open .modal-container {
  transform: translateY(0);
}

@media (min-width: 640px) {
  .modal-overlay.open .modal-container {
    transform: scale(1) translateY(0);
  }
}

/* Drag handle — visual cue mobile */
.modal-drag-handle {
  display: block;
  width: 40px;
  height: 4px;
  background: #e5e7eb;
  border-radius: 99px;
  margin: 12px auto 0;
  flex-shrink: 0;
}
@media (min-width: 640px) {
  .modal-drag-handle { display: none; }
}

/* Header */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 12px 20px;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
  gap: 12px;
}

/* Indicador de progresso — 2 telas */
.modal-progress {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.modal-tela-step {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 700;
  color: #6b7280;
  background: #f9fafb;
  border: 2px solid #e5e7eb;
  transition: background 0.25s, color 0.25s, border-color 0.25s;
  white-space: nowrap;
}

.modal-tela-step .t-num {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e5e7eb;
  color: #6b7280;
  font-size: .65rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.25s, color 0.25s;
}

.modal-tela-step.active {
  background: #eef2ff;
  color: #6366f1;
  border-color: #6366f1;
}
.modal-tela-step.active .t-num {
  background: #6366f1;
  color: #fff;
}
.modal-tela-step.done {
  background: #f0fdf4;
  color: #10b981;
  border-color: #10b981;
}
.modal-tela-step.done .t-num {
  background: #10b981;
  color: #fff;
}

.modal-progress-sep {
  color: #d1d5db;
  font-size: .85rem;
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .modal-header {
    padding: 10px 12px 10px 14px;
  }
}

@media (max-width: 420px) {
  .modal-tela-step {
    padding: 4px 8px;
    font-size: .68rem;
    gap: 4px;
  }
  .modal-tela-step .t-num {
    width: 16px;
    height: 16px;
    font-size: .6rem;
  }
  .modal-progress-sep { font-size: .7rem; }
}

/* Botão fechar */
.modal-close-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f9fafb;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  color: #9ca3af;
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.modal-close-btn:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #ef4444;
}

/* Body com scroll interno */
.modal-body {
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Telas */
.modal-screen {
  display: none;
}
.modal-screen.active {
  display: block;
  animation: mScreenIn 0.26s ease;
}
.modal-screen.slide-esquerda {
  animation: mScreenInLeft 0.26s ease;
}

@keyframes mScreenIn {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes mScreenInLeft {
  from { opacity: 0; transform: translateX(-24px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Bloqueia scroll do body quando modal aberto */
body.modal-aberto { overflow: hidden; }

/* Botão voltar dentro do pagamento */
.pag-voltar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  padding: 8px 16px;
  font-size: .875rem;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  margin-bottom: 20px;
  transition: border-color 0.2s, color 0.2s;
}
.pag-voltar-btn:hover {
  border-color: #6366f1;
  color: #6366f1;
}

/* Dark mode — modal container */
[data-theme="dark"] .modal-container {
  background: #1f2937;
}
[data-theme="dark"] .modal-header {
  background: #1f2937;
  border-color: #374151;
}
[data-theme="dark"] .modal-drag-handle {
  background: #4b5563;
}
[data-theme="dark"] .modal-close-btn {
  background: #374151;
  border-color: #4b5563;
  color: #9ca3af;
}
[data-theme="dark"] .modal-tela-step {
  background: #374151;
  border-color: #4b5563;
  color: #9ca3af;
}
[data-theme="dark"] .pag-voltar-btn {
  border-color: #4b5563;
  color: #9ca3af;
}
