@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  --rera-gold: #d4af37;
  --rera-bronze: #b8860b;
  --rera-bronze-dark: #8b6914;
  --login-bg: #0c1222;
  --login-bg-mid: #121b2e;
  --login-card-bg: rgba(18, 28, 48, 0.72);
  --login-border: rgba(212, 175, 55, 0.22);
  --login-text: #e8ecf4;
  --login-muted: #8b95a8;
  --login-input-bg: rgba(8, 12, 24, 0.55);
  --login-glow: rgba(212, 175, 55, 0.35);
  --radius: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

.login-body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* —— Fondo simple: gradiente + dos manchas difuminadas —— */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 1.5rem 1.25rem 2rem;
  gap: 1.25rem;
}

.login-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Patron relacionado a GPS/mapa */
.login-bg-pattern {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.45;
  background-size: 52px 52px, 52px 52px, 100% 100%;
  background-position: center;
}

.login-bg-network {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.net-line {
  position: absolute;
  height: 2px;
  border-radius: 999px;
  transform-origin: left center;
  opacity: 0.75;
}

.net-line--a {
  left: 14%;
  top: 62%;
  width: 34%;
  transform: rotate(-15deg);
}

.net-line--b {
  left: 42%;
  top: 57%;
  width: 30%;
  transform: rotate(12deg);
}

.net-line--c {
  left: 60%;
  top: 70%;
  width: 22%;
  transform: rotate(-28deg);
}

.net-node {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: netPulse 2.8s ease-in-out infinite;
}

.net-node--a { left: 14%; top: 62%; animation-delay: 0s; }
.net-node--b { left: 46%; top: 54%; animation-delay: 0.5s; }
.net-node--c { left: 72%; top: 64%; animation-delay: 1s; }
.net-node--d { left: 82%; top: 50%; animation-delay: 1.5s; }

@keyframes netPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.75; }
  50% { transform: translate(-50%, -50%) scale(1.25); opacity: 1; }
}

.login-bg-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
  opacity: 0.9;
}

.login-bg-blob--a {
  width: min(85vw, 480px);
  height: min(85vw, 480px);
  bottom: -12%;
  right: -10%;
}

.login-bg-blob--b {
  width: min(65vw, 360px);
  height: min(65vw, 360px);
  top: -8%;
  left: -12%;
}

