/* ═══════════════════════════════════════════════════════════════════
   Fatura-KS 2026 — Auth pages
   Login / Forgot password / Reset password
   ═══════════════════════════════════════════════════════════════════ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  touch-action: manipulation;
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  color: var(--text);

  /* Premium layered gradient — same as app */
  background:
    radial-gradient(ellipse at 10% 12%, rgba(96,177,255,.22) 0%, transparent 42%),
    radial-gradient(ellipse at 24% 18%, rgba(49,154,255,.12) 0%, transparent 34%),
    radial-gradient(ellipse at 88% 84%, rgba(96,177,255,.14) 0%, transparent 40%),
    linear-gradient(162deg, #fbfdff 0%, #f5f9ff 48%, #eef4fb 100%);
  background-attachment: fixed;
  padding: 20px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body.pre-auth  { visibility: hidden; }
body.auth-ready { visibility: visible; }

/* ── Centering wrapper ── */
.wrap {
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
}

/* ── Glass card ── */
.card {
  background: rgba(255,255,255,.78);
  backdrop-filter: blur(36px) saturate(1.55);
  -webkit-backdrop-filter: blur(36px) saturate(1.55);
  border: 1px solid rgba(255,255,255,.88);
  border-radius: 22px;
  padding: 38px 34px 32px;
  box-shadow:
    0 2px 8px   rgba(0,0,0,.04),
    0 16px 48px rgba(0,0,0,.07),
    0 32px 80px rgba(49,154,255,.08),
    inset 0 1px 0 rgba(255,255,255,.9);
}

/* ── Typography ── */
.card h2 {
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -.04em;
  color: var(--text);
  margin-bottom: 5px;
}

.card > p,
.card .subtitle {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 28px;
  font-weight: 400;
  line-height: 1.5;
}

/* ── Form fields ── */
.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
  letter-spacing: -.01em;
}

.field input[type="text"],
.field input[type="password"],
.field input[type="email"],
.field input {
  width: 100%;
  height: 46px;
  border: 1.5px solid rgba(229,231,235,.9);
  border-radius: 12px;
  padding: 0 14px;
  font-size: 14px;
  font-family: inherit;
  background: rgba(255,255,255,.80);
  color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}

button,
.btn-login,
.toggle-pw,
.link-btn,
input {
  touch-action: manipulation;
}

button svg,
.toggle-pw svg {
  pointer-events: none;
}

.field input:focus {
  border-color: rgba(37,99,235,.45);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
  background: rgba(255,255,255,.96);
}

.field input:focus-visible { outline: none; }

.field input::placeholder {
  color: var(--muted);
  opacity: .5;
}

/* ── Password toggle ── */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 46px; }

.toggle-pw {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(15,23,42,.10);
  border-radius: 10px;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 6px 14px rgba(15,23,42,.05);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.toggle-pw:hover {
  color: var(--text);
  background: rgba(255,255,255,.94);
  border-color: rgba(148,163,184,.42);
  transform: translateY(-50%) translateY(-1px);
}
.toggle-pw:focus-visible {
  outline: 3px solid rgba(37,99,235,.22);
  outline-offset: 2px;
}
.toggle-pw svg  { width: 18px; height: 18px; }

/* ── Remember row ── */
.remember-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
}

.remember-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--brand);
}

.remember-row label {
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 500;
  margin-bottom: 0;
}

/* ── Aux row (forgot link) ── */
.aux-row {
  display: flex;
  justify-content: flex-end;
  margin: -10px 0 16px;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(15,23,42,.08);
  cursor: pointer;
  color: var(--brand);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease, border-color .18s ease, color .18s ease, opacity .18s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.72), 0 6px 14px rgba(15,23,42,.04);
}

.link-btn:hover {
  background: rgba(255,255,255,.94);
  border-color: rgba(148,163,184,.36);
  color: var(--brand-dark);
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.82), 0 10px 20px rgba(15,23,42,.06);
}
.link-btn:focus-visible {
  outline: 3px solid rgba(37,99,235,.22);
  outline-offset: 2px;
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .card,
  .field input[type="text"],
  .field input[type="password"],
  .field input[type="email"],
  .field input,
  .toggle-pw,
  .link-btn,
  .btn-login,
  button:not(.btn-login):not(.toggle-pw):not(.link-btn) {
    background: rgba(255,255,255,.96);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

/* ── Error message ── */
.err {
  display: none;
  background: rgba(254,242,242,.9);
  border: 1px solid #fecaca;
  color: var(--danger);
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-weight: 500;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.err.show { display: block; }

/* ── Status message (forgot / reset) ── */
.msg {
  margin-top: 12px;
  font-size: 13px;
  min-height: 18px;
  color: var(--muted);
  font-weight: 500;
}

.msg.err { color: var(--danger); background: none; border: none; padding: 0; display: block; }
.msg.ok  { color: var(--success); }

/* ── Primary submit button ── */
.btn-login {
  width: 100%;
  min-height: 38px;
  background: linear-gradient(135deg, #4f8ef8 0%, #2563eb 100%);
  color: #fff;
  border: 1px solid rgba(37,99,235,.36);
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: -.01em;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 10px 24px rgba(37,99,235,.22);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.btn-login:hover:not(:disabled) {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 14px 28px rgba(37,99,235,.28);
  transform: translateY(-1px);
}

.btn-login:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 8px 18px rgba(37,99,235,.18);
}

.btn-login:focus-visible { outline: 3px solid rgba(37,99,235,.22); outline-offset: 2px; }

.btn-login:disabled {
  background: #d1d5db;
  color: #9ca3af;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

/* ── Ghost back button (forgot / reset rows) ── */
.row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

button:not(.btn-login):not(.toggle-pw):not(.link-btn) {
  min-height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(15,23,42,.12);
  background: rgba(255,255,255,.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  padding: 0 12px;
  font-size: 13px;
  color: var(--text);
  transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease, border-color .18s ease, color .18s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 8px 20px rgba(15,23,42,.05);
  white-space: nowrap;
}

button:not(.btn-login):not(.toggle-pw):not(.link-btn):hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,.95);
  border-color: rgba(148,163,184,.42);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.82), 0 12px 24px rgba(15,23,42,.08);
}

button:not(.btn-login):not(.toggle-pw):not(.link-btn):active { transform: translateY(0); }

button:focus-visible { outline: 3px solid rgba(37,99,235,.22); outline-offset: 2px; }

/* ── Spinner ── */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin .7s linear infinite;
}

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

/* ── Footer hint ── */
.hint {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 24px;
  font-weight: 400;
}

/* ── Turnstile ── */
.turnstile-wrap { margin-bottom: 16px; min-height: 66px; }
.turnstile-wrap.is-hidden { display: none; }

/* ── Mobile ── */
@media (max-width: 480px) {
  body { padding: 12px; }

  .card {
    padding: 26px 20px 22px;
    border-radius: 18px;
  }

  .card h2 { font-size: 20px; }

  .field {
    margin-bottom: 14px;
  }

  .field input[type="text"],
  .field input[type="password"],
  .field input[type="email"],
  .field input {
    height: 42px;
    font-size: 14px;
  }

  .btn-login { min-height: 38px; }

  .row { display: grid; grid-template-columns: 1fr; }

  button:not(.btn-login):not(.toggle-pw):not(.link-btn) {
    min-height: 36px;
  }
}

@media (max-width: 390px) {
  .card {
    padding: 24px 18px 20px;
  }

  .link-btn {
    min-height: 32px;
    padding: 0 8px;
  }
}
