/* ============================================================
   CobraPay - pantallas publicas (login y recuperar)

   Referencia visual: "modern-stunning-sign-in" de preetsuthar17 en 21st.dev
   (tarjeta de vidrio sobre fondo casi negro, radios grandes, campos
   translucidos y boton pildora). Reconstruido aqui en CSS plano porque el
   original es React + Tailwind y este sistema es PHP + jQuery.

   Diferencias deliberadas respecto al original:
     - Sin "Continue with Google": el acceso es solo con credenciales propias.
     - Se agrega el selector de SEDE, que el original no contempla y aqui es
       obligatorio para entrar.
     - Se anaden orbes de color detras del vidrio. El original va sobre un
       #121212 plano, y sobre un fondo liso el desenfoque no se percibe: el
       vidrio solo se lee cuando hay algo con color que difuminar.
   ============================================================ */

:root {
  --cpl-bg:      #0e1116;
  --cpl-card:    rgba(255, 255, 255, 0.07);
  --cpl-card-hi: rgba(255, 255, 255, 0.13);
  --cpl-brd:     rgba(255, 255, 255, 0.16);
  --cpl-field:   rgba(255, 255, 255, 0.09);
  --cpl-ink:     #f3f6fa;
  --cpl-ink-2:   #aab6c6;   /* 6.1:1 sobre la tarjeta */
  --cpl-steel:   #4f8fe0;
  --cpl-emerald: #12b981;
}

/* ---------- Lienzo ---------- */
.ws-login-wrap,
.rec-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 24px 16px;
  background: var(--cpl-bg);
  font-family: 'Overpass', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* Orbes: son lo que el vidrio difumina. Sin ellos la tarjeta se ve como un
   rectangulo gris cualquiera. */
.ws-login-wrap::before,
.ws-login-wrap::after,
.rec-wrap::before,
.rec-wrap::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(10px);
  opacity: 0.5;
  z-index: 0;
  animation: cplFloat 11s ease-in-out infinite;
}
.ws-login-wrap::before,
.rec-wrap::before {
  width: 540px; height: 540px;
  background: radial-gradient(circle at 32% 32%, var(--cpl-steel), transparent 68%);
  top: -190px; left: -160px;
}
.ws-login-wrap::after,
.rec-wrap::after {
  width: 470px; height: 470px;
  background: radial-gradient(circle at 68% 68%, var(--cpl-emerald), transparent 68%);
  bottom: -180px; right: -130px;
  animation-delay: -3.5s;
}
@keyframes cplFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-26px) scale(1.05); }
}

/* ---------- Tarjeta de vidrio ---------- */
.ws-login-card,
.rec-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 410px;
  padding: 38px 34px 30px;
  border-radius: 26px;
  border: 1px solid var(--cpl-brd);
  background: linear-gradient(145deg, var(--cpl-card-hi), var(--cpl-card));
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.13);
  animation: cplPop 0.5s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}
@keyframes cplPop {
  from { opacity: 0; transform: translateY(22px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Marca ---------- */
.ws-login-logo,
.rec-logo {
  display: block;
  width: 108px;
  max-height: 122px;
  object-fit: contain;
  margin: 0 auto 14px;
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.55));
}
.ws-login-card h1,
.rec-card h1 {
  margin: 0 0 4px;
  text-align: center;
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--cpl-ink);
}
.ws-login-card .sub,
.rec-card .sub {
  margin: 0 0 26px;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--cpl-ink-2);
}

/* ---------- Campos ---------- */
.ws-field { margin-bottom: 16px; }
.ws-field-label {
  display: block;
  margin: 0 0 7px 3px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cpl-ink-2);
}
.ws-input-icon { position: relative; }
.ws-input-icon .fe,
.ws-input-icon .ico {
  position: absolute;
  top: 50%; left: 15px;
  transform: translateY(-50%);
  color: var(--cpl-ink-2);
  font-size: 1.05rem;
  pointer-events: none;
  z-index: 2;
}
.ws-input-icon input,
.ws-input-icon select,
.rec-card input,
.rec-card select {
  display: block;
  width: 100%;
  height: 52px;                 /* comodo para tocar en tablet de mostrador */
  padding: 0 16px 0 46px;
  border-radius: 14px;
  border: 1px solid var(--cpl-brd);
  background: var(--cpl-field);
  color: var(--cpl-ink);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  transition: border-color 200ms ease, box-shadow 200ms ease, background-color 200ms ease;
  -webkit-appearance: none;
  appearance: none;
}
.rec-card input, .rec-card select { padding-left: 16px; }
.ws-input-icon input::placeholder { color: var(--cpl-ink-2); opacity: 0.85; }
.ws-input-icon input:focus,
.ws-input-icon select:focus,
.rec-card input:focus,
.rec-card select:focus {
  outline: none;
  border-color: var(--cpl-steel);
  background: rgba(255, 255, 255, 0.14);
  box-shadow: 0 0 0 4px rgba(79, 143, 224, 0.24);
}
/* El desplegable nativo se pinta con los colores del sistema operativo: sin
   esto, en Windows las opciones salen en texto negro sobre blanco. */
