/**
 * Login del panel superadmin — layout de panel dividido (Opción A).
 * Izquierda: panel de marca grafito con claim y tarjeta de sellos ilustrativa.
 * Derecha: formulario sobre superficie blanca.
 * Identidad sobria de la plataforma Ludito: grafito + acento ámbar discreto.
 */

:root {
  --ink-900: #0e1014;
  --ink-800: #14171d;
  --ink-700: #1c2029;
  --ink-600: #2a2f3a;
  --text-primary: #14171d;
  --text-secondary: #5a6070;
  --text-tertiary: #9aa0ad;
  --surface: #ffffff;
  --border-soft: #e3e6eb;
  --border-input: #cfd4dc;
  --accent: #f2b90d;
  --accent-deep: #b98700;
  --error: #d1354a;
  --font-display: 'Sora', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Instrument Sans', 'Segoe UI', system-ui, sans-serif;
  --focus-ring: 0 0 0 3px rgba(242, 185, 13, 0.35);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
  display: flex;
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--surface);
}

/* ============ Panel de marca (izquierda) ============ */

.brand-panel {
  flex: 0 0 min(46vw, 640px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  padding: 52px 56px 44px;
  background-color: var(--ink-900);
  background-image:
    radial-gradient(ellipse 640px 420px at 20% -8%, rgba(242, 185, 13, 0.10), transparent 62%),
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: auto, 44px 44px, 44px 44px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-row .logo-tile {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: var(--accent);
  border-radius: 9px;
}

.brand-row .logo-tile svg {
  width: 20px;
  height: 20px;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.06rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.92);
}

.brand-tag {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.6);
  border-left: 1px solid rgba(255, 255, 255, 0.18);
  padding-left: 11px;
}

/* Claim + tarjeta demo */

.brand-hero {
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.brand-hero h2 {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 2.4vw, 2.125rem);
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.brand-hero > p {
  font-size: 1rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.65);
}

.demo-card {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px 24px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
}

.demo-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.demo-client {
  display: flex;
  align-items: center;
  gap: 12px;
}

.demo-avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(242, 185, 13, 0.16);
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 0.94rem;
  font-weight: 700;
}

.demo-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.demo-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

.demo-sub {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.55);
}

.demo-count {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.demo-stamps {
  display: flex;
  gap: 8px;
}

.demo-stamps .stamp {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px dashed rgba(255, 255, 255, 0.25);
}

.demo-stamps .stamp.is-filled {
  display: grid;
  place-items: center;
  border: 0;
  background: var(--accent);
}

.demo-stamps .stamp svg {
  width: 14px;
  height: 14px;
}

.demo-prize {
  display: flex;
  align-items: center;
  gap: 7px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.demo-prize svg {
  flex: none;
  width: 15px;
  height: 15px;
}

.demo-prize span {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.7);
}

/* Pie del panel de marca */

.brand-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.55);
}

.secure-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.secure-note svg {
  width: 13px;
  height: 13px;
}

/* ============ Panel del formulario (derecha) ============ */

.form-panel {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 40px 24px;
}

.form-box {
  width: min(400px, 100%);
  display: flex;
  flex-direction: column;
}

.card-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  align-self: flex-start;
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-deep);
  background: rgba(242, 185, 13, 0.12);
  border: 1px solid rgba(242, 185, 13, 0.35);
  border-radius: 999px;
  padding: 5px 12px;
  margin-bottom: 20px;
}

.card-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.form-head {
  margin-bottom: 34px;
}

.form-head h1 {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.form-head p {
  font-size: 0.94rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

/* ============ Campos ============ */

.field {
  margin-bottom: 20px;
}

.field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

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

.input-wrap > .field-icon {
  position: absolute;
  left: 14px;
  width: 19px;
  height: 19px;
  color: var(--text-tertiary);
  pointer-events: none;
  transition: color 0.15s ease;
}

.input-wrap:focus-within > .field-icon {
  color: var(--accent-deep);
}

.input-wrap input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px 12px 44px;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-primary);
  background: #fbfbfc;
  border: 1.5px solid var(--border-input);
  border-radius: 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.input-wrap input::placeholder {
  color: #aab0bb;
}

.input-wrap input:focus {
  outline: none;
  background: #ffffff;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.input-wrap input.is-invalid {
  border-color: var(--error);
}

.input-wrap input.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(209, 53, 74, 0.18);
}

