/* WolnaMoc — przedsionek zaproszeniowy (styl: Unitresco login, branding WolnaMoc) */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
[hidden] { display: none !important; }

.login-stage {
  --wm-navy: #0E1626;
  --wm-accent: #C026D3;
  --wm-blue: #4A90D9;
  --wm-text: #f2f0ea;
  --wm-muted: rgba(242, 240, 234, 0.55);
  --wm-ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background: var(--wm-navy);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'IBM Plex Sans', sans-serif;
  color: var(--wm-text);
}

.login-stage__net {
  position: absolute;
  inset: 0;
  animation: u-fadein 2s ease 0.2s both;
}

.login-stage__net canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.login-stage__wash {
  position: absolute;
  inset: -60px;
  pointer-events: none;
  background:
    radial-gradient(circle at 84% 10%, rgba(192, 38, 211, 0.16) 0%, transparent 38%),
    radial-gradient(circle at 10% 94%, rgba(74, 144, 217, 0.16) 0%, transparent 34%);
}

/* rytm pionowy: logo / H1 / zdanie / oddech ~56px / pole / mikrolinijka */
.login-stage__content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 48px 24px 96px;
  max-width: 100%;
}

.login-stage__wm {
  font: 700 clamp(26px, 3vw, 34px)/1.3 'IBM Plex Sans', sans-serif;
  color: var(--wm-accent);
  text-indent: 0.2em;
  animation: u-track 1.6s var(--wm-ease) 0.3s both;
}

.login-stage__pip {
  width: 56px;
  height: 2px;
  margin: 22px 0 30px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--wm-accent), var(--wm-blue), var(--wm-accent));
  background-size: 200% 100%;
  animation:
    u-pip 6s ease infinite,
    u-pipgrow 0.8s var(--wm-ease) 1.5s both;
}

.login-stage__title {
  margin: 0 0 16px;
  font: 300 clamp(34px, 5vw, 56px) / 1.1 'IBM Plex Sans', sans-serif;
  color: #fff;
  letter-spacing: -0.015em;
  animation: u-in 0.9s var(--wm-ease) 1.7s both;
}

.login-stage__value {
  margin: 0 0 56px;
  font: 400 15px/1.6 'IBM Plex Sans', sans-serif;
  color: var(--wm-muted);
  animation: u-in 0.9s var(--wm-ease) 1.8s both;
}

/* ---------- alerty ---------- */

.login-stage__alerts {
  width: min(400px, 100%);
  margin: -32px 0 20px;
  animation: u-in 0.4s var(--wm-ease) both;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  padding: 11px 14px;
  border-radius: 10px;
  font: 400 13px/1.45 'IBM Plex Sans', sans-serif;
  background: rgba(255, 255, 255, 0.96);
  color: #7a1f1f;
  border: 1px solid rgba(197, 48, 48, 0.5);
}

.alert.info {
  color: #0e3a66;
  border-color: rgba(74, 144, 217, 0.5);
}

.alert span { flex: 1; }

.alert button {
  border: none;
  background: none;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  padding: 0;
}

.alert button:hover { opacity: 1; }

/* ---------- ekrany ---------- */

.login-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: min(400px, 100%);
  animation: u-in 0.8s var(--wm-ease) 1.95s both;
}

/* ekran 1: pole z wtopioną strzałką */
.input-wrap {
  position: relative;
  width: 100%;
}

.input-wrap input[type="email"] {
  width: 100%;
  height: 54px;
  padding: 0 60px 0 22px;
  border-radius: 12px;
  border: 1px solid rgba(242, 240, 234, 0.22);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font: 400 15px 'IBM Plex Sans', sans-serif;
  outline: none;
  transition: border-color 150ms ease, background 150ms ease;
}

.input-wrap input::placeholder { color: rgba(242, 240, 234, 0.35); }

.input-wrap input[type="email"]:focus {
  border-color: var(--wm-accent);
  background: rgba(255, 255, 255, 0.09);
}

.input-arrow {
  position: absolute;
  right: 5px;
  top: 50%;
  width: 44px;
  height: 44px;
  transform: translateY(-50%) scale(0.6);
  border: none;
  border-radius: 9px;
  background: var(--wm-accent);
  color: #fff;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms var(--wm-ease), background 150ms ease;
}

.input-arrow.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) scale(1);
}

.input-arrow:hover:not(:disabled) { background: #d43ae6; }

.input-arrow:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.input-arrow.busy .arrow-glyph { visibility: hidden; }

.input-arrow.busy::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: u-spin 0.7s linear infinite;
}

.field-error {
  margin: -4px 0 0;
  width: 100%;
  text-align: left;
  padding-left: 6px;
  font: 400 12px/1.4 'IBM Plex Sans', sans-serif;
  color: #f08a8a;
}

.microcopy {
  margin: 0;
  font: 400 12px/1.5 'IBM Plex Sans', sans-serif;
  color: rgba(242, 240, 234, 0.4);
}

.microcopy a {
  color: rgba(224, 120, 235, 0.8);
  text-decoration: none;
}

.microcopy a:hover { text-decoration: underline; }

