/* ==============================================
   RESETEO GLOBAL Y ESTILOS BASE
   ============================================== */
* {
  margin: 0;
  padding: 0;
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "San Francisco",
    Helvetica, Arial, sans-serif;
  font-weight: 400;
  box-sizing: border-box;
  
}

html {
  height: 100%;
  width: 100%;
  overflow-x: hidden;
}

body {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  background: linear-gradient(90deg, #ffffff 16.83%, #43e9e8 100%);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  overflow-x: hidden;

/* 👇 --- FIX 2: AÑADIDO position: relative --- 👇 */
/* Esto "ancla" tu .titulo_login para que respete el padding-top */
position: relative; 

/* --- ESTO ESTÁ PERFECTO --- */
/* Esto crea un "colchón" invisible en los bordes 
     que respeta el 'safe area' del dispositivo */
padding-top: env(safe-area-inset-top);
padding-right: env(safe-area-inset-right);
padding-bottom: env(safe-area-inset-bottom);
padding-left: env(safe-area-inset-left);
}

/* ==============================================
   LAYOUT PRINCIPAL (DESKTOP)
   ============================================== */
.titulo_login {
  position: absolute;
  top: 5vh;
  left: 0;
  right: 0;
  width: 100%;
  margin-left: 0;
  color: #000000;
  font-size: 1.875rem; /* 30px */
  text-align: center;
  text-shadow: 0.0625rem 0.0625rem 0.25rem rgba(0, 0, 0, 0.3);
}

.container {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-content: center;
  width: 90vw;
  height: 90vh;
}

/* ==============================================
   SECCIONES DE FORMULARIO (LOGIN Y REGISTRO)
   ============================================== */
.login-section,
.section-regitro {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  flex: 0 0 30vw;
  height: 85%;
  margin-top: 8vw;
  margin-left: 10vw;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 0.625rem; /* 10px */
  box-shadow: 0 0.25rem 4.375rem 0 rgba(0, 0, 0, 0.1);
}

.login-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-items: start;
  width: 70%;
  height: auto;
  margin-top: -6vh;
}

.logo-container {
  width: 60%;
  text-align: center;
}

/* --- FIX LOGO --- */
.logo {
  max-width: 100%;
  height: auto; /* ARREGLADO: Mantiene la proporción */
  object-fit: contain;
}

.input_container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-items: center;
  width: 100%;
  margin-top: -3vh;
}

.input-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-items: start;
  width: 100%;
  margin-bottom: 0.625rem; /* 10px */
}

.input-group label {
  margin-bottom: 0.3125rem; /* 5px */
  color: rgba(2, 7, 63, 1);
  font-size: 0.875rem; /* 14px */
  font-weight: 400;
}

.input-group input {
  width: 100%;
  height: 6vh;
  padding: 0.625rem; /* 10px */
  background: rgba(255, 255, 255, 1);
  border: none;
  border-radius: 0.3125rem; /* 5px */
  box-shadow: 0 0.125rem 0.3125rem 0 rgba(0, 0, 0, 0.1);
  font-size: 0.875rem; /* 14px */
}

/* --- Contraseña --- */
.password-wrapper {
  position: relative;
  width: 100%;
}

.password-wrapper input#clave {
  width: 100%;
  padding-right: 2.8125rem; /* 45px */
}

.password-wrapper .toggle-icon {
  position: absolute;
  top: 50%;
  right: 0.9375rem; /* 15px */
  transform: translateY(-50%);
  z-index: 10;
  color: #757575;
  cursor: pointer;
}

/* --- Links y Botones de Formulario --- */
.text_link {
  align-self: start;
  margin-top: -0.5rem; /* -8px */
  margin-left: 0;
  color: rgba(2, 7, 63, 1);
  font-size: 0.625rem; /* 10px */
  text-decoration: none;
}