/* Versión oscura */
.theme-dark.login-body {
  color: var(--login-text);
  background: linear-gradient(165deg, #151b24 0%, #0e1218 48%, #0a0d12 100%);
}

.theme-dark .login-bg {
  background: linear-gradient(165deg, #151b24 0%, #0e1218 50%, #0a0d12 100%);
}

.theme-dark .login-bg-pattern {
  background-image:
    linear-gradient(rgba(77, 148, 255, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(77, 148, 255, 0.09) 1px, transparent 1px),
    radial-gradient(circle at 75% 18%, rgba(88, 166, 255, 0.2), transparent 38%);
}

.theme-dark .net-line {
  background: linear-gradient(90deg, rgba(76, 154, 255, 0.1), rgba(90, 173, 255, 0.85), rgba(76, 154, 255, 0.1));
  box-shadow: 0 0 12px rgba(88, 166, 255, 0.45);
}

.theme-dark .net-node {
  background: #69b3ff;
  box-shadow: 0 0 0 3px rgba(105, 179, 255, 0.2), 0 0 16px rgba(105, 179, 255, 0.7);
}

.theme-dark .login-bg-blob--a {
  background: rgba(212, 175, 55, 0.16);
}

.theme-dark .login-bg-blob--b {
  background: rgba(70, 100, 150, 0.14);
}

/* Versión clara */
.theme-light.login-body {
  color: #1a2433;
  background: linear-gradient(180deg, #fafbfc 0%, #f0f3f8 55%, #e8ecf2 100%);
}

.theme-light .login-bg {
  background: linear-gradient(180deg, #fafbfc 0%, #f2f5f9 100%);
}

.theme-light .login-bg-pattern {
  opacity: 0.4;
  background-image:
    linear-gradient(rgba(184, 134, 11, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(184, 134, 11, 0.08) 1px, transparent 1px),
    radial-gradient(circle at 28% 10%, rgba(212, 175, 55, 0.18), transparent 42%);
}

.theme-light .net-line {
  background: linear-gradient(90deg, rgba(184, 134, 11, 0.08), rgba(184, 134, 11, 0.65), rgba(184, 134, 11, 0.08));
  box-shadow: 0 0 10px rgba(184, 134, 11, 0.24);
}

.theme-light .net-node {
  background: #b8860b;
  box-shadow: 0 0 0 3px rgba(184, 134, 11, 0.18), 0 0 14px rgba(184, 134, 11, 0.45);
}

.theme-light .login-bg-blob--a {
  background: rgba(212, 175, 55, 0.22);
}

.theme-light .login-bg-blob--b {
  background: rgba(120, 160, 210, 0.2);
}

/* Marca superior */
.login-brand {
  position: relative;
  z-index: 2;
  text-align: center;
  margin-bottom: 0.25rem;
}

.login-brand-inner {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
}

/* Icono cuadrado (marco dorado) alineado al texto, mismo peso visual que antes */
.login-brand-logo {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 16px;
  object-fit: contain;
  object-position: center;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 0 0 1px var(--login-border),
    0 0 0 6px rgba(245, 230, 168, 0.12);
}

.login-brand-fallback {
  display: none;
  width: 64px;
  height: 64px;
  border-radius: 16px;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  background: linear-gradient(145deg, var(--rera-gold), var(--rera-bronze));
  color: #0c1222;
  box-shadow: 0 8px 28px rgba(184, 134, 11, 0.45);
}

.login-brand-fallback.show { display: flex; }

.login-brand-text {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.login-brand-name {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, #f5e6a8 0%, var(--rera-gold) 45%, var(--rera-bronze) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-brand-tag {
  font-size: 0.78rem;
  color: var(--login-muted);
  font-weight: 500;
  max-width: 220px;
  line-height: 1.35;
}

/* Tarjeta glass */
.login-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 420px;
  padding: 2rem 2rem 1.5rem;
  border-radius: 20px;
  background: var(--login-card-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--login-border);
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.login-title {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--login-text);
  margin-bottom: 1.5rem;
  letter-spacing: -0.02em;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 1rem;
  z-index: 1;
  color: var(--login-muted);
  display: flex;
  align-items: center;
  pointer-events: none;
}

.input-icon svg {
  width: 20px;
  height: 20px;
}

.input-wrap input {
  width: 100%;
  padding: 0.95rem 1rem 0.95rem 3rem;
  background: var(--login-input-bg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--login-text);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.input-wrap input::placeholder {
  color: #5c6578;
}

.input-wrap input:focus {
  outline: none;
  border-color: rgba(212, 175, 55, 0.45);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.12);
  background: rgba(12, 18, 32, 0.75);
}

.input-password input {
  padding-right: 3rem;
}

.toggle-password {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0.35rem;
  cursor: pointer;
  color: var(--login-muted);
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
}

.toggle-password:hover {
  color: var(--rera-gold);
  background: rgba(255, 255, 255, 0.05);
}

.toggle-password svg {
  width: 20px;
  height: 20px;
  display: block;
}

.toggle-password .hidden {
  display: none !important;
}

/* Botón */
.btn-login {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.95rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  color: #0c1222;
  background: linear-gradient(135deg, #e8c84a 0%, var(--rera-gold) 35%, var(--rera-bronze) 100%);
  box-shadow: 0 6px 24px rgba(184, 134, 11, 0.4);
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
}

.btn-login:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 32px rgba(212, 175, 55, 0.45);
}

.btn-login:disabled {
  cursor: wait;
  opacity: 0.88;
}

.btn-login-arrow {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.btn-login-spinner {
  display: none;
  width: 22px;
  height: 22px;
  border: 2.5px solid rgba(12, 18, 34, 0.25);
  border-top-color: #0c1222;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn-login.is-loading .btn-login-text,
.btn-login.is-loading .btn-login-arrow {
  display: none;
}

.btn-login.is-loading .btn-login-spinner {
  display: block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.recover-link {
  display: block;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--rera-gold);
  text-decoration: none;
  margin-top: 0.15rem;
  opacity: 0.9;
  transition: opacity 0.2s;
}

.recover-link:hover {
  opacity: 1;
  text-decoration: underline;
}

/* Pie tarjeta */
.login-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.login-footer-left {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.footer-opt {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--login-muted);
  cursor: pointer;
  user-select: none;
}

.footer-opt input {
  width: 16px;
  height: 16px;
  accent-color: var(--rera-bronze);
  cursor: pointer;
}

.lang-select-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.lang-globe {
  color: var(--login-muted);
  display: flex;
}

.lang-globe svg {
  width: 18px;
  height: 18px;
}

.lang-select {
  padding: 0.45rem 2rem 0.45rem 0.65rem;
  background: var(--login-input-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--login-text);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23d4af37' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
}

.lang-select:focus {
  outline: none;
  border-color: rgba(212, 175, 55, 0.4);
}

.login-copy {
  position: relative;
  z-index: 2;
  font-size: 0.75rem;
  color: var(--login-muted);
  text-align: center;
  margin-top: 0.5rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* —— Versión clara: tarjeta e inputs —— */
.theme-light .login-brand-logo {
  box-shadow:
    0 6px 24px rgba(30, 55, 90, 0.1),
    0 0 0 1px rgba(184, 134, 11, 0.25),
    0 0 0 8px rgba(245, 230, 168, 0.18);
}

.theme-light .login-brand-name {
  background: linear-gradient(135deg, #6b5210 0%, var(--rera-bronze) 50%, var(--rera-bronze-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.theme-light .login-brand-tag {
  color: #5a6578;
}

.theme-light .login-card {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(184, 134, 11, 0.22);
  box-shadow: 0 16px 48px rgba(30, 55, 90, 0.08), 0 1px 0 rgba(255, 255, 255, 0.95) inset;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.theme-light .login-title {
  color: #1a2433;
}

.theme-light .input-wrap .input-icon {
  color: #6b7280;
}

.theme-light .input-wrap input {
  background: #f4f7fb;
  border-color: #d8e0ea;
  color: #1a2433;
}

.theme-light .input-wrap input::placeholder {
  color: #8b95a8;
}

.theme-light .input-wrap input:focus {
  border-color: rgba(184, 134, 11, 0.5);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
  background: #fff;
}

.theme-light .toggle-password {
  color: #6b7280;
}

.theme-light .toggle-password:hover {
  color: var(--rera-bronze-dark);
  background: rgba(184, 134, 11, 0.06);
}

.theme-light .btn-login-spinner {
  border-color: rgba(12, 18, 34, 0.12);
  border-top-color: #0c1222;
}

.theme-light .recover-link {
  color: var(--rera-bronze-dark);
}

.theme-light .login-footer {
  border-top-color: #e2e8f0;
}

.theme-light .footer-opt {
  color: #5a6578;
}

.theme-light .lang-globe {
  color: #6b7280;
}

.theme-light .lang-select {
  background: #f4f7fb;
  border-color: #d8e0ea;
  color: #1a2433;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b6914' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
}

.theme-light .login-copy {
  color: #6b7280;
}

@media (max-width: 520px) {
  .login-brand-inner {
    flex-direction: column;
    text-align: center;
  }
  .login-brand-text {
    text-align: center;
    align-items: center;
  }
  .login-card {
    padding: 1.5rem 1.35rem 1.25rem;
  }
  .login-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .lang-select-wrap {
    justify-content: flex-start;
  }
}

/* Vista móvil forzada desde checkbox "Versión móvil" (adaptar a celular) */
.login-body.view-mobile {
  min-height: 100dvh;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

.login-body.view-mobile .login-page {
  padding: 0.85rem max(0.65rem, env(safe-area-inset-left)) 1.25rem max(0.65rem, env(safe-area-inset-right));
  justify-content: flex-start;
  width: 100%;
  max-width: 100vw;
  min-height: 100dvh;
  min-height: 100vh;
  box-sizing: border-box;
}

.login-body.view-mobile .login-brand {
  margin-bottom: 0.85rem;
}

.login-body.view-mobile .login-card {
  width: 100%;
  max-width: min(400px, 100%);
  padding: 1.2rem 1rem 1rem;
  border-radius: 16px;
  box-sizing: border-box;
}

.login-body.view-mobile .login-title {
  font-size: 1.1rem;
  margin-bottom: 0.95rem;
}

.login-body.view-mobile .input-wrap input,
.login-body.view-mobile .btn-login {
  font-size: 16px;
  min-height: 48px;
  padding-top: 0.8rem;
  padding-bottom: 0.8rem;
}
