/* Import Open Sans font from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;600;700&display=swap');

/* General Body & Container */
body {
  background-color: #f8f9fa;
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #212529;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 2rem;
  overflow-y: auto;
}

main.container {
  background-color: #ffffff;
  padding: 2rem 3rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  max-width: 800px;
  width: 100%;
  margin: 2rem 0;
  overflow: hidden; /* Contains the header and form animations */
}

/* Header */
header {
  background-color: #013240;
  padding: 1rem 1.5rem;
  border-radius: 8px 8px 0 0;
  margin: -2rem -3rem 1.5rem -3rem;
  text-align: center;
}
header .logo-container img {
  max-width: 140px;
  height: auto;
}
header h1 {
  color: #ffffff;
  font-size: 1.25rem;
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
  line-height: 1.3;
}
header p {
  color: #9ca3af;
  font-size: 0.9rem;
  margin: 0;
}

/* Progress Bar */
#progress-bar {
  height: 8px;
  background-color: #00c7ff; /* UTEC Sky Blue */
  width: 0%;
  border-radius: 4px;
  transition: width 0.3s ease-in-out;
  margin-bottom: 2rem;
}

/* Ocultar barra de progreso en pantalla de bienvenida */
.form-step.welcome-screen ~ #progress-bar,
.welcome-screen.active ~ #progress-bar {
  display: none;
}

/* Conversational Form Styles */
#enrollmentForm {
  position: relative;
  min-height: 400px; /* Give space for steps to transition */
}

.form-step {
  display: none; /* Hide all steps by default */
  animation: fadeOut 0.4s forwards;
  text-align: center;
}

.form-step.active {
  display: block;
  animation: fadeIn 0.4s forwards;
}

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

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}


/* Form Elements */
.form-step label {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  display: block;
}

input[type="text"],
input[type="email"],
input[type="tel"],
select {
  display: block;
  width: 100%;
  max-width: 600px; /* Increased for longer option text */
  margin: 0 auto; /* Center the input */
  padding: 1rem 1rem;
  font-size: 1rem;
  line-height: 1.6;
  color: #212529;
  background-color: #fff;
  border: 2px solid #ced4da;
  border-radius: 6px;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  box-sizing: border-box;
  text-align: left;
  font-family: 'Open Sans', sans-serif;
}

/* Custom dropdown styling */
.custom-dropdown {
  position: relative;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.custom-dropdown input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23212529' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 14px 14px;
  padding-right: 3rem;
  cursor: pointer;
}

.dropdown-list {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 2px solid #00c7ff;
  border-top: none;
  border-radius: 0 0 6px 6px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.dropdown-list.open {
  display: block;
}

.dropdown-item {
  padding: 1rem;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  transition: background-color 0.15s;
  word-break: break-word;
  white-space: normal;
  overflow-wrap: break-word;
}

.dropdown-item:hover,
.dropdown-item.active {
  background-color: #f0f9ff;
  border-left: 4px solid #00c7ff;
  padding-left: calc(1rem - 4px);
}

.dropdown-item:last-child {
  border-bottom: none;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23212529' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 3rem;
}

input:focus, select:focus {
  border-color: #00c7ff;
  outline: 3px solid rgba(0, 199, 255, 0.25);
  outline-offset: 2px;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Radio Button Group Styling */
fieldset[role="radiogroup"] {
  border: none;
  padding: 0;
  margin: 0;
}
fieldset[role="radiogroup"] legend {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  display: block;
  width: 100%;
}
fieldset[role="radiogroup"] label {
  display: flex; /* Use flexbox for alignment */
  align-items: center;
  width: 100%;
  max-width: 500px;
  margin: 0.5rem auto;
  padding: 1rem;
  font-size: 1.25rem;
  font-weight: 500; /* Reset font-weight */
  border: 1px solid #ced4da;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
  text-align: left; /* Align text to the left */
}
fieldset[role="radiogroup"] label:hover {
  background-color: #f8f9fa;
  border-color: #80bdff;
}
fieldset[role="radiogroup"] input[type="radio"] {
  margin-right: 0.75rem;
  transform: scale(1.2);
}

/* File & Checkbox */
.file-upload-wrapper, 
label:has(input[type="checkbox"]) {
  max-width: 500px;
  margin: 0 auto;
}

/* Navigation Buttons */
.navigation-buttons {
  display: flex !important; /* Forzar display flex */
  justify-content: center;
  gap: 1rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e9ecef;
  width: 100%;
  flex-shrink: 0; /* No permitir que se encoja */
}

.navigation-buttons button {
  display: inline-block;
  font-weight: 600;
  color: #fff;
  text-align: center;
  vertical-align: middle;
  cursor: pointer;
  background-color: #00c7ff;
  border: 1px solid #00c7ff;
  padding: 0.75rem 1.5rem;
  font-size: 1.1rem;
  line-height: 1.5;
  border-radius: 0.25rem;
  transition: background-color 0.15s ease-in-out;
}

.navigation-buttons button:hover:not(:disabled) {
  background-color: #00aed4;
}

#prevButton {
  background-color: #6c757d;
  border-color: #6c757d;
}
#prevButton:hover:not(:disabled) {
  background-color: #5a6268;
}

