@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap");

/*
>>> Poppins Font (Self-Hosted)
*/
@font-face {
  font-display: swap;
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 400;
  src: url('/assets/fonts/poppins-v21-latin-regular.woff2') format('woff2');
}
@font-face {
  font-display: swap;
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 600;
  src: url('/assets/fonts/poppins-v21-latin-600.woff2') format('woff2');
}
@font-face {
  font-display: swap;
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 700;
  src: url('/assets/fonts/poppins-v21-latin-700.woff2') format('woff2');
}

/* Reset global */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --accent-color: 59,130,246;
  --secondary-color: 13,13,13;
  --background-color: 247,246,245;
  --question-color: 53,53,59;
  --answer-color: 0,0,0;
  --answer-bg: 255,255,255;
}

body {
  font-family: 'Poppins', sans-serif;
  font-size: 16px;
  background-color: rgb(var(--background-color));
  color: rgb(var(--secondary-color));
}

/* Container geral do quiz */
.quiz-container {
  /* Não ocupar toda a viewport para que o footer fique visível sem scroll */
  min-height: auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 24px 15px;
}

.form-card {
  position: relative;
  overflow: hidden;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.08), 0 2px 6px rgba(59,130,246,0.06);
  margin: 0 auto;
  max-width: 720px;
  padding: 4rem 3rem; /* mais respiro superior para o título */
  transition: box-shadow 0.3s, opacity 0.4s ease;
  min-width: 420px;
  min-height: 520px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid rgba(0,0,0,0.05);
}
.form-card.quiz-loading {
  opacity: 0;
  pointer-events: none;
}
.form-card:hover {
  box-shadow: 0 14px 50px rgba(0,0,0,0.1), 0 3px 8px rgba(59,130,246,0.08);
}

.form-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: var(--progress, 0%);
  height: 8px;
  border-radius: 16px;
  background: rgb(var(--accent-color)) !important;
  background-size: 100% 100% !important;
  animation: none !important;
  box-shadow: 0 3px 12px 2px rgba(var(--accent-color), 0.35) !important;
  transition: width 0.5s cubic-bezier(.4,0,.2,1);
  z-index: 2;
}

@keyframes animate-gradient {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: 0% 0;
  }
}

/* Texto da pergunta */
.form-card h4 {
  font-size: 1.65rem;
  font-weight: 600;
  color: rgb(var(--question-color));
  margin-bottom: 0.5rem;
}

.form-card p {
  font-size: 0.875rem;
  color: #555;
  margin-bottom: 1rem;
}

.custom-radio .btn-outline-secondary {
  padding: 0.85rem 1.2rem;
  min-height: 44px;
  font-size: 1.05rem;
  gap: 0.8rem;
  border-radius: 50px;
  text-align: left;
  width: 100%;
  background-color: #fafafa;
  border: 1.8px solid #888;
  color: #333;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  transition: background-color 0.18s, border-color 0.18s, color 0.18s, box-shadow 0.18s;
  box-shadow: 0 1px 4px rgba(79,209,197,0.04);
}
.custom-radio .btn-outline-secondary:hover {
  background-color: #eff6ff;
  border-color: #3b82f6;
  color: #222;
  box-shadow: 0 2px 8px rgba(59,130,246,0.10);
}
.custom-radio .btn-check:checked + .btn-outline-secondary {
  background-color: #fff !important;
  border-color: rgb(var(--accent-color)) !important;
  color: rgb(var(--secondary-color)) !important;
  box-shadow: 0 0 0 3px rgba(var(--accent-color), 0.25) !important;
  transform: scale(1.02);
}

.custom-radio .btn-check + .btn-outline-secondary::before {
  width: 24px;
  height: 24px;
  margin-right: 10px;
  border: 2.5px solid rgb(var(--accent-color)) !important;
  border-radius: 50%;
  background: #fff;
  box-sizing: border-box;
  transition: border-color 0.18s, box-shadow 0.18s;
  vertical-align: middle;
}
.custom-radio .btn-check:checked + .btn-outline-secondary::before {
  border-color: rgb(var(--accent-color)) !important;
}
.custom-radio .btn-check + .btn-outline-secondary::after {
  left: 12px;
  width: 10px;
  height: 10px;
  background: rgb(var(--accent-color)) !important;
  border-radius: 50%;
  opacity: 0;
  transition: transform 0.18s, opacity 0.18s;
}
.custom-radio .btn-check:checked + .btn-outline-secondary::after {
  transform: translateY(-50%) scale(1);
  opacity: 1;
}

