/* ==========================================================================
   UNIVERSAL WIZARD FORMS CSS (Premium Edition)
   Arquivo unificado para todos os formulários de inscrição e cadastro
   Substitui: fichas-de-inscricao.css e cadastro-paciente.css
   Dependências: ui-tokens.css e ui-components.css (ou design-system.css)
   ========================================================================== */

/* --- 1. CONTAINERS E CARDS PREMIUM --- */
.form-container {
  max-width: 900px;
  margin: 20px auto;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.form-container-transparent {
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
}

.premium-card {
  background: var(--cor-surface, #ffffff);
  border-radius: var(--borda-radius-grande, 12px);
  padding: 30px;
  box-shadow: var(--sombra-suave, 0 8px 30px rgba(0, 0, 0, 0.06));
  margin-bottom: 25px;
  border: 1px solid var(--cor-borda, #f2f2f2);
}

.premium-header {
  text-align: center;
  padding: 40px 20px 30px;
  background: linear-gradient(135deg, #03204c 0%, #035c96 50%, #04396d 100%);
  border-radius: 12px 12px 0 0;
  border-bottom: 1px solid #e1eeff;
  margin-bottom: 30px;
}

.premium-header.compact-header {
  padding: 18px 18px 14px;
  margin-bottom: 16px;
}

.premium-header img {
  max-width: 120px;
  display: block;
  margin: 0 auto 15px auto;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.05));
}

.premium-header.compact-header img {
  max-width: 78px;
  margin-bottom: 8px;
}

.premium-header h2 {
  color: var(--cor-texto-escuro, #333);
  font-weight: 700;
  margin: 10px 0 0;
  font-size: 1.8rem;
}

.premium-header.compact-header h2 {
  margin-top: 4px;
  font-size: 1.4rem;
}

.premium-badge-wrapper {
  text-align: center;
  position: relative;
  top: 15px;
  z-index: 2;
}

.premium-header.compact-header .premium-badge-wrapper {
  top: 4px;
}

.premium-header.compact-header .header-subtitle {
  margin-top: 3px;
  font-size: 0.9rem;
  line-height: 1.35;
}

.badge-premium {
  display: inline-block;
  background: #e8f4fd;
  color: var(--cor-primaria, #1a73e8);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 15px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  border: 1px solid #e1eeff;
}

/* --- 2. SISTEMA WIZARD (PASSO A PASSO) --- */
.wizard-step {
  display: none;
  animation: slideIn 0.4s ease forwards;
}

.wizard-step.active {
  display: block;
}

.wizard-progress {
  display: flex;
  justify-content: space-between;
  margin-bottom: 40px;
  position: relative;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.wizard-progress::before {
  content: "";
  position: absolute;
  top: 20px;
  left: 20px;
  right: 20px;
  height: 3px;
  background: var(--borda-suave, #e0e0e0);
  z-index: 1;
}

.step-indicator {
  background: var(--cor-surface, #fff);
  border: 3px solid var(--borda-suave, #e0e0e0);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #aaa;
  position: relative;
  z-index: 2;
  transition: all 0.3s ease;
}

.step-indicator.active {
  border-color: var(--cor-primaria, #1a73e8);
  background: var(--cor-primaria, #1a73e8);
  color: #fff;
  box-shadow: 0 0 12px rgba(26, 115, 232, 0.3);
}

.step-indicator.completed {
  border-color: var(--cor-primaria, #1a73e8);
  background: #fff;
  color: var(--cor-primaria, #1a73e8);
}

.step-label {
  position: absolute;
  top: 48px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.8rem;
  color: #777;
  white-space: nowrap;
  font-weight: 600;
}

.step-indicator.active .step-label {
  color: var(--cor-primaria, #1a73e8);
}

/* NAVEGAÇÃO DE BOTÕES DO WIZARD */
.button-bar-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 25px;
  border-top: 1px solid var(--cor-borda, #f0f0f0);
}

.button-bar-nav.right {
  justify-content: flex-end;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--cor-primaria, #1a73e8);
  color: var(--cor-primaria, #1a73e8);
}

.btn-outline:hover {
  background: var(--cor-primaria, #1a73e8);
  color: #fff;
}

/* --- 3. INSTRUÇÕES GERAIS E CARDS DE PASSOS --- */
.instrucoes-wrapper {
  border-radius: 12px;
  margin-bottom: 40px;
  padding: 0;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.instrucoes-body {
  padding: 0 30px 30px 30px;
}

.instrucoes-header {
  text-align: left;
  margin-bottom: 25px;
}

.instrucoes-title {
  margin-top: 0;
  color: var(--cor-primaria, #1a73e8);
  font-size: 1.2rem;
  margin-bottom: 10px;
  text-align: center;
}

.instrucoes-destaque {
  margin-top: 15px;
  font-weight: 500;
}

.instruction-small {
  font-weight: normal;
  color: #555;
  display: block;
  margin-top: 5px;
}

.benefits-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 25px 0;
}

.benefit-card {
  background: #f8faff;
  border: 1px solid #e1eeff;
  border-radius: 10px;
  padding: 20px 15px;
  text-align: center;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.benefit-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(26, 115, 232, 0.1);
}

.benefit-icon {
  width: 50px;
  height: 50px;
  background: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 15px;
  color: var(--cor-primaria, #1a73e8);
  font-size: 1.4rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.benefit-title {
  font-weight: 700;
  color: var(--cor-texto-escuro, #333);
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.benefit-desc {
  font-size: 0.85rem;
  color: #666;
  line-height: 1.4;
  margin: 0;
}

@media (min-width: 1200px) {
  .benefits-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
  }

  .benefit-card {
    padding: 16px 12px;
  }

  .benefit-icon {
    width: 42px;
    height: 42px;
    margin-bottom: 12px;
    font-size: 1.2rem;
  }

  .benefit-title {
    font-size: 0.9rem;
    margin-bottom: 6px;
  }

  .benefit-desc {
    font-size: 0.8rem;
    line-height: 1.3;
  }
}

/* --- 4. LAYOUT DE FORMULÁRIO (GRIDS E CAMPOS) --- */
.form-section-title {
  font-size: 1.3em;
  color: var(--cor-texto-escuro, #2c3e50);
  margin-top: 10px;
  margin-bottom: 25px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--cor-borda, #f1f1f1);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.form-section-title i {
  color: var(--cor-primaria, #1a73e8);
}

.form-row,
.form-grid-2-col,
.form-grid-1-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 15px;
}

.form-grid-4-col {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
}

.form-grid-3-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 15px;
}

.col-span-2 {
  grid-column: span 2;
}

.col-span-3 {
  grid-column: span 3;
}

.required-asterisk {
  color: var(--cor-erro, #dc3545);
  font-weight: bold;
}

.hidden-section {
  display: none !important;
}

.error-message {
  color: var(--cor-erro, #dc3545);
  font-size: 0.85em;
  margin-top: 5px;
  display: none;
}

.text-warning {
  color: #856404 !important;
}

#update-section {
  background: #fff3cd;
  padding: 20px;
  border-radius: var(--borda-radius, 8px);
  border: 1px solid #ffeeba;
  color: #856404;
  margin-bottom: 20px;
  animation: fadeIn 0.5s;
}

/* Agrupamento de Botões de Radio (Contenção base) */
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  align-items: center;
  margin-top: 8px;
}

/* ELEMENTOS ESPECIAIS DE RESPONSÁVEL LEGAL */
.responsavel-fieldset {
  margin-top: 20px;
  padding: 20px;
  border: 1px solid var(--borda-suave, #e0e0e0);
  border-radius: 8px;
}

.responsavel-legend {
  font-weight: bold;
  color: var(--cor-primaria, #1a73e8);
  padding: 0 10px;
}

.responsavel-subtitle {
  margin: 0 0 10px 0;
  color: #555;
  font-size: 1em;
}

.btn-add-wrapper {
  margin-top: 15px;
  text-align: left;
}

.btn-add-responsavel {
  font-size: 0.9em;
  padding: 8px 15px;
  border-radius: 4px;
  background: #e0e0e0;
  border: none;
  cursor: pointer;
  color: #333;
  font-weight: 500;
  transition: background 0.2s;
}

.btn-add-responsavel:hover {
  background: #d0d0d0;
}

.grupo-responsavel-2-box {
  margin-top: 15px;
  background: #f9f9f9;
  padding: 15px;
  border-radius: 8px;
  border: 1px dashed #ccc;
}

/* --- 5. HORÁRIOS E DISPONIBILIDADE --- */
.horarios-options-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 15px;
  margin-top: 10px;
}

.horarios-options-container div label,
.checkbox-card,
.horario-label {
  display: flex;
  align-items: center;
  padding: 15px 10px;
  background-color: var(--cor-surface, #fff);
  border: 2px solid var(--cor-borda, #e2e8f0);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  justify-content: center;
  text-align: center;
  font-weight: 500;
  height: 100%;
  box-sizing: border-box;
  color: var(--cor-texto-secundario, #666);
  user-select: none;
}

.horarios-options-container div label:hover,
.checkbox-card:hover,
.horario-label:hover {
  border-color: var(--cor-primaria, #1a73e8);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.horarios-options-container div label:has(input:checked),
.checkbox-card:has(input:checked),
.checkbox-card.checked,
.horario-label:has(input:checked) {
  background-color: #e8f0fe;
  border-color: var(--cor-primaria, #1a73e8);
  color: var(--cor-primaria, #1a73e8);
  font-weight: 700;
}

.horarios-options-container input[type="checkbox"],
.checkbox-card input[type="checkbox"],
.horario-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.horario-detalhe-container {
  background-color: var(--cor-fundo, #fafafa);
  padding: 15px;
  border-radius: var(--borda-radius, 8px);
  margin-top: 10px;
  border: 1px solid var(--cor-borda, #eee);
  animation: fadeIn 0.3s ease;
}

.horario-detalhe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 10px;
}

/* --- 6. MODAL CUSTOMIZADO DE AVISOS DO FORMULÁRIO --- */
.custom-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  backdrop-filter: blur(4px);
}

.custom-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.custom-modal-content {
  background: white;
  padding: 30px;
  border-radius: 16px;
  width: 90%;
  max-width: 450px;
  text-align: center;
  transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

.custom-modal-overlay.active .custom-modal-content {
  transform: translateY(0);
}

.modal-icon {
  font-size: 3rem;
  margin-bottom: 20px;
  display: inline-block;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #333;
  margin-bottom: 10px;
}

.modal-message {
  color: #666;
  margin-bottom: 25px;
  font-size: 1rem;
  line-height: 1.5;
}

.modal-btn {
  background-color: var(--cor-primaria);
  color: white;
  border: none;
  padding: 12px 30px;
  border-radius: 50px;
  font-size: 1rem;
  cursor: pointer;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  font-weight: 600;
  width: 100%;
}

.modal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.modal-success .modal-icon {
  color: var(--cor-sucesso, #28a745);
}
.modal-success .modal-btn {
  background-color: var(--cor-sucesso, #28a745);
}
.modal-error .modal-icon {
  color: var(--cor-erro, #dc3545);
}
.modal-error .modal-btn {
  background-color: var(--cor-erro, #dc3545);
}
.modal-warning .modal-icon {
  color: var(--cor-alerta, #ffc107);
}
.modal-warning .modal-btn {
  background-color: var(--cor-alerta, #ffc107);
  color: #333;
}

/* --- 7. ANIMAÇÕES E RESPONSIVIDADE --- */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 600px) {
  .step-label {
    display: none;
  }
  .form-container {
    padding: 20px;
    margin: 10px;
  }
  .form-row,
  .form-grid-2-col,
  .form-grid-1-2 {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  .form-grid-4-col,
  .form-grid-3-col {
    grid-template-columns: 1fr;
  }
  .col-span-2,
  .col-span-3 {
    grid-column: span 1;
  }
}

/* =========================================================================
   AVALIAÇÕES (ESTRELAS E NPS) - PESQUISAS DE SATISFAÇÃO
   ========================================================================= */

/* --- Avaliação em Estrelas --- */
.star-rating {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: 5px;
}

.star-rating input {
  display: none;
}

.star-rating label {
  font-size: 28px;
  color: #dcdcdc;
  cursor: pointer;
  transition: color 0.2s ease-in-out;
  margin: 0;
  line-height: 1;
}

.star-rating input:checked ~ label,
.star-rating label:hover,
.star-rating label:hover ~ label {
  color: #ffc107; /* Amarelo das estrelas */
}

/* --- Escala NPS (0 a 10) --- */
.nps-scale {
  display: flex;
  justify-content: space-between;
  gap: 5px;
  margin-top: 15px;
  flex-wrap: wrap; /* Permite quebrar linha em telemóveis pequenos, se necessário */
}

.nps-scale label {
  flex: 1;
  min-width: 35px;
  margin: 0;
}

.nps-btn {
  padding: 12px 0;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  cursor: pointer;
  border-radius: 6px;
  text-align: center;
  transition: all 0.2s ease-in-out;
  font-weight: bold;
  font-size: 1.1rem;
  color: #495057;
}

.nps-btn:hover {
  background: #e2e6ea;
}

.nps-scale input[type="radio"]:checked + .nps-btn {
  background: var(--cor-primaria); /* Usa a cor verde/principal da clínica */
  color: white;
  border-color: var(--cor-primaria);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.nps-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #6c757d;
  margin-top: 8px;
  font-weight: 500;
}

/* --- Blocos de Perguntas --- */
.question-block {
  margin-bottom: 25px;
  padding: 15px;
  background: #fdfdfd;
  border: 1px solid #f0f0f0;
  border-radius: 8px;
  transition: border-color 0.2s;
}

.question-block:hover {
  border-color: #e0e0e0;
}

.question-label {
  font-weight: 600;
  color: #343a40;
  margin-bottom: 10px;
  display: block;
}

/* =========================================================================
   8. AGENDAMENTO DE TRIAGEM (PÚBLICO)
   ========================================================================= */

.header-subtitle {
  color: white;
  margin-top: 15px;
  font-size: 1.05rem;
  opacity: 0.9;
}

.instruction-text {
  font-size: 1.05rem;
  color: #444;
  line-height: 1.6;
}

.instruction-list {
  font-size: 1.05rem;
  color: #444;
  line-height: 1.6;
  padding-left: 20px;
}

.instruction-list li {
  margin-bottom: 10px;
}

.info-box-highlight {
  background-color: #f8fcf8;
  border-left: 4px solid var(--cor-primaria, #1a73e8);
  padding: 15px;
  border-radius: 4px;
}

.info-box-highlight p {
  margin: 0;
  color: #333;
}

.center-title {
  text-align: center;
  border-bottom: none;
}

.horarios-container {
  margin-top: 15px;
}

.loading-spinner {
  margin: 20px auto;
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--cor-primaria, #1a73e8);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.loading-text {
  text-align: center;
  color: #666;
}

.modalidade-titulo {
  color: var(--cor-primaria, #1a73e8);
  font-size: 1.2rem;
  margin-top: 20px;
  margin-bottom: 10px;
  border-bottom: 1px solid #eee;
  padding-bottom: 5px;
}

.data-grupo {
  margin-bottom: 20px;
}

.data-grupo h4 {
  color: #555;
  font-size: 1.05rem;
  margin-bottom: 10px;
}

.horarios-botoes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.horario-btn {
  background-color: white;
  color: var(--cor-primaria, #1a73e8);
  border: 1px solid var(--cor-primaria, #1a73e8);
  padding: 10px 18px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}

.horario-btn:hover {
  background-color: var(--cor-primaria, #1a73e8);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.success-container {
  text-align: center;
  padding: 30px;
  background-color: #f8fcf8;
  border: 1px solid #d3ecd9;
  border-radius: 8px;
}

.success-icon-large {
  font-size: 4rem;
  color: var(--cor-sucesso, #28a745);
  margin-bottom: 15px;
}

.success-title {
  color: #166534;
  font-size: 1.5rem;
  margin-bottom: 15px;
}

.success-message {
  color: #166534;
  margin-bottom: 20px;
}

.success-details-box {
  margin: 0 auto;
  text-align: left;
  display: inline-block;
  background: white;
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  width: 100%;
  max-width: 400px;
}

.success-details-box p {
  margin-bottom: 12px;
  font-size: 1.05rem;
}

.success-details-box p:last-child {
  margin-bottom: 0;
}

.align-left {
  text-align: left !important;
}

.modal-header-custom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #eee;
  padding-bottom: 15px;
  margin-bottom: 20px;
}

.modal-title-custom {
  margin: 0;
  font-size: 1.3rem;
  color: var(--cor-primaria, #1a73e8);
}

.close-modal-btn {
  background: none;
  border: none;
  font-size: 1.8rem;
  cursor: pointer;
  color: #999;
  line-height: 1;
}

.modal-subtitle {
  margin-bottom: 20px;
  font-size: 1.05rem;
  color: #555;
}

.text-primary {
  color: var(--cor-primaria, #1a73e8);
}

.feedback-message {
  margin-top: 5px;
  font-size: 0.9em;
  font-weight: 500;
  display: none;
}
/* =========================================================================
   9. COMPONENTES DE UPLOAD DE ARQUIVOS (Admissão e Anexos)
   ========================================================================= */
.upload-wrapper {
  margin-bottom: 15px;
}

.upload-area {
  border: 2px dashed var(--cor-borda, #ccc);
  padding: 25px 20px;
  text-align: center;
  border-radius: var(--borda-radius, 8px);
  cursor: pointer;
  background: var(--cor-surface, #fff);
  transition: all 0.2s ease-in-out;
}

.upload-area:hover {
  border-color: var(--cor-primaria, #1a73e8);
  background-color: #f8faff;
}

.upload-area i {
  color: var(--cor-texto-secundario, #999);
  transition: color 0.2s;
}

.upload-area:hover i {
  color: var(--cor-primaria, #1a73e8);
}

.file-status {
  color: var(--cor-sucesso, #28a745);
  font-weight: 700;
  font-size: 0.95rem;
  margin-top: 12px;
}

/* =========================================================================
   10. BOTÕES DE AÇÃO (Avançar e Enviar)
   ========================================================================= */
.action-button {
  background-color: var(--cor-primaria, #1a73e8);
  color: #ffffff;
  border: none;
  padding: 15px 35px !important;
  border-radius: 50px !important;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background-color 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.action-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(26, 115, 232, 0.25);
}

.action-button:disabled {
  background-color: #cccccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