.navigation-buttons button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Utility classes */
.hidden {
  display: none !important;
}

/* Loader */
#loader {
  font-size: 1.2rem;
  text-align: center;
  padding: 4rem 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #00c7ff; /* Changed to sky blue */
}
#loader::before {
  content: "";
  width: 40px;
  height: 40px;
  border: 4px solid rgba(0, 199, 255, 0.2); /* Changed to sky blue rgba */
  border-top-color: #00c7ff; /* Changed to sky blue */
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Modal and Result Message styling remains similar */
dialog{border:1px solid #ccc;border-radius:8px;box-shadow:0 4px 12px rgba(0,0,0,.15);max-width:600px;padding:0}dialog::backdrop{background:rgba(0,0,0,.5);backdrop-filter:blur(3px)}dialog article{padding:1.5rem}dialog header{padding:1rem 1.5rem;margin:0;border-bottom:1px solid #e9ecef;background-color:#f8f9fa;text-align:left}dialog header h3{margin:0;font-size:1.25rem}dialog footer{display:flex;gap:1rem;justify-content:flex-end;margin-top:1.5rem;padding-top:1rem;border-top:1px solid #e9ecef}dialog button{padding:.6rem 1.2rem;border-radius:4px;border:1px solid transparent;font-weight:600;cursor:pointer}dialog #confirmSubmitButton{background-color:#00c7ff;color:#fff}dialog #cancelModalButton{background-color:#6c757d;color:#fff}

/* Styles for Definition List in Modal */
#confirmationData dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.75rem 1.5rem;
}
#confirmationData dt {
  font-weight: 600;
  color: #495057;
  grid-column: 1;
}
#confirmationData dd {
  margin: 0;
  grid-column: 2;
  color: #212529;
}

/* Result Modal Specific Styles */
#resultModal {
  max-width: 700px;
}
#resultModalContent {
  line-height: 1.6;
}
#resultModalContent p {
  margin-bottom: 1rem;
}
#resultModalContent a {
  color: #00c7ff;
  text-decoration: none;
  font-weight: 600;
}
#resultModalContent a:hover {
  text-decoration: underline;
}
#resultModalContent ul {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}
#resultModalContent strong {
  color: #212529;
}
#closeResultModalButton {
  background-color: #00c7ff;
  color: #fff;
}

/* Spinner Animation for Processing State */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

#result-message{padding:1rem;border-radius:4px;margin-bottom:1rem;text-align:center}#result-message.pico-color-green-400{background-color:#d4edda;color:#155724;border:1px solid #c3e6cb}#result-message.pico-color-red-400{background-color:#f8d7da;color:#721c24;border:1px solid #f5c6cb}
/* Minor adjustments for file input and checkbox in conversational layout */
.file-upload-wrapper{border:none}.file-upload-button{border-radius:4px;}.file-upload-label{display:none}label:has(input[type=checkbox]){border:1px solid #ced4da;border-radius:4px;padding:1rem;justify-content:center;font-size:1.25rem}label:has(input[type=checkbox]):hover{background-color:#f8f9fa}

/* ===================================
   SPLIT-SCREEN LAYOUT CON AYUDA VISUAL
   =================================== */

/* Container principal para cada paso */
.form-step {
  display: none;
  animation: fadeOut 0.4s forwards;
  text-align: center;
}

.form-step.active {
  display: block;
  animation: fadeIn 0.4s forwards;
}

/* Split-screen con grid para pasos que tienen help-media */
.form-step.active .step-help-media {
  display: block;
}

.form-step.active:has(.step-help-media) {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: center;
  text-align: left;
}

.step-content {
  text-align: center;
}

/* Media de ayuda (imágenes/videos) */
.step-help-media {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background-color: #f8f9fa;
  border-radius: 8px;
  overflow: hidden;
}

.help-image {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.help-image:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(0, 199, 255, 0.3);
}

/* Contenido del formulario */
.step-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-align: center; /* Mantiene texto centrado */
}

.step-content label {
  font-size: 1.5rem;
  font-weight: 600;
  color: #212529;
  margin-bottom: 0.5rem;
}

/* Texto de ayuda explicativo */
.help-text {
  display: block;
  font-size: 1rem;
  font-weight: 600; /* Negrita */
  font-style: italic; /* Itálica */
  color: #495057; /* Color más oscuro para mejor contraste */
  line-height: 1.6;
  margin-top: 0.5rem; /* Separación de la pregunta */
  margin-bottom: 1.5rem; /* MÁS separación del campo input */
  padding: 1rem;
  background-color: #e7f7ff;
  border-left: 4px solid #00c7ff;
  border-radius: 4px;
  text-align: left;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); /* Sutil sombra para destacar */
}