.custom-radio .btn-check:checked + .btn-outline-secondary {
  font-weight: 600;
  letter-spacing: 0.5px;
}

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

/* Nova animação escalonada para as opções */
.custom-radio {
  animation: fadeInOption 0.4s backwards; 
}

.custom-radio:nth-child(1) { animation-delay: 0.1s; }
.custom-radio:nth-child(2) { animation-delay: 0.2s; }
.custom-radio:nth-child(3) { animation-delay: 0.3s; }
.custom-radio:nth-child(4) { animation-delay: 0.4s; }
.custom-radio:nth-child(5) { animation-delay: 0.5s; }
.custom-radio:nth-child(6) { animation-delay: 0.6s; }

.form-fade-in {
  transition: opacity 0.4s, transform 0.4s;
}
.form-fade-out {
  transition: opacity 0.4s, transform 0.4s;
  pointer-events: none;
}

/* Botões */
#submit-spanish-btn, #submit-btn {
  background: rgb(var(--accent-color)) !important;
  color: #fff;
  border: none;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(var(--accent-color),0.20);
  transition: background 0.25s, box-shadow 0.25s, transform 0.2s;
  font-size: 1.125rem;
  padding: 0.75rem;
  border-radius: 50px;
}
#submit-spanish-btn:hover, #submit-btn:hover {
  background: rgba(var(--accent-color), 0.9) !important;
  box-shadow: 0 4px 16px rgba(var(--accent-color),0.30);
  transform: translateY(-1px);
}
.back-btn {
  color: #666;
  font-size: 0.875rem;
  padding: 0.5rem 0;
  transition: color 0.3s;
}
.back-btn:hover {
  color: rgb(var(--accent-color));
}

/* Switch de consentimento */
.switch-wrapper {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
  background-color: #f8f9fa;
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid #e9ecef;
}
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
  background-color: #e9ecef;
  border-radius: 28px;
  transition: background-color 0.3s ease;
  flex-shrink: 0;
  cursor: pointer;
}
.switch::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  background-color: #fff;
  border-radius: 50%;
  transition: transform 0.3s cubic-bezier(.4,0,.2,1), box-shadow 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
#switch {
  opacity: 0;
  width: 0;
  height: 0;
}
#switch:checked + .switch {
  background-color: rgb(var(--accent-color));
}
#switch:checked + .switch::after {
  transform: translateX(22px);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.switch-wrapper span {
  font-size: 0.875rem;
  color: #666;
}
#switchWarning {
  display: none;
  color: #dc3545;
  font-size: 0.875rem;
  margin-top: 0.5rem;
  text-align: center;
}
.btn.disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.input-wrapper {
  position: relative;
}
.input-wrapper .form-control {
  padding-left: 2.5rem;
}
.input-wrapper .input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  fill: #adb5bd;
  transition: fill 0.2s;
}
.input-wrapper .form-control:focus + .input-icon {
  fill: rgb(var(--accent-color));
}

.form-control {
  border-radius: 8px;
  padding: 0.5rem;
  font-size: 0.875rem;
}
.form-control:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
  transition: box-shadow 0.2s;
}

.shake-error {
  animation: shake 0.5s;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.is-invalid {
  border-color: #dc3545;
}
.invalid-feedback {
  display: none;
  font-size: 0.75rem;
  margin-top: 0.25rem;
}
.is-invalid-wrapper + .invalid-feedback {
  display: block;
}

html, body {
  height: 100%;
}

body#spanishQuiz, body#mxCcEsQuiz, body#mxEmpEsQuiz, body#empEsUsaQuiz, body#empEsUsaQuizPush, body#arEmpEsQuiz {
  min-height: 100vh;
  min-height: 100svh; /* evita jump da barra do navegador mobile */
  min-height: 100dvh; /* fallback moderno para estabilidade de viewport */
  display: flex;
  flex-direction: column;
}

