@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
}

body {
  font-family: 'Poppins', sans-serif;
  min-height: 100dvh;
  background-color: #f4f6f9;
}

.login-wrapper {
  display: flex;
  width: 100%;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* Desktop: split form + imagen */
.login-container {
  flex: 40%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  padding: clamp(16px, 3vw, 40px);
}

.login-panel {
  width: 100%;
  max-width: 350px;
  text-align: center;
}

.logo img {
  width: 100%;
  height: auto;
  max-width: 260px;
  margin: 0 auto 20px;
  display: block;
}

form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.floating-group {
  position: relative;
}

.floating-input {
  width: 100%;
  padding: 12px;
  border: 2px solid #ccc;
  border-radius: 6px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.3s ease-in-out;
  background: white;
}

.floating-label {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  font-size: 16px;
  color: #333;
  background: white;
  padding: 0 5px;
  transition: all 0.3s ease;
  pointer-events: none;
}

.floating-input:focus,
.floating-input:not(:placeholder-shown) {
  border-color: #0051ff;
}

.floating-input:focus + .floating-label,
.floating-input:not(:placeholder-shown) + .floating-label {
  transform: translateY(-38px) scale(0.9);
  background: white;
  color: #0051ff;
  padding: 0 5px;
}

/* ===== BOTÓN OJO integrado al input ===== */
.floating-group--password .floating-input {
  padding-right: 48px; /* espacio para el botón */
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  border-radius: 10px;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  color: inherit;
}

.password-toggle i {
  font-size: 20px;
  line-height: 1;
  color: #929292; /* color del ícono */
}

.password-toggle:focus,
.password-toggle:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

.password-toggle:hover i {
  color: #686666;
}

.password-toggle:active i {
  transform: scale(0.92);
}

.password-toggle .icon-eye--hide {
  display: none;
}

.password-toggle.is-on .icon-eye--show {
  display: none;
}
.password-toggle.is-on .icon-eye--hide {
  display: inline-block;
}

/* Botón login */
#login-button {
  width: 100%;
  background: #0066cc;
  color: white;
  padding: 12px;
  border: none;
  border-radius: 6px;
  font-size: 18px;
  cursor: pointer;
  transition: background 0.3s;
}

#login-button:disabled {
  background: #d3d3d3;
  cursor: not-allowed;
}

#login-button:hover:not(:disabled) {
  background: #004c99;
}

.forgot-password {
  display: block;
  margin-top: 10px;
  font-size: 14px;
  color: #0066cc;
  text-decoration: none;
}

.forgot-password:hover {
  text-decoration: underline;
}

/* Imagen desktop */
.image-container {
  flex: 60%;
  background: url('../img/egr-10.webp') no-repeat center center;
  background-size: cover;
  background-position: center;
  min-height: 100dvh;
}

.alert {
  opacity: 1;
  transition: opacity 0.5s ease-in-out;
}

.alert.fade-out {
  opacity: 0;
}

/* =========================
   RESPONSIVE (UX MEJOR)
   ========================= */

/* Tablet y abajo: SOLO formulario, ocultar imagen */
@media (max-width: 1024px) {
  .login-wrapper {
    flex-direction: column;
  }

  /* Ocultar imagen en dispositivos más pequeños */
  .image-container {
    display: none;
  }

  /* Login ocupa toda la pantalla */
  .login-container {
    flex: 1 1 auto;
    width: 100%;
    min-height: 100dvh;
    padding: 28px;
  }
}

/* Ajustes tablet */
@media (max-width: 768px) {
  .login-panel {
    max-width: 360px;
  }

  .floating-input {
    font-size: 14px;
    padding: 10px;
  }

  .floating-label {
    font-size: 14px;
  }

  #login-button {
    font-size: 16px;
    padding: 10px;
  }
}

/* Ajustes móvil */
@media (max-width: 480px) {
  .login-container {
    padding: 16px;
  }

  .login-panel {
    max-width: 320px;
  }

  .logo img {
    max-width: 220px;
    margin-bottom: 16px;
  }

  .floating-input {
    padding: 9px;
  }

  .floating-label {
    font-size: 13px;
  }

  #login-button {
    font-size: 14px;
  }
}
