/* ==========================================================================
   Nexo — Tipografía (Inter, autohospedada)
   ========================================================================== */
/* Fuente variable (cubre los pesos 400-800 en un solo archivo) servida desde
   el propio proyecto en vez de Google Fonts: evita el "flash" de fuente de
   respaldo que dependía de la latencia real de red en cada navegación. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 800;
  font-display: optional;
  src: url("../fonts/inter-latin-variable.woff2") format("woff2");
}

/* ==========================================================================
   Nexo — Design tokens
   ========================================================================== */
:root {
  --color-bg-dark: #0b1220;
  --color-bg-dark-soft: #0f1830;

  --color-accent: #14b8a6;
  --color-accent-dark: #0d9488;
  --color-accent-soft: #123430;

  --color-white: #ffffff;
  --color-page-bg: #f3f6fa;
  --color-text-light: #e2e8f0;
  --color-text-muted-dark-bg: #94a3b8;

  --color-text-dark: #0f172a;
  --color-text-muted: #64748b;
  --color-border: #e2e8f0;
  --color-input-bg: #eef1f6;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;

  --color-panel-border: rgba(15, 23, 42, 0.06);
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 24px -14px rgba(15, 23, 42, 0.28);
  --shadow-card-hover: 0 4px 10px rgba(15, 23, 42, 0.06), 0 18px 32px -16px rgba(15, 23, 42, 0.34);

  --font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-family);
  color: var(--color-text-dark);
}

h1, h2, h3 {
  letter-spacing: -0.01em;
}

a {
  text-decoration: none;
}

/* ==========================================================================
   Auth layout
   ========================================================================== */
/* Tarjeta compacta centrada (estilo "Credential Center"), en vez del
   split-screen a pantalla completa de antes -- el fondo de la página queda
   claro con una textura de puntos sutil, y toda la acción vive dentro de
   una tarjeta con esquinas redondeadas y sombra. */
.auth-body {
  background: var(--color-page-bg);
}

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  /* Textura de puntos sutil en todo el fondo de la página (antes solo vivía
     detrás del formulario) -- ahora la tarjeta flota por encima de ella. */
  background: radial-gradient(rgba(20, 184, 166, 0.16) 1px, transparent 1.5px) 0 0 / 22px 22px,
    var(--color-page-bg);
}

.auth-layout {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  max-width: 940px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 24px 48px -16px rgba(15, 23, 42, 0.28), 0 2px 6px rgba(15, 23, 42, 0.08);
  background: var(--color-white);
}

/* ---- Panel izquierdo (marca) ---- */
.auth-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 40px;
  background: linear-gradient(160deg, var(--color-bg-dark) 0%, var(--color-bg-dark-soft) 100%);
}

/* Patrón de líneas finas muy sutil, confinado a este panel -- mismo
   lenguaje que la cuña decorativa de antes, pero discreto y sin romper el
   contraste del texto en blanco. */
.auth-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: linear-gradient(135deg, rgba(20, 184, 166, 0.1), transparent 55%);
  pointer-events: none;
}

/* Motivo geométrico más elaborado que un simple hatch: un hexágono y un
   rombo a contraluz, unidos por líneas finas tipo "red", en gris muy
   sutil con un toque de acento teal -- da textura sin competir con el
   texto blanco. */
.auth-brand::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 460 520' preserveAspectRatio='xMidYMid slice'%3E%3Cpath d='M0 312 L460 240' stroke='rgba(148,163,184,0.025)' stroke-width='1'/%3E%3Cpath d='M0 356 L460 284' stroke='rgba(148,163,184,0.02)' stroke-width='1'/%3E%3Cline x1='382' y1='172' x2='400' y2='384' stroke='rgba(148,163,184,0.045)' stroke-width='1'/%3E%3Cline x1='60' y1='420' x2='50' y2='118' stroke='rgba(148,163,184,0.045)' stroke-width='1'/%3E%3Cpolygon points='382,40 432,75 432,135 382,170 332,135 332,75' fill='none' stroke='rgba(148,163,184,0.065)' stroke-width='1.4'/%3E%3Cpolygon points='60,420 110,455 110,515 60,550 10,515 10,455' fill='none' stroke='rgba(20,184,166,0.09)' stroke-width='1.4'/%3E%3Ccircle cx='400' cy='430' r='46' fill='none' stroke='rgba(148,163,184,0.055)' stroke-width='1.4'/%3E%3Ccircle cx='50' cy='90' r='26' fill='none' stroke='rgba(20,184,166,0.07)' stroke-width='1.4'/%3E%3C/svg%3E");
  background-size: cover;
  background-position: center;
  pointer-events: none;
}

