@import url('https://fonts.googleapis.com/css2?family=Hind+Madurai:wght@400;500;600;700&family=Rubik:wght@500;600;700&display=swap');
@import url('./theme.css');
* { box-sizing: border-box; }

html, body {
  margin: 0;
  width: 100%;
  min-height: 100%;
}

body.auth-page {
  height: 100vh;
  overflow: hidden;
  font-family: var(--font-body);
  color: var(--text-main);
  background: #fff;
}

.auth-page-wrap {
  position: relative;
  min-height: 100vh;
  padding-bottom: var(--footer-height);
  overflow: hidden;
  background:
    radial-gradient(circle at 0% 22%, rgba(107,142,35,.12), transparent 28rem),
    linear-gradient(180deg,#FFFFFF 0%,#F7FBFF 100%);
}

/* Isotipo/transparencia: NO se deforma.
   Se controla por width y mantiene height:auto + object-fit:contain. */
.brand-watermark {
  position: absolute;
  left: -64px;
  bottom: calc(var(--footer-height) - 8px);
  width: clamp(450px, 51vw, 765px);
  height: auto;
  max-height: calc(100vh - var(--footer-height) - 80px);
  object-fit: contain;
  object-position: left bottom;
  opacity: .44;
  pointer-events: none;
  user-select: none;
  z-index: 1;
}

.auth-main {
  position: relative;
  z-index: 2;
  height: calc(100vh - var(--footer-height));
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 26px 24px 18px;
}

.brand-logo-main {
  display: block;
  width: min(50vw, 680px);
  max-width: 500px;
  min-width: 420px;
  height: auto;
  max-height: 205px;
  object-fit: contain;
  margin: 0 auto 10px;
}

.auth-title {
  margin: 0 0 14px;
  font-family: var(--font-title);
  font-size: clamp(18px, 1.5vw, 25px);
  line-height: 1.25;
  font-weight: 600;
  color: var(--brand-secondary);
  text-align: center;
}

/* Opciones subidas debajo del texto principal */
.login-links {
  margin: 0 0 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  font-size: 16px;
}

.login-links a {
  position: relative;
  color: #004DC9;
  text-decoration: none;
  font-weight: 600;
}

.login-links a + a::before {
  content: "";
  position: absolute;
  left: -13px;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 18px;
  background: #0F2A6C;
  opacity: .72;
}

.login-links a:hover { text-decoration: underline; }

/* Formulario 100px mas angosto que antes: 546px -> 446px */
.login-box {
  width: min(100%, 446px);
}

.alert {
  margin: 0 0 12px;
  padding: 11px 13px;
  border-radius: 10px;
  font-weight: 600;
  line-height: 1.35;
  font-size: 14px;
}

.alert-error {
  color: #B91C1C;
  background: #FEF2F2;
  border: 1px solid #FECACA;
}

.alert-success {
  color: #047857;
  background: #ECFDF5;
  border: 1px solid #BBF7D0;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  font-weight: 700;
  font-size: 15px;
  color: #111827;
}

.input-wrap {
  position: relative;
}

.input-icon,
.input-action {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: #62708D;
  pointer-events: none;
}

.input-icon { left: 20px; }
.input-action { right: 18px; }

.input-wrap input {
  width: 100%;
  height: 58px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 52px 0 64px;
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 500;
  color: var(--text-main);
  background: rgba(255, 255, 255, .94);
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.input-wrap input::placeholder {
  color: #8A92A6;
}

.input-wrap input:focus {
  border-color: var(--brand-primary-dark);
  box-shadow: 0 0 0 4px rgba(0, 128, 187, .12);
}

.btn-primary {
  width: 100%;
  height: 64px;
  margin-top: 8px;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font-title);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: .02em;
  color: #fff;
  background: linear-gradient(180deg, #082B86 0%, #001D6F 100%);
  box-shadow: 0 16px 28px rgba(0, 29, 111, .22);
  transition: transform .16s ease, filter .16s ease, box-shadow .16s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
  box-shadow: 0 18px 32px rgba(0, 29, 111, .27);
}

.btn-primary:active {
  transform: translateY(0);
}

.security-note {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 11px;
  margin: 18px auto 18px;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.35;
  text-align: center;
}

.security-note svg {
  flex: 0 0 auto;
  color: var(--brand-secondary);
}

.vigilado-wrap {
  text-align: center;
}

.vigilado-wrap img {
  width: min(430px, 64vw);
  height: auto;
  display: inline-block;
}

.secure-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--footer-height);
  z-index: 5;
  background: linear-gradient(90deg, #001B68 0%, #002579 55%, #001B68 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
  box-shadow: 0 -16px 38px rgba(0, 29, 111, .13);
}

.secure-footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-size: 15px;
  line-height: 1.25;
  text-align: center;
}