main.quiz-container {
  flex: 1 0 auto;
}

footer {
  margin-top: auto;
  padding-top: 17px; /* espaço no topo do footer */
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

/* Remove o espaçamento extra do utilitário mt-4 aplicado no footer do template */
footer.mt-4 { margin-top: auto !important; }

footer .small {
  font-size: 0.65rem;
  line-height: 1.3;
  color: #242226;
  text-align: center;
}

footer a { color: black; }

@media (max-width: 767.98px) {
  /* Reaproxima o layout do mobile original e mantém o footer visível */
  /* Unifica o fundo: apenas branco do quiz + footer cinza */
  body#spanishQuiz, body#mxCcEsQuiz, body#mxEmpEsQuiz, body#empEsUsaQuiz, body#empEsUsaQuizPush, body#arEmpEsQuiz { background-color: #FFFFFF; }
  .quiz-container { background-color: #FFFFFF; }
  .quiz-container {
    display: block;
    padding: 0 0 16px 0;
  }
  #quiz-forms { background-color: #FFFFFF; }
  #quiz-forms form { background-color: transparent; box-shadow: none; }
  .form-card {
    width: 100%;
    min-height: auto;
    min-width: 0; /* evita overflow horizontal em telas < 420px */
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    border: none;            /* remove a borda que criava contorno */
    background: #FFFFFF;     /* garante unificação com o fundo branco */
    padding: 5rem 1.5rem; /* mais espaço no topo para o título */
    margin-bottom: 0; /* remove faixa em branco acima do footer no mobile */
  }
  /* remove qualquer sombra do progresso no mobile */
  .form-card::before { box-shadow: none !important; }
  .custom-radio .btn-outline-secondary {
    padding: 0.5rem;
    font-size: 0.875rem;
  }
  /* previne sombra em estados de toque que disparam :hover no mobile */
  .form-card:hover { box-shadow: none !important; }
}

/* Ajustes extras para telas muito pequenas */
@media (max-width: 380px) {
  .form-card {
    padding: 3.25rem 1rem; /* mais espaço no topo para o título (telas muito pequenas) */
  }
  .form-card h4 { font-size: 1.25rem; }
  .custom-radio .btn-outline-secondary { font-size: 0.82rem; padding: 0.45rem; }
  footer .small { font-size: 0.6rem; line-height: 1.2; padding: 8px 10px; }
}
@media (min-width: 1000px) {
  .form-card {
    padding: 4rem 3rem; /* manter mais espaço superior também no desktop grande */
    margin: 2rem auto;
  }
}
@media (max-width: 500px) {
  .form-card {
    padding: 3rem 1rem;
  }
  .form-card h4 {
    font-size: 1.1rem;
  }
  .custom-radio .btn-outline-secondary {
    font-size: 0.95rem;
    padding: 0.7rem 0.7rem;
    min-height: 38px;
  }
  .custom-radio .btn-check + .btn-outline-secondary::before {
    width: 18px;
    height: 18px;
    margin-right: 7px;
  }
  .custom-radio .btn-check + .btn-outline-secondary::after {
    left: 7px;
    width: 7px;
    height: 7px;
  }
}

.custom-radio .btn-outline-secondary:active {
  background-color: #dbeafe; /* azul claro (blue-100) em vez de verde */
  box-shadow: 0 2px 8px rgba(59,130,246,0.12); /* sombra azul suave */
  border-color: #3b82f6; /* reforça o contorno azul no press */
}

.phone-input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.country-code {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 2;
  padding: 0 5px;
  background-color: transparent;
  pointer-events: none;
}

.phone-input-container input {
  padding-left: 70px !important;
}

.country-code img {
  width: 20px;
  height: auto;
  border-radius: 2px;
}

.country-code span {
  color: #495057;
  font-weight: 500;
}

#quiz-forms form .mb-2.small.text-muted {
  display: none;
}

#quiz-forms #form-1 .mb-2.small.text-muted {
  display: block;
}