.auth-brand__inner {
  position: relative;
  z-index: 1;
}

/* Logo de Cybertec (la empresa detrás de Nexo), como sello discreto en la
   esquina inferior del panel — Nexo es el producto, así que lleva el
   protagonismo arriba. */
.auth-brand__company-logo {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 32px;
  width: 120px;
  height: auto;
  opacity: 0.85;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.brand-mark__logo {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  padding: 5px;
  border-radius: var(--radius-sm);
  background: var(--color-white);
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.brand-mark__logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-mark__text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.brand-mark__text strong {
  color: var(--color-white);
  font-size: 18px;
}

.brand-mark__text span {
  color: var(--color-text-muted-dark-bg);
  font-size: 13px;
}

.brand-headline {
  color: var(--color-white);
  font-size: 26px;
  line-height: 1.3;
  font-weight: 700;
  margin: 0 0 10px;
}

.text-accent {
  color: var(--color-accent);
}

.brand-subtext {
  color: var(--color-text-muted-dark-bg);
  font-size: 14px;
  line-height: 1.55;
  margin: 0 0 24px;
}

.brand-features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.brand-features li {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--color-white);
  font-size: 13px;
  font-weight: 600;
}

.brand-features__icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.12);
  color: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-features__icon svg {
  width: 14px;
  height: 14px;
}

/* ---- Panel derecho (formulario) ---- */
.auth-form-panel {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 40px;
  background: var(--color-white);
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 400px;
}

.auth-card .field-group label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.auth-card .btn-primary {
  box-shadow: 0 10px 22px -6px rgba(13, 148, 136, 0.45);
}

.auth-card__title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
}

.auth-card__subtitle {
  color: var(--color-text-muted);
  font-size: 14px;
  margin: 0 0 18px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--color-input-bg);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: border-color 0.15s ease;
}

.input-with-icon:focus-within {
  border-color: var(--color-accent);
}

.input-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

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

.input-with-icon input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  padding: 12px 12px 12px 0;
  font-size: 15px;
  font-family: inherit;
  color: var(--color-text-dark);
  min-width: 0;
}

.input-action {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.input-action svg {
  width: 18px;
  height: 18px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--color-text-dark);
  cursor: pointer;
  user-select: none;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-input-bg);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.checkbox-row:hover {
  background: var(--color-white);
  border-color: var(--color-accent);
}

.checkbox-row:has(input:checked) {
  background: rgba(20, 184, 166, 0.08);
  border-color: var(--color-accent);
}

.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--color-accent-dark);
  cursor: pointer;
}

.form-error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin: -8px 0 0;
}

.import-result-block {
  margin-top: 12px;
}

.import-result-block p {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-dark);
  margin: 0 0 6px;
}

.import-result-list {
  max-height: 180px;
  overflow-y: auto;
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--color-accent-dark);
  color: var(--color-white);
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}

.btn-primary:hover {
  background: #0b7d72;
}

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

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary:disabled:hover {
  background: var(--color-accent-dark);
}

.btn-primary svg {
  width: 18px;
  height: 18px;
}

/* ---- Spinner de "cargando" para botones (clase .is-loading, ver
   nexoBotonCargando() en app.js) ----
   Oculta la etiqueta/ícono y centra un spinner encima, sin tocar el
   contenido del botón (no hay que guardar/restaurar su texto original). Se
   define acá (style.css) porque se carga en todas las páginas, aunque las
   clases base .btn-secondary/.icon-btn-square vivan en cotizaciones.css. */
.btn-primary.is-loading,
.btn-secondary.is-loading,
.icon-btn-square.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn-primary.is-loading svg,
.btn-secondary.is-loading svg,
.icon-btn-square.is-loading svg {
  visibility: hidden;
}

.btn-primary.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid var(--color-white);
  border-top-color: transparent;
  border-radius: 50%;
  animation: nexo-spin 0.6s linear infinite;
}

.btn-secondary.is-loading::after,
.icon-btn-square.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid var(--color-text-dark);
  border-top-color: transparent;
  border-radius: 50%;
  animation: nexo-spin 0.6s linear infinite;
}

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


.auth-card__copyright {
  text-align: center;
  font-size: 11px;
  color: #94a3b8;
  margin: 14px 0 0;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 720px) {
  .auth-page {
    padding: 16px;
  }

  .auth-layout {
    grid-template-columns: minmax(0, 1fr);
    max-width: 440px;
  }

  .auth-brand {
    padding: 32px 28px;
  }

  .brand-subtext {
    margin-bottom: 20px;
  }

  .brand-features {
    display: none;
  }

  .auth-form-panel {
    padding: 32px 28px;
  }
}