/* ekran 2a: kratki kodu */
.code-cells {
  display: flex;
  gap: 10px;
  margin: 6px 0 2px;
}

.code-cells input {
  width: 48px;
  height: 58px;
  border-radius: 10px;
  border: 1px solid rgba(242, 240, 234, 0.22);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font: 500 24px 'IBM Plex Sans', sans-serif;
  text-align: center;
  outline: none;
  transition: border-color 150ms ease, background 150ms ease;
  caret-color: var(--wm-accent);
}

.code-cells input:focus {
  border-color: var(--wm-accent);
  background: rgba(255, 255, 255, 0.09);
}

.code-cells input:disabled { opacity: 0.5; }

/* przyciski (A' i 2b) — normalna wielkość, nie kobyła */
.btn-primary {
  border: none;
  border-radius: 10px;
  background: var(--wm-accent);
  color: #fff;
  font: 600 14px 'IBM Plex Sans', sans-serif;
  cursor: pointer;
  transition: background 150ms ease, transform 20ms ease;
}

.btn-compact {
  height: 44px;
  padding: 0 28px;
}

.btn-primary:hover:not(:disabled) { background: #d43ae6; }
.btn-primary:active:not(:disabled) { transform: translateY(1px); }

.btn-primary:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* wyszarzony do czasu zaznaczenia zgody; .busy = trwa wysyłka */
.btn-primary:disabled {
  cursor: not-allowed;
  background: rgba(242, 240, 234, 0.14);
  color: rgba(242, 240, 234, 0.4);
}

.btn-primary.busy:disabled {
  cursor: wait;
  background: var(--wm-accent);
  color: #fff;
  opacity: 0.8;
}

/* ekran 2b */
.field {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.field-label {
  font: 500 12px/1 'IBM Plex Sans', sans-serif;
  color: var(--wm-text);
  padding-left: 2px;
}

.field-label span {
  color: var(--wm-muted);
  font-weight: 400;
}

.login-form select {
  width: 100%;
  height: 46px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid rgba(242, 240, 234, 0.22);
  background: rgba(255, 255, 255, 0.06);
  color: var(--wm-text);
  font: 400 14px 'IBM Plex Sans', sans-serif;
  outline: none;
  appearance: none;
  cursor: pointer;
}

.login-form select:focus { border-color: var(--wm-accent); }
.login-form select.placeholder { color: rgba(242, 240, 234, 0.35); }
.login-form select option { background: var(--wm-navy); color: var(--wm-text); }

.consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  font: 400 12px/1.5 'IBM Plex Sans', sans-serif;
  color: var(--wm-muted);
  cursor: pointer;
  max-width: 100%;
}

.consent input {
  margin: 2px 0 0;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  accent-color: var(--wm-accent);
  cursor: pointer;
}

.consent a {
  color: rgba(224, 120, 235, 0.9);
  text-decoration: none;
}

.consent a:hover { text-decoration: underline; }

/* teksty stanów */
.code-hint {
  margin: 0;
  font: 400 14px/1.5 'IBM Plex Sans', sans-serif;
  color: var(--wm-muted);
}

.code-hint.big {
  font-size: 20px;
  color: var(--wm-text);
}

.code-hint b { color: var(--wm-text); font-weight: 500; }

.code-meta {
  margin: 2px 0 0;
  font: 400 12px/1.5 'IBM Plex Sans', sans-serif;
  color: var(--wm-muted);
}

.code-meta a {
  color: rgba(224, 120, 235, 0.9);
  text-decoration: none;
}

.code-meta a:hover { text-decoration: underline; }

.code-meta b { color: var(--wm-text); font-weight: 500; }

/* ---------- stopka ---------- */

.login-stage__foot {
  position: absolute;
  bottom: 24px;
  z-index: 1;
  padding: 0 24px;
  text-align: center;
  font: 400 11px/1.6 'IBM Plex Sans', sans-serif;
  color: rgba(242, 240, 234, 0.35);
  animation: u-in 0.7s var(--wm-ease) 2.3s both;
}

.login-stage__foot a {
  color: rgba(242, 240, 234, 0.5);
  text-decoration: none;
}

.login-stage__foot a:hover { color: rgba(224, 120, 235, 0.9); }

/* ---------- animacje ---------- */

@keyframes u-in {
  from { opacity: 0; transform: translateY(18px); filter: blur(8px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

@keyframes u-track {
  0% { opacity: 0; letter-spacing: 0.85em; transform: scale(1.35); filter: blur(12px); }
  40% { opacity: 1; }
  100% { opacity: 1; letter-spacing: 0.2em; transform: scale(1); filter: blur(0); }
}

@keyframes u-pipgrow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes u-pip {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

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

@keyframes u-fadein {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .login-stage__wm,
  .login-stage__pip,
  .login-stage__title,
  .login-stage__value,
  .login-stage__alerts,
  .login-form,
  .login-stage__foot,
  .login-stage__net {
    animation: none !important;
    opacity: 1 !important;
    filter: none !important;
    transform: none !important;
  }
  .input-arrow { transition: none; }
}