.btn-ingreso,
.btn-registro {
  width: 100%;
  height: 6vh;
  padding: 0.625rem; /* 10px */
  margin-top: 0.625rem; /* 10px */
  background-color: rgba(67, 233, 232, 1);
  color: rgba(255, 255, 255, 1);
  font-size: 0.875rem; /* 14px */
  font-weight: bold;
  border: none;
  border-radius: 0.3125rem; /* 5px */
  box-shadow: 0 0.25rem 0.625rem 0 rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.btn-ingreso:hover,
.btn-registro:hover {
  background-color: rgba(50, 200, 200, 1);
}

.btn-registro {
  margin-left: 0;
}

/* --- Términos y Condiciones (Checkbox) --- */
.terminos-container {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  margin-top: 0.9375rem; /* 15px */
  margin-bottom: 0.625rem; /* 10px */
  color: rgba(2, 7, 63, 1);
  font-size: 0.75rem; /* 12px */
  flex-wrap: wrap;
}

.terminos-container input[type="checkbox"] {
  margin-right: 0.5rem; /* 8px */
}

.terminos-container label {
  margin: 0;
  font-size: 0.75rem; /* 12px */
  font-weight: 400;
}

.terminos-container a.terminos_link_inline {
  color: rgba(2, 7, 63, 1);
  font-weight: bold;
  text-decoration: none;
}

.terminos-container a.terminos_link_inline:hover {
  text-decoration: underline;
}

/* --- Links extra (Sociales, etc.) --- */
.extra-links {
  display: flex;
  justify-content: space-between;
  justify-self: center;
  width: 100%;
  margin-top: 0.625rem; /* 10px */
  color: rgba(2, 7, 63, 1);
  font-size: 0.75rem; /* 12px */
  text-align: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.extra-links a {
  color: rgba(2, 7, 63, 1);
  font-weight: bold;
  text-decoration: none;
}

.text_redes {
  margin-top: 5vh;
  color: rgba(2, 7, 63, 1);
  font-size: 0.75rem; /* 12px */
  text-align: center;
}

.social-icons {
  display: flex;
  justify-content: center;
  gap: 3.125rem; /* 50px */
  margin-top: 0.3125rem; /* 5px */
}

.social-icons a img {
  width: 3.1875rem; /* 35px */
  height: 3.1875rem; /* 35px */
  padding: 0.0425rem 0.2375rem; /* 1px 15px */
  background-color: rgba(255, 255, 255, 1);
  border-radius: 2.5rem; /* 40px */
  box-shadow: 0 0.0625rem 0.25rem 0 rgba(0, 0, 0, 0.25) inset;
  cursor: pointer;
}

/* ==============================================
   SECCIONES DE FORMULARIO MULTI-PASO
   ============================================== */
.section1,
.section2,
.section3 {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: auto;
  margin-left: 0;
}

.section2 {
  margin-top: 10vh;
}

/* Ocultar pasos por defecto */
.section2,
.section3 {
  display: none;
}

.button-container p {
  margin-top: 0.625rem; /* 10px */
  color: rgba(2, 7, 63, 1);
  font-size: 0.875rem; /* 14px */
}

.button-container .enlace {
  color: rgba(2, 7, 63, 1);
  font-weight: bold;
  text-decoration: none;
}

/* --- Botones de Navegación Multi-paso --- */
.navigation-buttons {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  margin-top: 1.25rem; /* 20px */
}

.navigation-buttons button {
  flex: 0 1 48%;
  padding: 0.75rem 1.5625rem; /* 12px 25px */
  color: #ffffff;
  font-size: 1rem; /* 16px */
  font-weight: 500;
  border: none;
  border-radius: 1.5625rem; /* 25px */
  cursor: pointer;
  transition: background-color 0.3s;
}

.navigation-buttons button#btn-prev {
  background-color: #6c757d;
}
.navigation-buttons button#btn-prev:hover {
  background-color: #5a6268;
}

.navigation-buttons button#btn-next,
.navigation-buttons button#btn-submit {
  background-color: rgba(67, 233, 232, 1);
  color: #fff;
  font-weight: bold;
}
.navigation-buttons button#btn-next:hover,
.navigation-buttons button#btn-submit:hover {
  background-color: rgba(50, 200, 200, 1);
}

/* Ocultar botones no usados al inicio */
#btn-prev,
#btn-submit {
  display: none;
}

/* --- Link "Inicia Sesión" en Registro --- */
.registro-login-link {
  width: 100%;
  margin-top: 1.25rem; /* 20px */
  color: rgba(2, 7, 63, 1);
  font-size: 0.875rem; /* 14px */
  text-align: center;
}

.registro-login-link a.enlace {
  color: rgba(2, 7, 63, 1);
  font-weight: bold;
  text-decoration: none;
}

/* ==============================================
   ELEMENTOS DE ESCRITORIO (Imágenes, etc.)
   ============================================== */
.image-section {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 0 0 50vw;
  height: 90vh;
  margin-top: auto;
  margin-bottom: 0;
}

.doctor-image {
  position: fixed;
  bottom: 0;
  z-index: 10;
  width: auto;
  max-height: 95vh;
  margin: 0;
  margin-left: 4vw;
  object-fit: contain;
}

.geometric-image {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
  width: 30vw;
  height: auto;
  pointer-events: none;
}

