:root {
  --login-navy: #173d6a;
  --login-ink: #1c3859;
  --login-blue: #3773b7;
  --login-teal: #1e9e77;
  --login-mint: #41dca9;
  --login-ice: #f5fbff;
  --login-line: #c6d9ea;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: #eaf4fb;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
    "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans",
    "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.login-page,
.login-page *,
.login-page *::before,
.login-page *::after {
  box-sizing: border-box;
}

.login-page {
  position: relative;
  width: 100%;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  background: #eaf4fb url("../Imagenes/olan-login/background-login.png")
    center / cover no-repeat;
  color: var(--login-ink);
}

.login-page img {
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  pointer-events: none;
}

/* ---------- Escena decorativa ---------- */

.login-scene {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.login-scene > * {
  position: absolute;
}

.scene-halo {
  border-radius: 50%;
  filter: blur(5px);
}

.scene-halo-a {
  top: 5%;
  right: 9%;
  width: 360px;
  height: 360px;
  background: radial-gradient(
    circle,
    rgba(126, 214, 255, 0.5),
    rgba(126, 214, 255, 0) 70%
  );
}

.scene-halo-b {
  right: -8%;
  bottom: -16%;
  width: 520px;
  height: 420px;
  background: radial-gradient(
    ellipse,
    rgba(112, 132, 240, 0.34),
    rgba(112, 132, 240, 0) 70%
  );
}

.scene-holo {
  top: 4%;
  left: 44%;
  width: 55%;
  height: 60%;
  opacity: 0.55;
  filter: drop-shadow(0 0 4px rgba(84, 220, 255, 0.9));
}

.scene-quote,
.scene-tagline,
.scene-globe-label {
  margin: 0;
  font-family: "Segoe Print", "Comic Sans MS", cursive;
  font-weight: 600;
  line-height: 1.3;
  color: var(--login-blue);
  text-shadow:
    0 0 6px rgba(255, 255, 255, 0.95),
    0 0 14px rgba(255, 255, 255, 0.8);
}

.scene-quote span,
.scene-tagline span,
.scene-globe-label span {
  display: block;
}

.scene-quote::after {
  content: "";
  display: block;
  height: 3px;
  margin-top: 8px;
  border-radius: 3px;
}

.scene-quote-left {
  top: 14%;
  left: 4.5%;
  font-size: clamp(18px, 1.6vw, 27px);
  transform: rotate(-3deg);
}

.scene-quote-left span:nth-child(even),
.scene-tagline span:last-child {
  color: var(--login-teal);
}

.scene-quote-left::after {
  width: 85px;
  background: var(--login-teal);
}

.scene-quote-right {
  top: 4.2%;
  right: 4.1%;
  font-size: clamp(16px, 1.4vw, 24px);
  text-align: center;
}

.scene-quote-right::after {
  width: 58px;
  margin-left: auto;
  margin-right: auto;
  background: var(--login-blue);
}

.scene-tagline {
  left: 3.6%;
  bottom: 10%;
  font-size: clamp(14px, 1.2vw, 21px);
}

.scene-float {
  --r: 0deg;
  height: auto;
  transform: rotate(var(--r));
  animation: login-float 5.5s ease-in-out infinite;
}

.scene-card {
  filter: drop-shadow(0 17px 22px rgba(18, 54, 89, 0.2));
}

.scene-card-math {
  --r: -7deg;
  top: 9%;
  left: 50%;
  width: 300px;
  animation-delay: 0s;
}

.scene-cap {
  --r: -8deg;
  top: 10%;
  left: 73.5%;
  width: clamp(300px, 22vw, 400px);
  filter: drop-shadow(0 26px 23px rgba(20, 51, 92, 0.28));
  animation-delay: 0.3s;
}

.scene-card-science {
  --r: 7deg;
  top: 9%;
  right: 4%;
  width: 280px;
  animation-delay: 0.6s;
}

.scene-book {
  --r: -8deg;
  top: 30%;
  left: 46.5%;
  width: 210px;
  filter: drop-shadow(0 18px 22px rgba(36, 92, 156, 0.26));
  animation-delay: 0.9s;
}

.scene-card-creative {
  --r: -4deg;
  top: 30%;
  right: 4%;
  width: 280px;
  animation-delay: 1.2s;
}

.scene-globe {
  top: 52%;
  right: 9%;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(84, 220, 255, 0.9);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  box-shadow: 0 0 18px rgba(84, 220, 255, 0.45);
  color: #3fb8e6;
  animation-delay: 1.5s;
}

.scene-globe svg {
  width: 44px;
  height: 44px;
}

.scene-globe-label {
  top: 62%;
  right: 2%;
  width: calc(14% + 80px);
  font-size: 13px;
  text-align: center;
  color: var(--login-navy);
}

@keyframes login-float {
  0%,
  100% {
    transform: translateY(0) rotate(var(--r));
  }
  50% {
    transform: translateY(-14px) rotate(var(--r));
  }
}

/* ---------- Panel y tarjeta ---------- */

.login-panel-form {
  position: relative;
  z-index: 10;
  display: flex;
  width: clamp(440px, 29.5vw, 500px);
  min-height: clamp(740px, 83.75vh, 788px);
  margin: clamp(34px, 6.8vh, 64px) 0 clamp(34px, 6.8vh, 64px)
    clamp(220px, 17vw, 290px);
}

.card-login {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  width: 100%;
  padding: 62px 48px 34px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 39px;
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.76),
    rgba(239, 249, 255, 0.62)
  );
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  box-shadow:
    0 24px 55px rgba(30, 76, 111, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
  animation: login-card-in 0.5s ease-out backwards;
}

.login-rise {
  animation: login-rise 0.35s ease-out backwards;
  animation-delay: calc(0.12s + var(--i, 0) * 0.12s);
}

@keyframes login-card-in {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }
}

