/* ==========================================================================
   Portal Estudiante v2.0 — signin.css
   Frente W1 — dueno exclusivo
   Estilos de /signin-student segun mockup aprobado signin.html.
   Scope principal: .pe-signin
   ========================================================================== */

/* ------------------------------------------------------------------
   Token bridge: variables que tokens.css define en .portal-estudiante
   pero que no estan en :root (portal-estudiante.css las omite).
   Declaradas aqui en .pe-signin para que todo el sub-arbol las herede.
   Los valores son identicos a tokens.css para garantizar coherencia.
   ------------------------------------------------------------------ */
.pe-signin {
  --teal-ink:   #1F5557;
  --surface:    #FFFFFF;
  --surface-2:  #FBF9F4;
  --gray-light: #7A7A7A;   /* override: :root tiene #888, mockup requiere #7A7A7A (AA) */
  --bad-ink:    #7A1F1F;   /* rojo-ink para texto de error */

  --r-sm:  10px;
  --r-md:  14px;
  --r-lg:  20px;
  --r-xl:  28px;
  --r-pill: 999px;

  --sh-3:     0 20px 48px rgba(30,33,38,.12), 0 6px 16px rgba(30,33,38,.06);
  --sh-focus: 0 0 0 4px rgba(109,199,208,.35);

  --s-1:  4px;  --s-2:  8px;  --s-3: 12px;  --s-4: 16px;  --s-5: 20px;
  --s-6: 24px;  --s-8: 32px;  --s-10: 40px; --s-12: 48px;

  --t-xs:   12px; --t-sm:  13px; --t-base: 15px; --t-md:  17px;
  --t-lg:   22px; --t-xl:  28px; --t-2xl:  34px;

  --tap:  44px;
  --ease: cubic-bezier(.2,.7,.2,1);

  width: 100%;
}

/* ==========================================================================
   Card principal
   ========================================================================== */
.pe-signin .pe-card {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-3);
  border: 1px solid rgba(255,255,255,.7);
  overflow: hidden;
}

.pe-signin .pe-card-body {
  padding: var(--s-6) var(--s-5) var(--s-5);
}

/* ==========================================================================
   Headline
   ========================================================================== */
.pe-signin .pe-headline {
  margin-bottom: var(--s-5);
}

.pe-signin .pe-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--teal-ink);
  background: var(--teal-soft);
  padding: 4px 10px;
  border-radius: var(--r-pill);
  margin-bottom: var(--s-3);
}

.pe-signin .pe-eyebrow .material-symbols-rounded {
  font-size: 16px;
}

.pe-signin h1 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: var(--t-xl);
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0;
}

.pe-signin .pe-lead {
  margin-top: var(--s-2);
  color: var(--gray);
  font-size: var(--t-base);
}

/* ==========================================================================
   QR Hero
   ========================================================================== */
.pe-signin .pe-qr-hero {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: var(--s-4);
  align-items: center;
  padding: var(--s-4);
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, #EAF7F8 0%, #F7F3EA 100%);
  border: 1.5px solid #CFEBED;
  position: relative;
  overflow: hidden;
}

.pe-signin .pe-qr-hero::after {
  content: '';
  position: absolute;
  right: -40px;
  top: -40px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(109,199,208,.18);
  pointer-events: none;
}

.pe-signin .pe-qr-illo {
  width: 92px;
  height: 92px;
  display: block;
  flex-shrink: 0;
}

/* Linea de escaneo animada en el SVG */
.pe-scan-line {
  animation: pe-scan 2.2s var(--ease, cubic-bezier(.2,.7,.2,1)) infinite;
  transform-origin: center;
}

@keyframes pe-scan {
  0%,100% { transform: translateY(-14px); opacity: 0; }
  15%      { opacity: 1; }
  50%      { transform: translateY(14px); opacity: 1; }
  85%      { opacity: 0; }
}

.pe-signin .pe-qr-text {
  position: relative;
  min-width: 0;
}

.pe-signin .pe-qr-title {
  font-weight: 700;
  font-size: var(--t-md);
  color: var(--ink);
  line-height: 1.25;
}

