/**
 * wiclee-auth.css — Pantallas de acceso del portal: selector de tipo (hub) y formularios
 *   de propietario, proveedor y empleado.
 * Contexto: lo carga templates/login/index.twig junto a css/tokens.css, wiclee-components.css
 *   (botón .wiclee-btn) y wiclee-password-field.css. Sustituye a css/wiclee-login-portal.css y
 *   al bloque <style> + clases Tailwind que tenía el login heredado.
 * Notas de mantenimiento: solo tokens de css/tokens.css (sin hex ni estilos inline). Identidad
 *   única de marca (turquesa) en los tres accesos; lo que distingue cada portal es su icono y
 *   su texto. Diseñado para verse sin scroll en pantallas de 650 px de alto o más.
 */

html.wiclee-auth-root {
  min-height: 100%;
  background-color: var(--wiclee-bg-page);
}

.wiclee-auth {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  display: flex;
  flex-direction: column;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--wiclee-text);
  background:
    radial-gradient(60rem 32rem at 8% -12%, var(--wiclee-primary-100), transparent 62%),
    radial-gradient(48rem 28rem at 104% 108%, var(--wiclee-accent-100), transparent 58%),
    var(--wiclee-bg-page);
}

.wiclee-auth *,
.wiclee-auth *::before,
.wiclee-auth *::after {
  box-sizing: border-box;
}

/* Enlace de salto para teclado / lectores de pantalla */
.wiclee-auth__skip {
  position: absolute;
  left: var(--wiclee-space-md);
  top: -4rem;
  z-index: 10;
  padding: var(--wiclee-space-sm) var(--wiclee-space-md);
  border-radius: var(--wiclee-radius-md);
  background: var(--wiclee-bg-card);
  color: var(--wiclee-text);
  box-shadow: var(--wiclee-shadow-card);
}

.wiclee-auth__skip:focus {
  top: var(--wiclee-space-sm);
}

/* ---------- Barra superior: solo vuelta al sitio ---------- */
.wiclee-auth__bar {
  display: flex;
  align-items: center;
  padding: var(--wiclee-space-md) var(--wiclee-space-lg) 0;
}

.wiclee-auth__back {
  display: inline-flex;
  align-items: center;
  gap: var(--wiclee-space-sm);
  font-size: var(--wiclee-font-size-sm);
  font-weight: var(--wiclee-font-weight-medium);
  color: var(--wiclee-text-secondary);
  text-decoration: none;
}

.wiclee-auth__back:hover {
  color: var(--wiclee-primary-700);
}

/* ---------- Zona central: la tarjeta queda centrada y a la vista ---------- */
.wiclee-auth__main {
  flex: 1 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--wiclee-space-md);
}

.wiclee-auth-card {
  width: 100%;
  max-width: 26rem;
  padding: var(--wiclee-space-xl);
  background: var(--wiclee-bg-card);
  border: 1px solid var(--wiclee-border);
  border-radius: var(--wiclee-radius-2xl);
  box-shadow: var(--wiclee-shadow-lg);
}

.wiclee-auth-card--wide {
  max-width: 30rem;
}

.wiclee-auth-card__head {
  text-align: center;
  margin-bottom: var(--wiclee-space-lg);
}

.wiclee-auth-card__logo {
  display: block;
  height: 3.25rem;
  width: auto;
  margin: 0 auto var(--wiclee-space-md);
}

.wiclee-auth-card__title {
  margin: 0;
  font-size: var(--wiclee-font-size-xl);
  font-weight: var(--wiclee-font-weight-extrabold);
  line-height: 1.25;
  color: var(--wiclee-text);
}

.wiclee-auth-card__subtitle {
  margin: var(--wiclee-space-xs) 0 0;
  font-size: var(--wiclee-font-size-sm);
  color: var(--wiclee-text-muted);
}

/* ---------- Hub: opciones de acceso ---------- */
.wiclee-auth-options {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--wiclee-space-sm);
}

.wiclee-auth-option {
  display: flex;
  align-items: center;
  gap: var(--wiclee-space-md);
  padding: var(--wiclee-space-md);
  border: 1px solid var(--wiclee-border);
  border-radius: var(--wiclee-radius-xl);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.wiclee-auth-option:hover {
  border-color: var(--wiclee-primary);
  background: var(--wiclee-primary-50);
  box-shadow: var(--wiclee-shadow-card-subtle);
}

.wiclee-auth-option:focus-visible {
  outline: 2px solid var(--wiclee-primary);
  outline-offset: 2px;
}

.wiclee-auth-option__icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--wiclee-radius-xl);
  background: var(--wiclee-primary-50);
  color: var(--wiclee-primary-700);
  font-size: var(--wiclee-font-size-lg);
}

.wiclee-auth-option__text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.wiclee-auth-option__title {
  font-size: var(--wiclee-font-size-md);
  font-weight: var(--wiclee-font-weight-bold);
}

.wiclee-auth-option__sub {
  font-size: var(--wiclee-font-size-sm);
  color: var(--wiclee-text-muted);
}