@keyframes login-rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

.login-logo {
  display: block;
  width: min(280px, 76%);
  height: auto;
  margin: 0 auto 35px;
  filter: drop-shadow(0 8px 14px rgba(55, 115, 183, 0.18));
}

.login-institution {
  display: block;
  margin: -17px 0 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.35;
  text-align: center;
  text-transform: uppercase;
  color: var(--login-blue);
}

.login-institution:empty {
  display: none;
}

.login-title {
  margin: 0;
  font-size: clamp(28px, 2.2vw, 32px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  text-align: center;
  color: var(--login-navy);
}

.login-title span {
  background: linear-gradient(90deg, #33cc99, #1e9e77);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--login-teal);
}

.login-subtitle {
  margin: 7px 0 40px;
  font-size: 14px;
  text-align: center;
  color: #627991;
}

.login-form {
  display: flex;
  flex: 1;
  flex-direction: column;
  margin: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Campos ---------- */

.login-field {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 58px;
  padding: 0 15px;
  border: 1px solid rgba(160, 196, 226, 0.7);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.63);
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.8),
    0 4px 12px rgba(40, 90, 140, 0.06);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.login-field + .login-field {
  margin-top: 14px;
}

.login-field:focus-within {
  border-color: var(--login-teal);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 4px rgba(30, 158, 119, 0.16);
}

.login-field.has-error {
  border-color: #d10155;
  box-shadow: 0 0 0 4px rgba(209, 1, 85, 0.12);
}

.login-field-icon {
  display: flex;
  flex: 0 0 28px;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(76, 141, 191, 0.12);
  color: #4c8dbf;
}

.login-field-icon svg {
  width: 17px;
  height: 17px;
}

.login-field input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 14px;
  color: #1e2a38;
}

.login-field input::placeholder {
  color: #8194aa;
  opacity: 1;
}

.password-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #6f8aa6;
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.password-toggle:hover,
.password-toggle:focus-visible {
  outline: none;
  background: rgba(30, 158, 119, 0.12);
  color: var(--login-teal);
}

.password-toggle svg {
  width: 18px;
  height: 18px;
}

.password-toggle .icon-hide,
.password-toggle.is-visible .icon-show {
  display: none;
}

.password-toggle.is-visible .icon-hide {
  display: block;
}

.login-msg {
  display: block;
  margin-top: 6px;
  padding-left: 20px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b01355' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='8' x2='12' y2='12'/%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'/%3E%3C/svg%3E")
    left 1px / 14px 14px no-repeat;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  color: #b01355;
}

.login-msg:empty {
  display: none;
}

.login-msg-success {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2317795c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolyline points='8 12 11 15 16 9'/%3E%3C/svg%3E");
  color: #17795c;
}

/* ---------- Recordarme y recuperacion ---------- */

.login-options {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 24px;
  margin-top: 18px;
}

.login-remember {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  font-weight: 600;
  color: var(--login-ink);
  cursor: pointer;
}

.login-remember input {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1.5px solid #9fbcd6;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.8) center / 12px 12px no-repeat;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.login-remember input:checked {
  border-color: var(--login-teal);
  background-color: var(--login-teal);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
}

.login-remember input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(30, 158, 119, 0.16);
}