.ws-input-icon select option { background: #1a2029; color: var(--cpl-ink); }

/* Flecha propia del desplegable, ya que se quito la nativa con appearance:none */
.ws-input-icon select {
  background-image: linear-gradient(45deg, transparent 50%, var(--cpl-ink-2) 50%),
                    linear-gradient(135deg, var(--cpl-ink-2) 50%, transparent 50%);
  background-position: calc(100% - 20px) 23px, calc(100% - 14px) 23px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 40px;
}

.ws-toggle-pwd {
  position: absolute;
  top: 50%; right: 14px;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  padding: 6px;
  color: var(--cpl-ink-2);
  cursor: pointer;
  font-size: 1.05rem;
  z-index: 3;
}
.ws-toggle-pwd:hover { color: var(--cpl-ink); }

/* ---------- Boton ---------- */
.ws-btn-login,
.rec-card .btn-primary {
  width: 100%;
  height: 52px;
  margin-top: 6px;
  border: 1px solid var(--cpl-brd);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
  color: var(--cpl-ink);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 200ms ease, transform 160ms ease, box-shadow 200ms ease;
}
.ws-btn-login:hover,
.rec-card .btn-primary:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.4);
}
.ws-btn-login:active { transform: translateY(0); }
.ws-btn-login:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.ws-btn-login:focus-visible,
.ws-input-icon input:focus-visible,
.ws-input-icon select:focus-visible {
  outline: 3px solid var(--cpl-steel);
  outline-offset: 2px;
}

/* ---------- Pie ---------- */
.ws-recover { text-align: center; margin-top: 20px; }
.ws-recover a {
  color: var(--cpl-ink);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.28);
  padding-bottom: 1px;
}
.ws-recover a:hover { color: #fff; border-bottom-color: #fff; }

.ws-roles-info {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  justify-content: space-around;
  gap: 8px;
  text-align: center;
}
.ws-roles-info .rol { flex: 1; font-size: 0.72rem; color: var(--cpl-ink-2); line-height: 1.4; }
.ws-roles-info .rol strong { display: block; color: var(--cpl-ink); font-size: 0.82rem; margin-bottom: 3px; }

.ws-footer-login {
  position: relative;
  z-index: 2;
  margin-top: 22px;
  text-align: center;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.55);
}

/* ---------- Estados ---------- */
.ws-spinner {
  display: inline-block;
  width: 18px; height: 18px;
  margin-right: 9px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: cplSpin 0.7s linear infinite;
  vertical-align: middle;
}
@keyframes cplSpin { to { transform: rotate(360deg); } }

.ws-shake { animation: cplShake 0.42s ease; }
@keyframes cplShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-9px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(4px); }
}

/* ---------- Recuperar: pasos del asistente ---------- */
.step { display: none; animation: cplFade 0.3s ease; }
.step.active { display: block; }
@keyframes cplFade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.rec-card .btn {
  width: 100%; height: 48px; margin-top: 10px;
  border-radius: 999px; border: 1px solid var(--cpl-brd);
  background: rgba(255, 255, 255, 0.09); color: var(--cpl-ink);
  font-family: inherit; font-size: 0.95rem; font-weight: 600; cursor: pointer;
  transition: background-color 200ms ease;
}
.rec-card .btn:hover { background: rgba(255, 255, 255, 0.18); }
.rec-card label { display: block; margin: 14px 0 7px 3px; font-size: 0.8rem; font-weight: 700;
                  letter-spacing: 0.06em; text-transform: uppercase; color: var(--cpl-ink-2); }
.btn-link-sm { background: none; border: 0; color: var(--cpl-ink-2); font-size: 0.85rem;
               text-decoration: underline; cursor: pointer; margin-top: 12px; }
.btn-link-sm:hover { color: var(--cpl-ink); }

/* ---------- Pantalla pequena ---------- */
@media (max-width: 420px) {
  .ws-login-card, .rec-card { padding: 30px 22px 24px; border-radius: 20px; }
  .ws-login-card h1 { font-size: 1.6rem; }
  .ws-login-logo { width: 88px; }
  .ws-roles-info { display: none; }   /* en movil compite con el formulario */
}

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  .ws-login-wrap::before, .ws-login-wrap::after,
  .rec-wrap::before, .rec-wrap::after,
  .ws-login-card, .rec-card, .ws-shake { animation: none; }
  .ws-btn-login { transition: none; }
  .ws-btn-login:hover { transform: none; }
}