.geometric-image img {
  position: absolute;
  right: 0;
  left: auto;
  width: 27vh;
  height: 27vh;
  margin: 0;
  object-fit: cover;
}
.geometric-image img:nth-child(1) {
  bottom: 0;
  z-index: 3;
}
.geometric-image img:nth-child(2) {
  bottom: 0;
  z-index: 2;
}
.geometric-image img:nth-child(3) {
  bottom: 27vh;
  z-index: 3;
}
.geometric-image img:nth-child(4) {
  bottom: 27vh;
  z-index: 2;
}
.geometric-image img:nth-child(5) {
  bottom: 54vh;
  z-index: 3;
}

.conteiner_praxis {
  position: absolute;
  top: 70vh;
  left: 55vw;
  z-index: 20;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  width: 20vw;
  height: 10vh;
  padding: 0.3125rem 0.625rem; /* 5px 10px */
  background-color: rgba(255, 255, 255, 0.7);
  border: 0.125rem solid rgba(2, 7, 63, 1); /* 2px */
  border-radius: 0.625rem; /* 10px */
  box-shadow: 0 0.25rem 0.625rem 0 rgba(0, 0, 0, 0.1);
  transform: translate(-50%, -50%);
}

.conteiner_praxis img {
  width: 10vh;
  height: 10vh;
  margin-right: 2.5vw;
}

.text_praxis {
  display: block;
  color: rgba(2, 7, 63, 1);
  font-size: 1.125rem; /* 18px */
  font-weight: 500;
}

/* ==============================================
   ESTILOS PARA MODAL DE TÉRMINOS
   ============================================== */
#modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  display: none;
  width: 100%;
  height: 100%;
  background-color: rgba(2, 7, 63, 0.7);
  opacity: 0;
  pointer-events: none;
  animation: fadeIn 0.3s forwards;
  overflow-y: auto;
  padding-top: 2rem;
  padding-bottom: 2rem;
}

#modal-overlay.show {
  display: flex !important;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  opacity: 1;
  pointer-events: auto;
}

#modal-content {
  position: relative;
  width: 90%;
  max-width: 43.75rem; /* 700px */
  padding: 1.875rem 2.5rem; /* 30px 40px */
  background-color: #ffffff;
  border-radius: 0.625rem; /* 10px */
  box-shadow: 0 0.3125rem 1.875rem rgba(0, 0, 0, 0.2);
  overflow-y: auto;
  max-height: calc(100vh - 4rem);
  animation: slideIn 0.3s 0.1s forwards;
  margin: auto;
}

.modal-close-btn {
  position: absolute;
  top: 0.625rem; /* 10px */
  right: 0.9375rem; /* 15px */
  color: #aaa;
  font-size: 2rem; /* 32px */
  font-weight: 300;
  line-height: 1;
  text-decoration: none;
  z-index: 10;
}

.modal-close-btn:hover,
.modal-close-btn:focus {
  color: #02073f;
}

/* --- Alertas para Login y Recuperar --- */
.alert {
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border-radius: 0.3125rem;
  font-size: 0.875rem;
  text-align: center;
  width: 100%;
}

.alert-success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert-danger {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.alert-info {
  background-color: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

.modal-close-btn:hover,
.modal-close-btn:focus {
  color: #02073f;
}

.modal-body h1,
#modal-content > h1 {
  margin-top: 0;
  margin-bottom: 1.25rem; /* 20px */
  padding-bottom: 0.625rem; /* 10px */
  color: #02073f;
  font-size: 2em;
  font-weight: 700;
  border-bottom: 0.125rem solid #43e9e8; /* 2px */
}

.modal-body h2 {
  margin-top: 1.875rem; /* 30px */
  margin-bottom: 0.625rem; /* 10px */
  color: #02073f;
  font-size: 1.5em;
  font-weight: 500;
}

.modal-body h3 {
  margin-top: 1.25rem; /* 20px */
  color: #333;
  font-size: 1.2em;
  font-weight: 500;
}

.modal-body p,
.modal-body li {
  margin-bottom: 0.9375rem; /* 15px */
  color: #333;
  font-family: "Poppins", Arial, sans-serif;
  font-size: 0.95em;
  font-weight: 300;
  line-height: 1.7;
}

.modal-body .intro {
  color: #555;
  font-size: 1em;
  font-weight: 400;
}

.modal-body ul,
.modal-body ol {
  padding-left: 1.5625rem; /* 25px */
}

.modal-body a {
  color: #43e9e8;
  font-weight: 500;
}

/* --- Animaciones Modal --- */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-1.25rem); /* -20px */
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Responsive Modal --- */
@media (max-width: 768px) {
  #modal-overlay {
    padding-top: 1rem;
    padding-bottom: 1rem;
  }

  #modal-content {
    width: 95%;
    max-height: calc(100vh - 2rem);
    padding: 1.5625rem 1.25rem; /* 25px 20px */
  }

  #modal-content > h1 {
    font-size: 1.5em;
  }
  .modal-body h2 {
    font-size: 1.3em;
  }
  .modal-body p,
  .modal-body li {
    font-size: 0.9em;
  }
}