/* Toggle mostrar/ocultar contraseña */

.toggle-password {
  position: absolute;
  right: 5px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.toggle-password:hover {
  color: var(--text-primary);
  background: rgba(20, 23, 29, 0.06);
}

.toggle-password:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.toggle-password svg {
  width: 19px;
  height: 19px;
}

.toggle-password .icon-eye-off {
  display: none;
}

.toggle-password[aria-pressed='true'] .icon-eye {
  display: none;
}

.toggle-password[aria-pressed='true'] .icon-eye-off {
  display: block;
}

/* Errores */

.field-error {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--error);
}

.field-error svg {
  flex: none;
  width: 15px;
  height: 15px;
  margin-top: 2px;
}

/* ============ Botón principal ============ */

.btn-submit {
  position: relative;
  width: 100%;
  min-height: 50px;
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #ffffff;
  background: var(--ink-800);
  border: 1px solid var(--ink-800);
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.btn-submit:hover {
  background: var(--ink-700);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(242, 185, 13, 0.4);
  transform: translateY(-1px);
}

.btn-submit:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn-submit:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn-submit[disabled] {
  opacity: 0.75;
  cursor: not-allowed;
  transform: none;
}

.btn-submit .btn-arrow {
  width: 17px;
  height: 17px;
  transition: transform 0.2s ease;
}

.btn-submit:hover .btn-arrow {
  transform: translateX(3px);
}

.btn-submit .spinner {
  display: none;
  width: 17px;
  height: 17px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.btn-submit.is-loading .btn-arrow {
  display: none;
}

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

/* Nota de acceso */

.access-note {
  margin-top: 22px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* Sesión activa */

.session-active {
  text-align: center;
  padding-top: 4px;
}

.session-active .session-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  color: var(--accent-deep);
  background: rgba(242, 185, 13, 0.14);
  border: 1px solid rgba(242, 185, 13, 0.4);
  border-radius: 50%;
}

.session-active .session-icon svg {
  width: 24px;
  height: 24px;
}

.session-active h1 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.session-active p {
  font-size: 0.93rem;
  color: var(--text-secondary);
  margin-bottom: 22px;
}

.btn-submit.as-link {
  text-decoration: none;
}

/* Pie móvil (oculto en escritorio: el pie vive en el panel de marca) */

.mobile-foot {
  display: none;
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border-soft);
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* ============ Revelado escalonado ============ */

.brand-hero > *,
.form-box > * {
  animation: fade-up 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.brand-hero > *:nth-child(1) { animation-delay: 0.08s; }
.brand-hero > *:nth-child(2) { animation-delay: 0.14s; }
.brand-hero > *:nth-child(3) { animation-delay: 0.20s; }

.form-box > *:nth-child(1) { animation-delay: 0.10s; }
.form-box > *:nth-child(2) { animation-delay: 0.16s; }
.form-box > *:nth-child(3) { animation-delay: 0.22s; }
.form-box > *:nth-child(4) { animation-delay: 0.28s; }

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============ Responsive ============ */

@media (max-width: 960px) {
  body {
    flex-direction: column;
  }

  /* El panel de marca se reduce a una cabecera compacta */
  .brand-panel {
    flex: none;
    padding: 20px 24px;
  }

  .brand-hero,
  .brand-foot {
    display: none;
  }

  .form-panel {
    flex: 1;
    padding: 40px 24px;
    align-items: start;
  }

  .form-box {
    margin-top: 6vh;
  }

  .mobile-foot {
    display: flex;
  }
}

@media (max-width: 480px) {
  .brand-tag {
    display: none;
  }

  .form-box {
    margin-top: 3vh;
  }
}

/* ============ Accesibilidad: movimiento reducido ============ */

@media (prefers-reduced-motion: reduce) {
  .brand-hero > *,
  .form-box > * {
    animation: none;
  }

  .btn-submit,
  .input-wrap input,
  .toggle-password,
  .btn-submit .btn-arrow,
  .input-wrap > .field-icon {
    transition: none;
  }

  .btn-submit:hover {
    transform: none;
  }
}