/* Enfatizar palabras clave dentro del help-text */
.help-text strong {
  color: #00c7ff; /* Color UTEC para palabras clave */
  font-weight: 700;
}

/* RESPONSIVE: Mobile */
@media (max-width: 768px) {
  main.container {
    max-width: 100%;
    padding: 1rem;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
  }

  header {
    margin: -1rem -1rem 1.5rem -1rem;
  }

  body {
    padding: 0;
  }

  /* Split-screen en mobile: una columna */
  .form-step.active:has(.step-help-media) {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .step-help-media {
    order: -1;
    margin-bottom: 1rem;
  }

  .step-content {
    order: 1;
  }

  .step-content label {
    font-size: 1.25rem;
  }

  .help-text {
    font-size: 0.9rem;
  }

  /* Larger touch targets on mobile */
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  select,
  button {
    min-height: 44px;
  }

  fieldset[role="radiogroup"] label {
    padding: 1.25rem;
    font-size: 1.1rem;
  }

  /* Custom dropdown responsive on mobile */
  .custom-dropdown,
  .custom-dropdown input {
    max-width: 100%;
  }

  .dropdown-list {
    max-height: 250px;
  }

  /* Botones en mobile */
  .navigation-buttons {
    flex-direction: column;
    gap: 0.75rem;
  }

  .navigation-buttons button {
    width: 100%;
  }
}

/* ===================================
   PANTALLA DE BIENVENIDA
   =================================== */

.welcome-screen {
  text-align: center;
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.welcome-screen h2 {
  color: #212529;
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
  font-weight: 700;
}

.welcome-content {
  animation: fadeIn 0.6s ease-in-out;
}

.welcome-video {
  margin: 2rem 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  overflow: hidden;
}

.welcome-text {
  font-size: 1rem;
  line-height: 1.6;
  color: #495057;
}

.welcome-text p {
  margin: 1rem 0;
}

.welcome-highlight {
  background-color: #e7f7ff;
  padding: 1.5rem;
  border-left: 4px solid #00c7ff;
  border-radius: 4px;
  margin: 2rem 0;
}

.welcome-notes {
  background-color: #f8f9fa;
  padding: 1.5rem;
  border-radius: 8px;
  margin-top: 2rem;
}

.welcome-start-btn {
  background-color: #00c7ff;
  color: white;
  border: none;
  padding: 1rem 3rem;
  font-size: 1.25rem;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 2rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 199, 255, 0.3);
}

.welcome-start-btn:hover {
  background-color: #00aed4;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 199, 255, 0.4);
}

.welcome-start-btn:active {
  transform: translateY(0);
}

/* Ocultar botones de navegación en pantalla de bienvenida */
.welcome-screen.active ~ .navigation-buttons {
  display: none !important;
}

/* Mobile */
@media (max-width: 768px) {
  .welcome-screen h2 {
    font-size: 1.5rem;
  }

  .welcome-video iframe {
    height: 250px;
  }

  .welcome-start-btn {
    width: 100%;
    padding: 1rem 2rem;
  }
}

/* ===================================
   LIGHTBOX MODAL PARA IMÁGENES
   =================================== */

.lightbox-modal {
  display: none;
  position: fixed;
  z-index: 9999;
  padding-top: 60px;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(5px);
}

.lightbox-modal.active {
  display: block;
  animation: fadeIn 0.3s;
}

.lightbox-content {
  margin: auto;
  display: block;
  width: 90%;
  max-width: 1200px;
  max-height: 85vh;
  object-fit: contain;
  animation: zoomIn 0.3s;
}

@keyframes zoomIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 40px;
  color: #ffffff;
  font-size: 40px;
  font-weight: bold;
  transition: 0.3s;
  cursor: pointer;
  z-index: 10000;
}

.lightbox-close:hover,
.lightbox-close:focus {
  color: #00c7ff;
  text-decoration: none;
  cursor: pointer;
}

.lightbox-caption {
  margin: auto;
  display: block;
  width: 80%;
  max-width: 700px;
  text-align: center;
  color: #ffffff;
  padding: 10px 0;
  font-size: 1rem;
}

/* Mobile lightbox */
@media (max-width: 768px) {
  .lightbox-content {
    width: 95%;
    max-height: 80vh;
  }

  .lightbox-close {
    top: 10px;
    right: 20px;
    font-size: 35px;
  }
}

/* ============================================
   BOT PROTECTION: Honeypot Field
   ============================================
   This field is invisible to humans and screen readers but visible to bots.
   - Positioned off-screen (not display:none which bots detect)
   - aria-hidden="true" makes it invisible to screen readers
   - tabindex="-1" prevents keyboard focus
   - If filled, the submission is likely from a bot
   ============================================ */
.honeypot-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
