/* ==========================================================================
   auth.css — logowanie / rejestracja
   Wymaga: variables.css, layout.css
   ========================================================================== */

html[data-auth-layout="true"] .site-content {
  width: 100%;
  max-width: none;
}

html[data-auth-layout="true"] .site-main {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
  max-width: none;
  margin: 0;
  padding-top: var(--space-32);
  padding-inline: var(--page-gutter);
  padding-bottom: var(--space-48);
}

html[data-device="phone"][data-auth-layout="true"] .site-main {
  padding-top: var(--space-24);
  padding-inline: var(--phone-page-gutter, var(--space-16));
  padding-bottom: var(--space-32);
}

.auth-page {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
  --auth-focus-ring: 0 0 0 3px color-mix(in srgb, var(--fg) 18%, transparent);
}

.auth-card {
  display: block;
  width: 100%;
  max-width: 440px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-16);
  background: var(--surface-1);
}

.auth-card__main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: var(--space-28) var(--space-24);
}

.auth-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: var(--space-24);
  border-radius: var(--radius-pill);
  background: var(--surface-3);
}

.auth-switch__btn {
  appearance: none;
  border: 0;
  border-radius: var(--radius-pill);
  min-height: 40px;
  padding: 0 var(--space-12);
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: var(--fs-14);
  font-weight: var(--fw-600);
  cursor: pointer;
  transition:
    background-color var(--dur-2) var(--ease-out),
    color var(--dur-2) var(--ease-out);
}

.auth-switch__btn.is-active {
  background: #333333;
  color: #ffffff;
}

html[data-theme="dark"] .auth-switch__btn.is-active {
  background: #f0f0f0;
  color: #141414;
}

.auth-switch__btn:focus-visible {
  outline: none;
  box-shadow: var(--auth-focus-ring);
}

.auth-head {
  margin-bottom: var(--space-20);
}

.auth-head__title {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-24);
  font-weight: var(--fw-700);
  line-height: var(--lh-tight);
  letter-spacing: -0.03em;
  color: var(--fg);
}

.auth-head__lead {
  margin: var(--space-8) 0 0;
  font-size: var(--fs-14);
  line-height: var(--lh-relaxed);
  color: var(--muted);
}

.auth-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-10);
  width: 100%;
  min-height: 48px;
  padding: 0 var(--space-16);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-12);
  background: var(--surface-1);
  color: var(--fg);
  font-family: inherit;
  font-size: var(--fs-14);
  font-weight: var(--fw-600);
  cursor: pointer;
  transition:
    background-color var(--dur-2) var(--ease-out),
    border-color var(--dur-2) var(--ease-out),
    transform var(--dur-1) var(--ease-out);
}

.auth-google:hover {
  background: var(--surface-2);
}

.auth-google:active {
  transform: scale(0.99);
}

.auth-google:focus-visible {
  outline: none;
  box-shadow: var(--auth-focus-ring);
}

.auth-google__icon {
  flex-shrink: 0;
}

.auth-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-12);
  margin: var(--space-20) 0;
  font-size: var(--fs-12);
  font-weight: var(--fw-600);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  background: var(--border);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
}

.auth-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.auth-field__label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-12);
}

.auth-field__label {
  font-size: var(--fs-13);
  font-weight: var(--fw-600);
  color: var(--fg);
}

.auth-forgot-link,
.auth-back {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  font-family: inherit;
  font-size: var(--fs-13);
  font-weight: var(--fw-600);
  cursor: pointer;
  text-decoration: none;
}

.auth-forgot-link {
  align-self: flex-end;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-back {
  color: var(--muted);
}

.auth-forgot-link:hover,
.auth-back:hover,
.auth-legal a:hover {
  color: var(--fg);
}

.auth-forgot-link:focus-visible,
.auth-back:focus-visible,
.auth-legal a:focus-visible {
  outline: none;
  border-radius: 4px;
  box-shadow: var(--auth-focus-ring);
}

.auth-field__control {
  position: relative;
}

.auth-field__input {
  width: 100%;
  min-height: 48px;
  padding: 0 var(--space-14);
  border: 1px solid var(--border);
  border-radius: var(--radius-12);
  background: var(--surface-2);
  color: var(--fg);
  font-family: inherit;
  font-size: var(--fs-14);
  line-height: var(--lh-normal);
  transition:
    border-color var(--dur-2) var(--ease-out),
    box-shadow var(--dur-2) var(--ease-out);
}

.auth-field__control .auth-field__input {
  padding-right: 44px;
}

.auth-field__input::placeholder {
  color: var(--muted-2);
}

.auth-field__input:focus {
  outline: none;
  border-color: var(--border-strong);
  background: var(--surface-1);
  box-shadow: none;
}

.auth-field__input.is-invalid {
  border-color: var(--danger);
}

.auth-field__error,
.auth-form__error {
  margin: 0;
  font-size: var(--fs-12);
  font-weight: var(--fw-500);
  line-height: var(--lh-normal);
  color: var(--danger);
}

.auth-eye {
  position: absolute;
  top: 50%;
  right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  transform: translateY(-50%);
  cursor: pointer;
}

.auth-eye:hover {
  color: var(--fg);
  background: var(--surface-3);
}

.auth-eye:focus-visible {
  outline: none;
  box-shadow: var(--auth-focus-ring);
}

.auth-legal {
  margin: 0;
  font-size: var(--fs-12);
  line-height: var(--lh-relaxed);
  color: var(--muted);
}

.auth-legal a {
  color: var(--fg);
  font-weight: var(--fw-600);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-back {
  align-self: center;
  min-height: 40px;
}

.auth-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 0 var(--space-16);
  border: 0;
  border-radius: var(--radius-pill);
  background: #333333;
  color: #ffffff;
  font-family: inherit;
  font-size: var(--fs-14);
  font-weight: var(--fw-600);
  cursor: pointer;
  transition:
    opacity var(--dur-2) var(--ease-out),
    transform var(--dur-1) var(--ease-out);
}

html[data-theme="dark"] .auth-submit {
  background: #f0f0f0;
  color: #141414;
}

.auth-submit:hover {
  opacity: 0.92;
}

.auth-submit:active {
  transform: scale(0.98);
}

.auth-submit:focus-visible {
  outline: none;
  box-shadow: var(--auth-focus-ring);
}

.auth-submit.is-busy {
  pointer-events: none;
  opacity: 0.72;
}

html[data-device="phone"] .auth-card__main {
  padding: var(--space-24) var(--space-16);
}

html[data-device="phone"] .auth-head__title {
  font-size: var(--phone-title-md, var(--fs-20));
}

@media (prefers-reduced-motion: reduce) {
  .auth-google,
  .auth-submit,
  .auth-switch__btn {
    transition: none;
  }
}
