*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: 'Roboto', 'Segoe UI', sans-serif;
  user-select: none;
}

/*========= Fondo de pantalla completa ======*/
.login-page {
  position: relative;
  height: 100vh;
  width: 100vw;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #fff;
  overflow: hidden;
}

/* ====== Logo Grupo ESS, esquina superior izquierda ======= */
.brand-corner {
  position: absolute;
  top: 32px;
  left: 32px;
  display: flex;
  align-items: center;
  padding: 20px 30px;
  background-color: #fff;
  border: 1px solid rgba(9, 32, 63, 0.08);
  border-radius: 24px;
  box-shadow: 0 25px 60px rgba(9, 32, 63, 0.18), 0 0 0 1px rgba(255, 255, 255, 0.7) inset;
  backdrop-filter: blur(24px);
}

.brand-corner img {
  height: 80px;
  width: auto;
}

/*========= Tarjeta central de login ======*/
.login-card {
  position: relative;
  display: flex;
  flex-direction: row;
  width: 94%;
  max-width: 1080px;
  background-color: #fff;
  border: 1px solid rgba(9, 32, 63, 0.08);
  border-radius: 32px;
  box-shadow: 0 45px 110px rgba(9, 32, 63, 0.22), 0 0 0 1px rgba(255, 255, 255, 0.7) inset;
  backdrop-filter: blur(24px);
  overflow: hidden;
}

/* Orden visual: formulario a la izquierda, logo isupport a la derecha */
.login-card-form {
  order: 1;
}

.login-card-logo {
  order: 2;
}

/* ====== Recuadro del logo isupport (fondo azulado, igual al que tenía la pantalla) ======= */
.login-card-logo {
  flex: 1 1 50%;
  background-image: linear-gradient(135deg, #09203f 0%, #537895 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px;
}

.login-card-logo img {
  max-width: 460px;
  width: 100%;
  height: auto;
}

/* ====== Selector de idioma, flotando sobre el fondo blanco de la página ======= */
.lang-switcher {
  position: absolute;
  bottom: 32px;
  right: 32px;
}

.lang-bubble {
  position: relative;
  display: block;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 3px solid #fff;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(9, 32, 63, 0.3);
  transition: filter 0.2s ease, transform 0.2s ease;
}

/* El recorte circular va en la imagen, no en el botón: si fuera
   overflow:hidden en .lang-bubble, también recortaría el tooltip (::after). */
.lang-bubble img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.lang-bubble:hover {
  filter: brightness(1.2);
  transform: scale(1.06);
}

/* Tooltip con el nombre del idioma, solo en pantallas con hover real */
@media (hover: hover) {
  .lang-bubble::after {
    content: attr(data-label);
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    padding: 4px 10px;
    background-color: #09203f;
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    border-radius: 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .lang-bubble:hover::after {
    opacity: 1;
  }
}

/* Menú desplegable: en pc se abre hacia arriba, en columna */
.lang-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.lang-switcher.open .lang-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

/* ====== Recuadro del formulario ======= */
.login-card-form {
  flex: 1 1 50%;
  padding: 64px 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background-color: #fff;
}

/* Logo isupport sin fondo, solo visible en mobile (arriba del título) */
.login-logo-mobile {
  display: none;
  width: 100%;
  max-width: 220px;
  height: auto;
  margin: 0 auto 20px;
}

.login-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 8px;
}

.login-title-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  object-fit: cover;
}

.login-title {
  margin: 0;
  font-size: 34px;
  font-weight: 700;
  color: #09203f;
  text-align: center;
}

.login-subtitle {
  margin: 0 0 28px;
  font-size: 14px;
  color: #537895;
  text-align: center;
}

.field {
  display: flex;
  flex-direction: column;
  margin-bottom: 22px;
}

.field label {
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #09203f;
}

.field input {
  box-sizing: border-box;
  width: 100%;
  padding: 13px 4px;
  font-family: inherit;
  font-size: 18px;
  color: #09203f;
  background-color: transparent;
  border: none;
  border-bottom: 2px solid #09203f;
  user-select: text;
}

.field input:focus {
  outline: none;
  border-bottom-color: #009aff;
}

.btn-login {
  display: block;
  margin: 12px auto 0;
  width: auto;
  padding: 16px 52px;
  font-family: inherit;
  border: none;
  border-radius: 10px;
  background-color: #09203f;
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.btn-login:hover {
  background-color: #009aff;
}

.btn-login:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.login-error {
  margin-top: 14px;
  text-align: center;
  color: red;
  font-size: 12px;
  font-weight: 600;
}

.login-disabled {
  text-align: center;
  color: #09203f;
  font-size: 14px;
}

/*============= Adaptación a diferentes dispositivos ========= */
@media (max-width: 965px) {
  .login-page {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    padding: 16px;
    overflow: auto;
  }

  .brand-corner {
    position: static;
    margin-bottom: 16px;
  }

  .login-card {
    flex-direction: column;
    width: 100%;
  }

  /* En mobile el panel con degradado se quita; el logo pasa a un
     contenedor propio, sin fondo, arriba del título. */
  .login-card-logo {
    display: none;
  }

  .login-logo-mobile {
    display: block;
  }

  .login-card-form {
    padding: 32px 24px;
  }

  /* El selector de idioma pasa a flotar sobre la tarjeta (ya no tiene
     el panel azul como referencia) y el menú se abre a la izquierda,
     en fila, como puntos pequeños. */
  .lang-switcher {
    position: absolute;
    bottom: 16px;
    right: 16px;
  }

  .lang-bubble {
    width: 44px;
    height: 44px;
  }

  .lang-menu {
    bottom: 0;
    right: calc(100% + 10px);
    flex-direction: row;
    transform: translateX(10px);
  }

  .lang-switcher.open .lang-menu {
    transform: translateX(0);
  }

  .lang-menu .lang-bubble {
    width: 38px;
    height: 38px;
  }
}