/* ==============================================
   ESTILOS PARA SELECT2
   ============================================== */
.input-group .select2-container--default .select2-selection--single {
  display: flex;
  align-items: center;
  height: 6vh;
  width: 100%;
  padding: 0;
  background: rgba(255, 255, 255, 1);
  border: none;
  border-radius: 0.3125rem; /* 5px */
  box-shadow: 0 0.125rem 0.3125rem 0 rgba(0, 0, 0, 0.1);
}

.input-group
  .select2-container--default
  .select2-selection--single
  .select2-selection__rendered {
  padding-left: 0.625rem; /* 10px */
  color: #000;
  font-size: 0.875rem; /* 14px */
  line-height: normal;
}

.input-group
  .select2-container--default
  .select2-selection--single
  .select2-selection__placeholder {
  color: #6c757d;
}

.input-group
  .select2-container--default
  .select2-selection--single
  .select2-selection__arrow {
  position: absolute;
  top: 0;
  right: 0.3125rem; /* 5px */
  display: flex;
  align-items: center;
  height: 100%;
}

/* ==============================================
   BLOQUE RESPONSIVE CONSOLIDADO Y ARREGLADO
   ============================================== */

/* ----------------------------------------------
   Breakpoint General Tablet y Móvil (hasta 991px)
   ---------------------------------------------- */
@media (max-width: 991px) {
  body {
    overflow-y: auto;
    overflow-x: hidden;
  }

  .container {
    position: static;
    flex-direction: column;
    align-items: center;
    justify-self: center;
    width: 100%;
    max-width: 100%;
    height: auto;
    transform: none;
    padding: 0;
    margin: 0;
  }

  .titulo_login {
    position: static;
    width: 85%;
    margin: 3vh auto 2vh auto;
    font-size: clamp(1.25rem, 5vw, 1.875rem);
    word-wrap: break-word;
  }

  .desktop-only,
  .image-section,
  .geometric-image,
  .conteiner_praxis {
    display: none;
  }

  .login-section,
  .section-regitro {
    width: 90%;
    max-width: 100%;
    height: auto;
    margin: 0 auto 2vh auto;
    flex: 0 0 auto;
    padding-top: 2rem;
    padding-bottom: 2rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .input-group,
  .btn-ingreso,
  .btn-registro,
  .terminos-container,
  .extra-links,
  .section-regitro .input_container,
  .section-regitro .section1,
  .section-regitro .section2,
  .section-regitro .section3 {
    width: 100%;
    margin-left: 0;
  }

  .navigation-buttons {
    gap: 1rem;
  }

  @media (max-width: 504px) {
    body {
      overflow-y: auto;
      min-height: 100vh;
    }

    .container {
      position: static;
      flex-direction: column;
      align-items: center;
      max-width: 100%;
      height: auto;
      margin: 0;
      padding: 0;
      transform: none;
    }

    .titulo_login {
      margin-top: 2vh;
      font-size: 1.25rem;
      width: 90%;
    }

    .login-section,
    .section-regitro {
      width: 95%;
      padding: 1.5rem 1rem;
      margin-bottom: 1.5rem;
    }

    .logo-container,
    .section-regitro .logo-container {
      width: 60%;
      height: auto;
      margin-top: 0;
    }

    .input-group input,
    .btn-ingreso,
    .btn-registro {
      height: 5vh;
      font-size: 0.8125rem;
    }

    .input-group label {
      font-size: 0.8125rem;
    }

    .social-icons {
      gap: 1.5rem;
    }

    .social-icons a img {
      width: 2.5rem;
      height: 2.5rem;
      padding: 0.0625rem 0.625rem;
    }
  }

  @media (min-width: 505px) and (max-width: 768px) {
    .container {
      position: static;
      flex-direction: column;
      align-items: center;
      max-width: 100%;
      height: auto;
      transform: none;
    }

    .titulo_login {
      font-size: 1.5rem;
      margin: 2.5vh auto;
    }

    .login-section,
    .section-regitro {
      width: 85%;
      padding: 2rem 1.5rem;
    }

    .logo-container,
    .section-regitro .logo-container {
      width: 55%;
      height: auto;
      margin-top: 0;
    }

    .input-group input,
    .btn-ingreso,
    .btn-registro {
      height: 5.5vh;
    }
  }

  @media (min-width: 769px) {
    .titulo_login {
      font-size: 1.75rem;
    }

    .login-section,
    .section-regitro {
      width: 80%;
      padding: 2.5rem 2rem;
    }

    .logo-container,
    .section-regitro .logo-container {
      width: 50%;
      height: auto;
      margin-top: 0;
    }
  }
}