.pe-signin .pe-qr-desc {
  font-size: var(--t-sm);
  color: var(--gray);
  margin-top: 4px;
  line-height: 1.45;
}

.pe-signin .pe-qr-steps {
  display: flex;
  gap: var(--s-2);
  margin-top: var(--s-3);
  flex-wrap: wrap;
}

.pe-signin .pe-qr-step {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--teal-ink);
  background: rgba(255,255,255,.75);
  border-radius: var(--r-pill);
  padding: 4px 8px 4px 6px;
}

.pe-signin .pe-qr-step .material-symbols-rounded {
  font-size: 15px;
}

/* ==========================================================================
   Divisor
   ========================================================================== */
.pe-signin .pe-divider {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin: var(--s-5) 0 var(--s-4);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gray-light);
}

.pe-signin .pe-divider::before,
.pe-signin .pe-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ==========================================================================
   Formulario
   ========================================================================== */
.pe-signin .pe-field {
  margin-bottom: var(--s-4);
}

.pe-signin .pe-label {
  display: block;
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--gray);
  margin-bottom: 6px;
}

.pe-signin .pe-control {
  position: relative;
  display: flex;
  align-items: center;
}

.pe-signin .pe-lead-icon {
  position: absolute;
  left: 14px;
  color: var(--gray-light);
  font-size: 20px;
  pointer-events: none;
  transition: color .15s var(--ease);
}

.pe-signin .pe-input {
  width: 100%;
  height: 52px;
  padding: 0 14px 0 44px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-family: var(--font-sans);
  font-size: 16px;    /* 16px evita el zoom de iOS al enfocar */
  font-weight: 500;
  color: var(--ink);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease);
  -webkit-appearance: none;
  appearance: none;
  min-width: 0;
  max-width: 100%;
}

.pe-signin .pe-input::placeholder {
  color: var(--gray-soft);
  font-weight: 400;
}

.pe-signin .pe-input:hover {
  border-color: #D9D1BE;
}

.pe-signin .pe-input:focus {
  outline: none;
  border-color: var(--teal-deep);
  background: var(--surface);
  box-shadow: var(--sh-focus);
}

.pe-signin .pe-control:focus-within > .pe-lead-icon {
  color: var(--teal-shadow);
}

.pe-signin .pe-has-toggle {
  padding-right: 52px;
}

/* Campo invalido (aria-invalid = "true") */
.pe-signin .pe-input[aria-invalid="true"] {
  border-color: var(--red);
  background: #FFFCFC;
}

.pe-signin .pe-input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 4px rgba(163,45,45,.18);
}

.pe-signin .pe-input:disabled {
  opacity: .6;
  cursor: not-allowed;
}

