/* ===================================================
   RESET BÁSICO (SIN LIBRERÍAS)
   =================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

body {
  min-height: 100vh;
  background-color: #e9ecef; /* Color gris claro inferior */
  position: relative;
}

/* ===================================================
   FONDO DIVIDIDO
   =================================================== */
.top-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 50vh; /* Ocupa el 50% superior de la pantalla */
  background-color: #1a2f38; /* Color azul oscuro/gris */
  z-index: 1;
}

/* ===================================================
   ESTRUCTURA PRINCIPAL DE CENTRADO
   =================================================== */
.page-wrapper {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

/* ===================================================
   LOGO CENTRADO EN EL ESPACIO SUPERIOR
   Calcula la mitad exacta entre el borde top y el div
   =================================================== */
.logo-wrapper {
  position: absolute;
  top: calc((100vh - 440px) / 4); /* Ubica el logo en el punto medio del espacio superior */
  display: flex;
  justify-content: center;
  align-items: center;
}

.logo-container {
  text-align: center;
  color: #ffffff;
  letter-spacing: 2px;
}

.logo-text {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.logo-subtext {
  font-size: 0.75rem;
  font-weight: 400;
  display: block;
  margin-top: 4px;
  letter-spacing: 3px;
}

/* ===================================================
   TARJETA BLANCA DEL FORMULARIO
   =================================================== */
.login-card {
  background-color: #ffffff;
  width: 100%;
  max-width: 440px;
  padding: 40px 35px 30px 35px;
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  margin-top: 40px; /* Margen para asegurar separación con el logo */
}

.card-title {
  text-align: center;
  color: #1d2d35;
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 30px;
}

/* ===================================================
   INPUTS Y FORMULARIO
   =================================================== */
.login-form {
  display: flex;
  flex-direction: column;
}

.input-group {
  margin-bottom: 15px;
}

.input-group input {
  width: 100%;
  padding: 12px 15px;
  background-color: #e8f0fe; /* Fondo tenue azul */
  border: 1px solid #d0d7de;
  border-radius: 4px;
  font-size: 0.95rem;
  color: #333333;
  outline: none;
  transition: border-color 0.2s, background-color 0.2s;
}

.input-group input:focus {
  border-color: #0c4d4f;
  background-color: #ffffff;
}

.required-text {
  font-size: 0.8rem;
  color: #333333;
  margin-bottom: 18px;
}

/* ===================================================
   CHECKBOX: NO SOY UN ROBOT
   =================================================== */
.captcha-container {
  margin-bottom: 22px;
  background-color: #f9f9f9;
  padding: 12px 14px;
  border: 1px solid #d3d3d3;
  border-radius: 3px;
  display: flex;
  align-items: center;
}

.captcha-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 0.88rem;
  color: #333333;
  user-select: none;
}

.captcha-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-right: 10px;
  accent-color: #0c4d4f;
  cursor: pointer;
}

/* ===================================================
   BOTÓN DE ENVÍO
   =================================================== */
.btn-submit {
  width: 100%;
  padding: 12px;
  background-color: #0c4d4f; /* Verde oscuro */
  color: #ffffff;
  border: none;
  border-radius: 4px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
}

.btn-submit:hover {
  background-color: #08383a;
}

.btn-submit:active {
  transform: scale(0.99);
}

/* ===================================================
   MODAL DE ERROR / ACCESO DENEGADO
   =================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
  display: none;
  opacity: 0;
}

.modal-card {
  background-color: #ffffff;
  width: 90%;
  max-width: 460px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  text-align: center;
}

/* Cabecera superior verde oscuro */
.modal-header {
  background-color: #0c4d4f;
  padding: 35px 20px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.shield-icon {
  width: 52px;
  height: 52px;
  background-color: #ffffff;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.shield-icon svg {
  width: 30px;
  height: 30px;
  fill: #0c4d4f;
}

/* Cuerpo del Modal */
.modal-body {
  padding: 30px 35px 35px 35px;
}

.modal-title {
  color: #1a2a32;
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.modal-message {
  color: #6c757d;
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 25px;
}

.modal-message strong {
  color: #495057;
  font-weight: 700;
}

/* Botón opcional para cerrar el modal */
.btn-close-modal {
  background-color: #0c4d4f;
  color: #ffffff;
  border: none;
  padding: 10px 24px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-close-modal:hover {
  background-color: #08383a;
}

/* ===================================================
   MODAL DE CARGA (SPINNER)
   =================================================== */
.loading-card {
  padding: 40px 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.spinner {
  width: 45px;
  height: 45px;
  border: 4px solid #e9ecef;
  border-top: 4px solid #0c4d4f; /* Color verde oscuro corporativo */
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 20px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-text {
  color: #1a2a32;
  font-size: 1.1rem;
  font-weight: 600;
}

/* ===================================================
   FOOTER TARJETA
   =================================================== */
.card-footer {
  text-align: center;
  font-size: 0.75rem;
  color: #777777;
  margin-top: 25px;
}

/* ===================================================
   RESPONSIVIDAD EN PANTALLAS PEQUEÑAS
   =================================================== */
@media (max-width: 500px) {
  .logo-wrapper {
    position: relative;
    top: auto;
    margin-bottom: 20px;
  }

  .login-card {
    margin-top: 0;
    padding: 25px 20px 20px 20px;
  }
}