/* ============================================================================
   Login — AcuaMonitor v3 (observability)
   Reemplaza al login v1 azul saturado. El design system ya carga reset,
   tipografía, colores, status, btn, input, tabs. Aquí solo lo específico.
   ============================================================================ */


/* ─── Wrapper full screen ─── */

.lg-wrap {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0;
  isolation: isolate;
  background:
    radial-gradient(circle 800px at 20% 20%, rgba(74, 122, 150, 0.22) 0%, transparent 55%),
    radial-gradient(circle 600px at 85% 90%, rgba(94, 147, 176, 0.16) 0%, transparent 55%),
    radial-gradient(circle 500px at 75% 25%, rgba(123, 163, 189, 0.10) 0%, transparent 60%),
    var(--am-bg);
}

/* Grid técnico sutil de fondo */
.lg-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--am-border) 1px, transparent 1px),
    linear-gradient(90deg, var(--am-border) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity: 0.25;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
  pointer-events: none;
  z-index: 0;
}


/* ─── Paneles atmosféricos del fondo ─── */

/* ─── Columnas laterales con paneles ─── */

.lg-side {
  position: fixed;
  top: 24px;
  bottom: 24px;
  width: 220px;
  z-index: 1;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  gap: 14px;
  overflow: hidden;
}

/* Centrados en el hueco entre el borde del viewport y el card central.
   Fórmula: hueco lateral = (vw - 600px) / 2; centro del hueco = hueco / 2;
   left del panel = centro del hueco - mitad del panel (110px).
   Simplificado: left = (vw - 1040) / 4. max(24px, ...) garantiza margen mínimo. */
.lg-side--left  { left:  max(24px, calc((100vw - 1040px) / 4)); }
.lg-side--right { right: max(24px, calc((100vw - 1040px) / 4)); }

.lg-panel {
  flex-shrink: 0;
  background: rgba(19, 19, 24, 0.55);
  border: 1px solid var(--am-border);
  border-radius: var(--am-r-md);
  padding: var(--am-sp-5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: var(--am-text-muted);
  font-size: var(--am-fs-sm);
  opacity: 0.82;
}

.lg-panel__label {
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--am-text-soft);
  margin-bottom: 10px;
}

.lg-panel__val {
  font-family: var(--am-font-data);
  font-size: var(--am-fs-xl);
  color: var(--am-text);
  line-height: 1;
}

.lg-panel__val .unit {
  font-size: 0.5em;
  color: var(--am-text-soft);
  margin-left: 0.2em;
}

/* Markers del mini mapa con pulso */
.lg-mk circle {
  transform-origin: center;
  transform-box: fill-box;
  animation: lg-mkpulse 2.2s ease-out infinite;
}
.lg-mk--d1 circle { animation-delay: 0.35s; }
.lg-mk--d2 circle { animation-delay: 0.7s; }
.lg-mk--d3 circle { animation-delay: 1.05s; }
.lg-mk--d4 circle { animation-delay: 1.4s; }
.lg-mk--d5 circle { animation-delay: 1.75s; }
@keyframes lg-mkpulse {
  0%   { opacity: 0.5; transform: scale(1); }
  50%  { opacity: 1;   transform: scale(1.4); }
  100% { opacity: 0.5; transform: scale(1); }
}

/* Responsive */
@media (max-width: 1200px) {
  .lg-side { width: 180px; }
  /* Fórmula adaptada para ancho 180: left = (vw - 600 - 360) / 4 = (vw - 960) / 4 */
  .lg-side--left  { left:  max(24px, calc((100vw - 960px) / 4)); }
  .lg-side--right { right: max(24px, calc((100vw - 960px) / 4)); }
}
@media (max-width: 900px) {
  .lg-side { display: none; }
}

/* En viewports muy cortos, esconder un panel del medio */
@media (max-height: 640px) {
  .lg-side .lg-panel:nth-child(3) { display: none; }
}
@media (max-height: 500px) {
  .lg-side .lg-panel:nth-child(2) { display: none; }
}


/* ─── Card glass centrado ─── */

.lg-card {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 600px;
  flex-shrink: 0;
  padding: var(--am-sp-10) var(--am-sp-10);
  background: rgba(19, 19, 24, 0.78);
  border-left: 1px solid rgba(255, 255, 255, 0.09);
  border-right: 1px solid rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(28px) saturate(150%);
  -webkit-backdrop-filter: blur(28px) saturate(150%);
  box-shadow:
    0 0 0 1px rgba(74, 122, 150, 0.12),
    -16px 0 60px rgba(0, 0, 0, 0.55),
    16px 0 60px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--am-sp-6);
}