.login-forgot {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  text-decoration: underline;
  color: var(--login-blue);
  transition: color 0.2s ease;
}

.login-forgot:hover,
.login-forgot:focus-visible {
  color: var(--login-teal);
}

.login-captcha {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

/* ---------- Boton primario ---------- */

.login-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 54px;
  margin-top: 26px;
  padding: 13px 30px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(90deg, #42dca9, #1e9e77);
  box-shadow:
    0 10px 22px rgba(30, 158, 119, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  transition:
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.login-submit svg {
  width: 16px;
  height: 16px;
}

.login-submit:hover {
  box-shadow:
    0 14px 28px rgba(30, 158, 119, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transform: scale(1.03);
}

.login-submit:active {
  transform: scale(0.97);
}

.login-submit:focus-visible {
  outline: 2px solid var(--login-navy);
  outline-offset: 3px;
}

.login-submit:disabled {
  opacity: 0.72;
  cursor: not-allowed;
  transform: none;
}

/* ---------- Aviso de seguridad y pie ---------- */

.login-secure {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: auto;
  padding: 10px 13px;
  border: 1px solid rgba(30, 158, 119, 0.22);
  border-radius: 12px;
  background: rgba(65, 220, 169, 0.1);
  font-size: 11px;
  color: #3f6f62;
}

.login-secure svg {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  color: var(--login-teal);
}

.login-form-end {
  height: 22px;
}

.login-footer {
  position: absolute;
  right: 18px;
  bottom: 12px;
  z-index: 10;
  font-size: 10px;
  line-height: 1.5;
  padding: 6px 11px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.66);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  text-align: right;
  color: var(--login-navy);
}

.login-footer a {
  font-weight: 700;
  color: inherit;
  transition: color 0.2s ease;
}

.login-footer a:hover,
.login-footer a:focus-visible {
  color: var(--login-teal);
}

body.page-transitioning-left .login-panel-form {
  animation: pageExitToLeft 0.16s ease-out forwards;
}

body.page-transitioning-right .login-panel-form {
  animation: pageExitToRight 0.16s ease-out forwards;
}

@keyframes pageExitToLeft {
  to {
    opacity: 0;
    transform: translateX(-32px);
  }
}

@keyframes pageExitToRight {
  to {
    opacity: 0;
    transform: translateX(32px);
  }
}

/* ---------- Recuperar contrasena ---------- */

.login-label {
  display: block;
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--login-ink);
}

.login-segment {
  position: relative;
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.login-segment input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.login-segment label {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  height: 44px;
  border: 1px solid rgba(160, 196, 226, 0.7);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.63);
  font-size: 13px;
  font-weight: 700;
  color: #4c6a8a;
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease,
    color 0.2s ease;
}

.login-segment label:hover {
  border-color: var(--login-teal);
}

.login-segment input:checked + label {
  border-color: var(--login-teal);
  background: rgba(65, 220, 169, 0.16);
  color: #17795c;
}

.login-segment input:focus-visible + label {
  box-shadow: 0 0 0 4px rgba(30, 158, 119, 0.16);
}

.login-back {
  margin: 16px 0 0;
  font-size: 12px;
  text-align: center;
  color: #627991;
}

.login-back a {
  font-weight: 700;
  text-decoration: underline;
  color: var(--login-blue);
  transition: color 0.2s ease;
}

.login-back a:hover,
.login-back a:focus-visible {
  color: var(--login-teal);
}

/* ---------- Pantallas de poca altura (portatiles) ---------- */

@media (min-width: 993px) and (max-height: 860px) {
  .login-panel-form {
    min-height: calc(100vh - 28px);
    min-height: calc(100dvh - 28px);
    margin-top: 14px;
    margin-bottom: 14px;
  }

  .card-login {
    padding: 28px 44px 20px;
    border-radius: 32px;
  }

  .login-logo {
    width: min(200px, 60%);
    margin-bottom: 16px;
  }

  .login-institution {
    margin: -6px 0 8px;
  }

  .login-title {
    font-size: 28px;
  }

  .login-subtitle {
    margin: 5px 0 18px;
  }

  .login-options,
  .login-captcha {
    margin-top: 14px;
  }

  .login-submit {
    margin-top: 18px;
  }

  .login-form-end {
    height: 14px;
  }
}

@media (min-width: 993px) and (max-height: 720px) {
  .login-secure,
  .login-form-end {
    display: none;
  }
}

/* ---------- Adaptacion por ancho ---------- */

@media (max-width: 1200px) {
  .login-panel-form {
    margin-left: clamp(150px, 8vw, 180px);
  }

  .scene-cap {
    left: auto;
    right: 2%;
    width: 290px;
  }
}

@media (max-width: 992px) {
  .login-page {
    overflow-y: auto;
    background-position: 66% center;
  }

  .login-scene {
    opacity: 0.52;
  }

  .scene-card,
  .scene-quote,
  .scene-tagline,
  .scene-book,
  .scene-globe,
  .scene-globe-label,
  .scene-holo {
    display: none;
  }

  .scene-cap {
    top: 5%;
    left: 82%;
    right: auto;
    width: 280px;
    opacity: 0.48;
  }

  .login-panel-form {
    width: min(546px, calc(100% - 48px));
    min-height: calc(100vh - 114px);
    min-height: calc(100dvh - 114px);
    margin: 24px auto 12px;
  }

  .login-footer {
    position: relative;
    right: auto;
    bottom: auto;
    width: -moz-fit-content;
    width: fit-content;
    margin: 0 auto 16px;
    text-align: center;
  }
}

@media (max-width: 560px) {
  .login-page {
    background-position: 74% center;
  }

  .login-scene {
    opacity: 0.25;
  }

  .scene-cap {
    display: none;
  }

  .login-panel-form {
    width: calc(100% - 28px);
    min-height: 0;
    margin: 14px auto 12px;
  }

  .card-login {
    padding: 43px 24px 25px;
    overflow: visible;
    border-radius: 28px;
  }

  .login-logo {
    width: min(245px, 84%);
    margin-bottom: 20px;
  }

  .login-institution {
    margin: -8px 0 10px;
  }

  .login-title {
    font-size: 27px;
  }

  .login-subtitle {
    margin-bottom: 16px;
    font-size: 13px;
  }

  .login-options {
    flex-wrap: wrap;
  }

  .login-forgot {
    flex-basis: 100%;
    margin-left: 27px;
  }

  .login-submit {
    margin-top: 25px;
  }

  .login-footer {
    margin-bottom: 14px;
  }
}

/* El widget del captcha mide 304 px: se escala cuando la tarjeta es mas angosta */
@media (max-width: 380px) {
  .login-captcha > div {
    transform: scale(0.92);
  }
}

@media (max-width: 359px) {
  .login-captcha > div {
    transform: scale(0.8);
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-page *,
  .login-page *::before,
  .login-page *::after {
    animation: none !important;
    transition: none !important;
  }
}