/* Toggle mostrar/ocultar contraseña */
.pe-signin .pe-toggle-pass {
  position: absolute;
  right: 4px;
  top: 4px;
  width: var(--tap);      /* 44px — tap target */
  height: var(--tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  border-radius: var(--r-sm);
  color: var(--gray-light);
  cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}

.pe-signin .pe-toggle-pass:hover {
  background: var(--teal-soft);
  color: var(--teal-shadow);
}

.pe-signin .pe-toggle-pass:focus-visible {
  outline: none;
  box-shadow: var(--sh-focus);
  color: var(--teal-shadow);
}

.pe-signin .pe-toggle-pass .material-symbols-rounded {
  font-size: 22px;
}

/* ==========================================================================
   Alerta de error inline
   ========================================================================== */
.pe-signin .pe-alert {
  display: none;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: var(--s-4);
  border-radius: var(--r-md);
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid rgba(163,45,45,.18);
  font-size: var(--t-sm);
  line-height: 1.45;
}

.pe-signin .pe-alert.is-visible {
  display: flex;
  animation: pe-fade-in .2s var(--ease) both;
}

.pe-signin .pe-alert .material-symbols-rounded {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.pe-signin .pe-alert strong {
  display: block;
  font-weight: 700;
  color: var(--bad-ink);
}

/* Variante ambar: enlace del QR expirado (no es culpa del alumno, no rojo). */
.pe-signin .pe-alert.is-link {
  background: var(--yellow-soft);
  color: var(--warn-ink, #8E5810);
  border-color: rgba(186,117,23,.22);
}

.pe-signin .pe-alert.is-link strong {
  color: var(--warn-ink, #8E5810);
}

/* ==========================================================================
   Boton principal
   ========================================================================== */
.pe-signin .pe-btn {
  position: relative;
  width: 100%;
  min-height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: var(--r-md);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .01em;
  cursor: pointer;
  text-decoration: none;
  transition: transform .15s var(--ease), box-shadow .2s var(--ease), filter .2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.pe-signin .pe-btn-primary {
  color: #fff;
  background: linear-gradient(180deg, #4FB0B2 0%, var(--teal-deep) 60%, #3F999B 100%);
  box-shadow: 0 8px 20px rgba(75,168,170,.32), inset 0 1px 0 rgba(255,255,255,.25);
}

.pe-signin .pe-btn-primary:hover {
  filter: brightness(1.04);
  box-shadow: 0 10px 24px rgba(75,168,170,.38), inset 0 1px 0 rgba(255,255,255,.25);
}

.pe-signin .pe-btn-primary:active {
  transform: translateY(1px) scale(.995);
  box-shadow: 0 4px 12px rgba(75,168,170,.3);
}

.pe-signin .pe-btn-primary:focus-visible {
  outline: none;
  box-shadow: var(--sh-focus), 0 8px 20px rgba(75,168,170,.32);
}

.pe-signin .pe-btn-primary:disabled,
.pe-signin .pe-btn-primary[aria-busy="true"] {
  cursor: default;
  filter: none;
  transform: none;
}

.pe-signin .pe-btn-primary[aria-busy="true"] {
  background: var(--teal-deep);
  box-shadow: 0 4px 12px rgba(75,168,170,.25);
}

/* Labels del boton: idle / busy */
.pe-signin .pe-label-idle,
.pe-signin .pe-label-busy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pe-signin .pe-label-busy { display: none; }

.pe-signin .pe-btn[aria-busy="true"] .pe-label-idle { display: none; }
.pe-signin .pe-btn[aria-busy="true"] .pe-label-busy { display: inline-flex; }

/* Spinner */
.pe-signin .pe-spinner {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  animation: pe-spin .8s linear infinite;
}

@keyframes pe-spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   Enlace de ayuda
   ========================================================================== */
.pe-signin .pe-help-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: var(--tap);   /* tap target >= 44px */
  margin-top: var(--s-2);
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--teal-ink);
  text-decoration: none;
  border-radius: var(--r-sm);
  transition: background .15s var(--ease);
}

.pe-signin .pe-help-link:hover { background: var(--teal-soft); }
.pe-signin .pe-help-link:focus-visible { outline: none; box-shadow: var(--sh-focus); }
.pe-signin .pe-help-link .material-symbols-rounded { font-size: 18px; }

/* ==========================================================================
   Animaciones
   ========================================================================== */
@keyframes pe-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

/* ==========================================================================
   Responsive — escritorio
   ========================================================================== */
@media (min-width: 768px) {
  .pe-signin .pe-card-body { padding: var(--s-8); }
  .pe-signin h1 { font-size: var(--t-2xl); }
}

/* ==========================================================================
   Vista Verificando — InicioEstudiante.razor y ClaseDashboard.razor
   Scoped bajo .pe-acceso (wrapper de EstudianteAccesoLayout)
   ========================================================================== */

/* Stage centrado (equivalente a .center-stage del mockup) */
.pe-acceso .pe-center-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--s-6) var(--s-5);
  /* heredar tokens desde tokens.css */
  --teal-ink:   #1F5557;
  --surface:    #FFFFFF;
  --surface-2:  #FBF9F4;
  --gray-light: #7A7A7A;
  --r-sm:  10px; --r-md: 14px; --r-lg: 20px; --r-xl: 28px; --r-pill: 999px;
  --sh-3:  0 20px 48px rgba(30,33,38,.12), 0 6px 16px rgba(30,33,38,.06);
  --sh-focus: 0 0 0 4px rgba(109,199,208,.35);
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px;
  --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px;
  --t-xs: 12px; --t-sm: 13px; --t-base: 15px; --t-md: 17px;
  --t-lg: 22px; --t-xl: 28px; --t-2xl: 34px;
  --tap: 44px;
  --ease: cubic-bezier(.2,.7,.2,1);
}

/* Tarjeta central (equivalente a .center-card del mockup) */
.pe-acceso .pe-center-card {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-3);
  border: 1px solid rgba(255,255,255,.7);
  padding: var(--s-10) var(--s-6) var(--s-8);
  text-align: center;
}

.pe-acceso .pe-center-card h1 {
  font-family: var(--font-serif, 'Fraunces', Georgia, serif);
  font-weight: 600;
  font-size: var(--t-lg);
  line-height: 1.2;
  color: var(--ink, #2A2A2A);
  margin-top: var(--s-5);
  margin-bottom: 0;
}

.pe-acceso .pe-center-card p {
  color: var(--gray, #555555);
  margin-top: var(--s-2);
  font-size: var(--t-base);
  line-height: 1.5;
}

/* --- Estado normal / error --- */
.pe-acceso .pe-state-err { display: none; }
.pe-acceso .pe-state-ok  { display: block; }

.pe-acceso .pe-center-card.is-error .pe-state-ok  { display: none; }
.pe-acceso .pe-center-card.is-error .pe-state-err {
  display: block;
  animation: pe-fade-in .25s var(--ease) both;
}

/* --- Nucleo teal con ondas (animacion ripple) --- */
.pe-acceso .pe-pulse-ring {
  width: 104px;
  height: 104px;
  margin: 0 auto;
  position: relative;
  display: grid;
  place-items: center;
}

.pe-acceso .pe-pulse-ring::before,
.pe-acceso .pe-pulse-ring::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(109,199,208,.55);
  animation: pe-ripple 2s var(--ease) infinite;
}

.pe-acceso .pe-pulse-ring::after { animation-delay: 1s; }

@keyframes pe-ripple {
  0%   { transform: scale(.6); opacity: 1; }
  100% { transform: scale(1.25); opacity: 0; }
}

.pe-acceso .pe-pulse-core {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  position: relative;
  z-index: 1;
  background: linear-gradient(135deg, var(--brand-teal, #6DC7D0) 0%, var(--brand-teal-dark, #4BA8AA) 100%);
  box-shadow: 0 10px 22px rgba(75,168,170,.35);
  display: grid;
  place-items: center;
  color: #fff;
}

.pe-acceso .pe-pulse-core .material-symbols-rounded { font-size: 32px; }

/* --- Puntos de progreso --- */
.pe-acceso .pe-progress-dots {
  display: inline-flex;
  gap: 6px;
  margin-top: var(--s-4);
}

.pe-acceso .pe-progress-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-teal-dark, #4BA8AA);
  opacity: .3;
  animation: pe-dot 1.2s ease-in-out infinite;
  font-style: normal;
}

.pe-acceso .pe-progress-dots i:nth-child(2) { animation-delay: .2s; }
.pe-acceso .pe-progress-dots i:nth-child(3) { animation-delay: .4s; }

@keyframes pe-dot {
  0%,80%,100% { opacity: .3; transform: translateY(0); }
  40%         { opacity: 1;  transform: translateY(-3px); }
}

/* --- Insignia de error (ambar, no rojo) --- */
.pe-acceso .pe-err-badge {
  width: 84px;
  height: 84px;
  margin: 0 auto;
  border-radius: 26px;
  background: var(--yellow-soft, #FBF1E0);
  color: var(--yellow, #BA7517);
  display: grid;
  place-items: center;
}

.pe-acceso .pe-err-badge .material-symbols-rounded { font-size: 40px; }

/* --- Boton (reutiliza nombres de la vista verificando) ---
   FIX (premium:pe-acceso-btn-pisa-boton-entrar): estos estilos (y el margin-top: s-6
   pensado para las tarjetas centradas) se acotan a .pe-center-stage. Antes vivian en
   .pe-acceso .pe-btn y pisaban al boton Entrar (.pe-signin .pe-btn vive dentro de
   .pe-acceso), empujandolo con un margen superior que no esta en el mockup. */
.pe-acceso .pe-center-stage .pe-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 54px;
  margin-top: var(--s-6);
  border: 0;
  border-radius: var(--r-md);
  font-family: var(--font-sans, 'Figtree', sans-serif);
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: filter .2s var(--ease), box-shadow .2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.pe-acceso .pe-center-stage .pe-btn-primary {
  color: #fff;
  background: linear-gradient(180deg, #4FB0B2 0%, var(--brand-teal-dark, #4BA8AA) 60%, #3F999B 100%);
  box-shadow: 0 8px 20px rgba(75,168,170,.32), inset 0 1px 0 rgba(255,255,255,.25);
}

.pe-acceso .pe-center-stage .pe-btn-primary:hover  { filter: brightness(1.04); }
.pe-acceso .pe-center-stage .pe-btn-primary:active { transform: translateY(1px) scale(.995); }
.pe-acceso .pe-center-stage .pe-btn-primary:focus-visible {
  outline: none;
  box-shadow: var(--sh-focus), 0 8px 20px rgba(75,168,170,.32);
}

/* FIX (premium:ghost-y-footer-difieren-del-mockup a): el ghost va RELLENO teal-soft
   sin borde, como el mockup (.btn-ghost). Hover a #DCF1F3. */
.pe-acceso .pe-center-stage .pe-btn-ghost {
  color: var(--teal-ink);
  background: var(--teal-soft, #E8F6F7);
  border: 0;
  margin-top: var(--s-5);
}

.pe-acceso .pe-center-stage .pe-btn-ghost:hover  { background: #DCF1F3; }
.pe-acceso .pe-center-stage .pe-btn-ghost:active { transform: translateY(1px); }
.pe-acceso .pe-center-stage .pe-btn-ghost:focus-visible {
  outline: none;
  box-shadow: var(--sh-focus);
}

/* Enlace de ayuda */
.pe-acceso .pe-center-stage .pe-help-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: var(--tap);
  margin-top: var(--s-2);
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--teal-ink);
  text-decoration: none;
  border-radius: var(--r-sm);
  transition: background .15s var(--ease);
}

.pe-acceso .pe-center-stage .pe-help-link:hover { background: var(--teal-soft, #E8F6F7); }
.pe-acceso .pe-center-stage .pe-help-link:focus-visible { outline: none; box-shadow: var(--sh-focus); }
.pe-acceso .pe-center-stage .pe-help-link .material-symbols-rounded { font-size: 18px; }

/* ==========================================================================
   Vista Sin Clases — SinClasesActivas.razor
   ========================================================================== */

.pe-acceso .pe-illo-empty {
  width: 180px;
  height: 130px;
  margin: 0 auto;
  display: block;
}

.pe-acceso .pe-float {
  animation: pe-float 4s ease-in-out infinite;
}

@keyframes pe-float {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-5px); }
}

.pe-acceso .pe-tip {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  text-align: left;
  margin-top: var(--s-5);
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft, #F0EBDF);
  border-radius: var(--r-md);
  font-size: var(--t-sm);
  color: var(--gray, #555555);
}

.pe-acceso .pe-tip .material-symbols-rounded {
  font-size: 20px;
  color: var(--brand-teal-deep, #2C6D6F);
  flex-shrink: 0;
  margin-top: 1px;
}

/* ==========================================================================
   Accesibilidad — movimiento reducido
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .pe-scan-line               { animation: none; }
  .pe-signin .pe-spinner      { animation: none; border-color: rgba(255,255,255,.8); }
  .pe-signin .pe-alert.is-visible { animation: none; }
  .pe-signin .pe-btn,
  .pe-signin .pe-input,
  .pe-signin .pe-toggle-pass,
  .pe-signin .pe-help-link    { transition: none; }
  /* verificando + sin-clases */
  .pe-acceso .pe-pulse-ring::before,
  .pe-acceso .pe-pulse-ring::after { animation: none; }
  .pe-acceso .pe-progress-dots i   { animation: none; opacity: .6; }
  .pe-acceso .pe-float             { animation: none; }
  .pe-acceso .pe-center-card.is-error .pe-state-err { animation: none; }
  .pe-acceso .pe-btn,
  .pe-acceso .pe-btn-ghost,
  .pe-acceso .pe-help-link         { transition: none; }
}