@media (max-width: 720px) {
  .lg-wrap {
    padding: 0;
    align-items: stretch;
  }
  .lg-card {
    max-width: 100%;
    padding: var(--am-sp-6) var(--am-sp-5);
  }
}

/* Brand + status — centrados arriba en columna */
.lg-card__head {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--am-sp-3);
  text-align: center;
}

.lg-card__brand {
  display: flex;
  align-items: center;
  gap: var(--am-sp-3);
  font-size: var(--am-fs-lg);
  font-weight: var(--am-fw-semibold);
  letter-spacing: -0.01em;
  color: var(--am-text);
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.lg-card__brand:hover {
  opacity: 0.75;
}

.lg-card__brand svg {
  width: 32px;
  height: 32px;
}

/* Hero / tagline */
.lg-card__hero {
  display: flex;
  flex-direction: column;
  gap: var(--am-sp-3);
}

.lg-tagline {
  font-size: var(--am-fs-xl);
  font-weight: var(--am-fw-medium);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.lg-tagline em {
  font-family: var(--am-font-ui);
  font-style: normal;
  background: linear-gradient(135deg, var(--am-mist) 0%, var(--am-accent-hi) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lg-sub {
  font-size: var(--am-fs-sm);
  color: var(--am-text-muted);
  line-height: 1.55;
}


/* ─── Co-branding del acueducto ─── */

.lg-tenant {
  display: flex;
  align-items: center;
  gap: var(--am-sp-4);
  padding: var(--am-sp-4);
  background: var(--am-surface);
  border: 1px solid var(--am-border);
  border-radius: var(--am-r-md);
}

.lg-tenant__logo {
  width: 48px;
  height: 48px;
  border-radius: var(--am-r-md);
  background: var(--am-surface-hi);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  overflow: hidden;
}

.lg-tenant__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lg-tenant__info {
  flex: 1;
  min-width: 0;
}

.lg-tenant__name {
  font-size: var(--am-fs-md);
  font-weight: var(--am-fw-medium);
  letter-spacing: -0.01em;
  color: var(--am-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lg-tenant__code {
  font-family: var(--am-font-data);
  font-size: var(--am-fs-xs);
  color: var(--am-text-soft);
  margin-top: 2px;
}


/* ─── Form fields ─── */

.lg-field {
  display: flex;
  flex-direction: column;
  gap: var(--am-sp-2);
  margin-bottom: var(--am-sp-3);
}

.lg-label {
  font-size: var(--am-fs-xs);
  font-weight: var(--am-fw-medium);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--am-text-soft);
}

.lg-hint {
  font-size: var(--am-fs-xs);
  color: var(--am-text-faint);
  margin-top: 4px;
}

/* Password input con toggle */
.lg-pass {
  position: relative;
}

.lg-pass .am-input {
  padding-right: 40px;
}

.lg-pass__toggle {
  position: absolute;
  right: var(--am-sp-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--am-text-soft);
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: color var(--am-trans-fast);
}

.lg-pass__toggle:hover { color: var(--am-text); }


/* ─── Botones full width ─── */

.lg-btn-full {
  width: 100%;
  margin-top: var(--am-sp-2);
}


/* ─── Spinner para botones (durante loading) ─── */

.lg-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: lg-spin 700ms linear infinite;
}

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


/* ─── Mensajes de error / éxito ─── */

.lg-error {
  padding: var(--am-sp-3) var(--am-sp-4);
  background: var(--am-err-soft);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--am-r-md);
  color: var(--am-err);
  font-size: var(--am-fs-sm);
  margin-bottom: var(--am-sp-3);
}

.lg-ok {
  padding: var(--am-sp-3) var(--am-sp-4);
  background: var(--am-ok-soft);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--am-r-md);
  color: var(--am-ok);
  font-size: var(--am-fs-sm);
  margin-bottom: var(--am-sp-3);
}


/* ─── Links discretos ─── */

.lg-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--am-text-muted);
  font-size: var(--am-fs-xs);
  font-family: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--am-border-hi);
  transition: color var(--am-trans-fast);
}

.lg-link:hover { color: var(--am-mist); }

.lg-link-row {
  text-align: center;
  margin-top: var(--am-sp-4);
}


/* ─── Footer del card ─── */

.lg-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--am-sp-4);
  font-size: var(--am-fs-xs);
  color: var(--am-text-faint);
  padding-top: var(--am-sp-3);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.lg-version {
  font-family: var(--am-font-data);
  color: var(--am-text-faint);
}