.secure-footer svg {
  flex: 0 0 auto;
}

/* Ajustes para pantallas bajas: mantiene todo en una pantalla */
@media (max-height: 780px) {
  .auth-main {
    padding-top: 14px;
  }

  .brand-logo-main {
    max-height: 120px;
    margin-bottom: 20px;
  }

  .auth-title {
    margin-bottom: 10px;
    font-size: 18px;
  }

  .login-links {
    margin-bottom: 12px;
    font-size: 15px;
  }

  .input-wrap input {
    height: 50px;
  }

  .btn-primary {
    height: 54px;
  }

  .security-note {
    margin: 12px auto 8px;
    font-size: 14px;
  }

  .vigilado-wrap img {
    width: 370px;
  }

  .brand-watermark {
    width: clamp(260px, 31vw, 430px);
  }
}

@media (max-width: 920px) {
  body.auth-page {
    overflow: auto;
  }

  .auth-page-wrap {
    min-height: 100vh;
    overflow: visible;
  }

  .auth-main {
    height: auto;
    min-height: calc(100vh - var(--footer-height));
    padding: 22px 18px 24px;
  }

  .brand-logo-main {
    width: min(86vw, 560px);
    min-width: 0;
  }

  .brand-watermark {
    width: clamp(240px, 55vw, 430px);
    opacity: .22;
    left: -90px;
  }

  .login-links {
    gap: 16px;
    font-size: 15px;
  }
}

@media (max-width: 520px) {
  :root {
    --footer-height: 78px;
  }

  .brand-logo-main {
    width: min(92vw, 420px);
  }

  .auth-title {
    font-size: 18px;
  }

  .login-box {
    width: 100%;
  }

  .input-wrap input {
    height: 54px;
    font-size: 16px;
  }

  .btn-primary {
    height: 56px;
    font-size: 17px;
  }

  .login-links {
    flex-direction: column;
    gap: 9px;
    margin-bottom: 16px;
  }

  .login-links a + a::before {
    display: none;
  }

  .security-note {
    font-size: 14px;
  }

  .brand-watermark {
    width: clamp(260px, 86vw, 420px);
    left: -135px;
    bottom: var(--footer-height);
  }

  .secure-footer-inner {
    font-size: 13px;
  }
}


/* Tema Las Americas: verde como acento */
.login-links a:hover {
  color: var(--green-dark);
}

.auth-form button,
.auth-submit,
button[type="submit"] {
  background: var(--gradient-primary);
}

.auth-form button:hover,
.auth-submit:hover,
button[type="submit"]:hover {
  box-shadow: 0 18px 34px rgba(85,107,31,.22);
}

.input-wrap:focus-within {
  border-color: var(--green-olive);
  box-shadow: 0 0 0 4px rgba(107,142,35,.14);
}

.auth-security svg,
.auth-security .security-icon {
  color: var(--green-dark);
}

.auth-footer {
  background: linear-gradient(90deg, var(--blue-dark) 0%, var(--green-dark) 55%, var(--blue-dark) 100%);
}


/* ===== Ajuste Fondo Las Americas ===== */

.auth-form button,
.auth-submit,
button[type="submit"] {
  background: var(--gradient-green) !important;
  color: #fff !important;
}

.auth-form button:hover,
.auth-submit:hover,
button[type="submit"]:hover {
  box-shadow: 0 18px 34px rgba(85,107,31,.28);
}

.auth-footer {
  background: var(--green-dark) !important;
}
