/* ==========================================
   OPLEX LOGIN
   Visual direction aligned with orders auth shell
   ========================================== */

#loginOverlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
  background:
    radial-gradient(circle at 50% 12%, rgba(59, 130, 246, 0.08), transparent 24%),
    #161616;
  z-index: 9999;
  isolation: isolate;
}

#loginOverlay::before {
  content: none;
}

.login-card {
  position: relative;
  width: min(100%, 520px);
  max-width: 520px;
  padding: 36px 40px 34px;
  border-radius: 0;
  background: rgba(24, 24, 27, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow:
    0 18px 46px rgba(0, 0, 0, 0.28),
    0 0 0 1px rgba(255, 255, 255, 0.015) inset;
  color: #f8fafc;
  overflow: hidden;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, #2563eb, #60a5fa 42%, #93c5fd 100%);
}

.login-card-header {
  position: relative;
  display: grid;
  gap: 0;
  margin-bottom: 28px;
  z-index: 1;
}

.login-logo {
  position: relative;
  display: flex;
  justify-content: center;
  margin: 0 0 28px;
}

.login-logo::before {
  content: "";
  position: absolute;
  width: 180px;
  height: 74px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(250, 204, 21, 0.14) 0%, rgba(250, 204, 21, 0) 72%);
  filter: blur(10px);
  transform: translateY(4px);
}

.login-logo img {
  width: 180px;
  max-width: 72%;
  height: auto;
  display: block;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 6px 18px rgba(250, 204, 21, 0.12));
}

.login-heading {
  text-align: center;
}

.login-eyebrow,
.login-helper {
  display: none;
}

.login-card h3 {
  margin: 0 0 8px;
  font-size: 2rem;
  line-height: 1.12;
  letter-spacing: -0.03em;
  color: #f8fafc;
}

.login-subtitle {
  margin: 0;
  color: #cbd5e1;
  line-height: 1.5;
  font-size: 1.0625rem;
  font-weight: 500;
}

.login-form {
  position: relative;
  display: flex;
  flex-direction: column;
  z-index: 1;
}

.login-field {
  display: grid;
  gap: 7px;
  margin: 0 0 16px;
  text-align: left;
}

.login-field label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #cbd5e1;
}

/* "Login" label + "Zmień login" back button share a row in step 2.
   Back button is shown via JS (display:none default in markup). */
.login-field-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.login-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.20);
  border-radius: 6px;
  color: #93c5fd;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  font-family: inherit;
  transition: background 150ms, border-color 150ms, color 150ms;
}

.login-back-btn:hover {
  background: rgba(59, 130, 246, 0.10);
  border-color: rgba(59, 130, 246, 0.40);
  color: #bfdbfe;
}

.login-back-btn svg {
  stroke: currentColor;
  fill: none;
}

.login-field input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 0;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.03);
  color: #f8fafc;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 150ms, background 150ms, box-shadow 150ms;
}

.login-field input:hover {
  border-color: rgba(148, 163, 184, 0.26);
}

.login-field input:focus {
  border-color: rgba(96, 165, 250, 0.54);
  background: rgba(59, 130, 246, 0.07);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}

.login-field input::placeholder {
  color: #64748b;
}

.login-field input:disabled,
.login-field input:read-only {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
}

.login-error {
  padding: 11px 13px;
  margin: 0 0 16px;
  border: 1px solid rgba(248, 113, 113, 0.28);
  border-radius: 0;
  background: rgba(127, 29, 29, 0.18);
  color: #fecaca;
  font-size: 0.875rem;
  line-height: 1.5;
  text-align: left;
}

.login-card button {
  width: 100%;
  min-height: 48px;
  margin-top: 10px;
  padding: 0 18px;
  border-radius: 0;
  border: 1.5px solid rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.1);
  color: #60a5fa;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 180ms, box-shadow 180ms, transform 150ms, border-color 180ms, color 180ms;
  box-shadow:
    0 4px 12px rgba(37, 99, 235, 0.08),
    0 0 0 1px rgba(96, 165, 250, 0.04) inset;
}

.login-card button:hover {
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(59, 130, 246, 0.45);
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.14);
}

.login-card button:active {
  transform: translateY(1px);
}

.login-card button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.login-card button:focus-visible,
.login-field input:focus-visible {
  outline: none;
}

@media (max-width: 640px) {
  #loginOverlay {
    padding: 20px;
  }

  .login-card {
    width: 100%;
    max-width: none;
    padding: 28px 24px 24px;
  }

  .login-card h3 {
    font-size: 1.75rem;
  }

  .login-subtitle {
    font-size: 1rem;
  }

  .login-logo img {
    width: 156px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #loginOverlay,
  .login-card,
  .login-field input,
  .login-card button {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