.wiclee-auth-option__chevron {
  color: var(--wiclee-text-muted);
  transition: transform 0.15s ease, color 0.15s ease;
}

.wiclee-auth-option:hover .wiclee-auth-option__chevron {
  color: var(--wiclee-primary-700);
  transform: translateX(2px);
}

/* ---------- Formulario ---------- */
.wiclee-auth-form {
  display: grid;
  gap: var(--wiclee-space-md);
}

.wiclee-auth-field__label {
  display: block;
  margin-bottom: var(--wiclee-space-xs);
  font-size: var(--wiclee-font-size-sm);
  font-weight: var(--wiclee-font-weight-bold);
  color: var(--wiclee-text-secondary);
}

.wiclee-auth-input {
  display: block;
  width: 100%;
  min-height: 3rem;
  padding: 0 var(--wiclee-space-md);
  font: inherit;
  font-size: var(--wiclee-font-size-md);
  color: var(--wiclee-text);
  background: var(--wiclee-bg-card);
  border: 1px solid var(--wiclee-border-strong);
  border-radius: var(--wiclee-radius-lg);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.wiclee-auth-input::placeholder {
  color: var(--wiclee-text-placeholder);
}

.wiclee-auth-input:focus {
  outline: 0;
  border-color: var(--wiclee-primary);
  box-shadow: 0 0 0 3px var(--wiclee-primary-overlay);
}

.wiclee-auth-input[aria-invalid="true"] {
  border-color: var(--wiclee-danger);
}

.wiclee-auth-field__error {
  margin: var(--wiclee-space-xs) 0 0;
  font-size: var(--wiclee-font-size-sm);
  color: var(--wiclee-danger-strong);
}

.wiclee-auth-field__error[hidden] {
  display: none;
}

.wiclee-auth-form__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--wiclee-space-sm) var(--wiclee-space-md);
}

.wiclee-auth-check {
  display: inline-flex;
  align-items: center;
  gap: var(--wiclee-space-sm);
  font-size: var(--wiclee-font-size-sm);
  color: var(--wiclee-text-secondary);
  cursor: pointer;
}

.wiclee-auth-check input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--wiclee-primary-600);
}

.wiclee-auth-link {
  font-size: var(--wiclee-font-size-sm);
  font-weight: var(--wiclee-font-weight-medium);
  color: var(--wiclee-primary-700);
  text-decoration: none;
}

.wiclee-auth-link:hover {
  text-decoration: underline;
}

/* Botón de envío: el aspecto lo da .wiclee-btn; aquí solo ancho y estado de carga */
.wiclee-auth-submit {
  width: 100%;
}

.wiclee-auth-submit.is-loading {
  pointer-events: none;
  opacity: 0.8;
}

.wiclee-auth-submit.is-loading .wiclee-auth-submit__label::after {
  content: '';
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-left: var(--wiclee-space-sm);
  vertical-align: -0.15em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: var(--wiclee-radius-full);
  animation: wiclee-auth-spin 0.7s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .wiclee-auth-submit.is-loading .wiclee-auth-submit__label::after {
    animation-duration: 1.6s;
  }
}

/* Enlaces secundarios bajo el formulario */
.wiclee-auth-aside {
  margin-top: var(--wiclee-space-lg);
  padding-top: var(--wiclee-space-md);
  border-top: 1px solid var(--wiclee-border);
  display: grid;
  gap: var(--wiclee-space-sm);
  justify-items: center;
  font-size: var(--wiclee-font-size-sm);
  color: var(--wiclee-text-muted);
  text-align: center;
}

.wiclee-auth-aside p {
  margin: 0;
}

/* ---------- Pie: seguridad real + legales + soporte ---------- */
.wiclee-auth__footer {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--wiclee-space-xs) var(--wiclee-space-lg);
  padding: var(--wiclee-space-md) var(--wiclee-space-lg) var(--wiclee-space-lg);
  font-size: var(--wiclee-font-size-xs);
  color: var(--wiclee-text-muted);
  text-align: center;
}

.wiclee-auth__footer a {
  color: var(--wiclee-text-secondary);
  text-decoration: none;
}

.wiclee-auth__footer a:hover {
  color: var(--wiclee-primary-700);
  text-decoration: underline;
}

.wiclee-auth__footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--wiclee-space-xs) var(--wiclee-space-md);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ---------- Móvil y pantallas bajas ---------- */
@media (max-width: 480px) {
  .wiclee-auth-card {
    padding: var(--wiclee-space-lg) var(--wiclee-space-md);
    border-radius: var(--wiclee-radius-xl);
  }
}

@media (max-height: 44rem) {
  .wiclee-auth__bar {
    padding-top: var(--wiclee-space-sm);
  }

  .wiclee-auth-card {
    padding-block: var(--wiclee-space-lg);
  }

  .wiclee-auth-card__head {
    margin-bottom: var(--wiclee-space-md);
  }

  .wiclee-auth-card__logo {
    height: 2.5rem;
    margin-bottom: var(--wiclee-space-sm);
  }

  .wiclee-auth-card__subtitle {
    display: none;
  }

  .wiclee-auth-aside {
    margin-top: var(--wiclee-space-md);
  }
}
