/* ===== Auth pages: login, forgot password, reset password =====
   Shared by views/index.ejs and views/auth/*.ejs on top of Metronic's lock.min.css. Same design line as
   the admin panel: one card on the page ground, ghost inputs and the brand accent. Every color is a token
   from theme.css, so the page follows the light or dark mode the panel stored (html[data-theme]). */

body {
  /* lock.min.css sets its own !important background; the page is a soft gradient between the brand blues (theme.css) */
  background: var(--dz-auth-bg) !important;
  background-attachment: fixed !important;
  /* logo + card + footer sit in the middle of the viewport; on short screens they flow from the top */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.page-lock {
  width: min(440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 32px;
}

.page-lock .page-logo {
  margin-bottom: 0;
}

/* Wordmark sized by height (it has no transparent margins): same visible size as the previous logo */
.page-lock .page-logo img {
  height: 30px;
  width: auto;
}

.page-lock .page-body {
  margin-top: 28px;
  border: 1px solid var(--dz-auth-card-border);
  border-radius: 14px;
  background: var(--dz-auth-card-bg);
  box-shadow: 0 24px 60px var(--dz-auth-card-shadow), inset 0 1px 0 var(--dz-auth-card-highlight);
  overflow: hidden;
}

/* Card title (the first .lock-head) */
.lock-head {
  padding: 26px 32px 0;
  border-radius: 0;
  background: transparent;
  color: var(--dz-ink);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.2;
}

/* Card footer: index.ejs reuses .lock-head after the body for the link and the error message.
   No horizontal padding: the auth views hide a link there with a text-indent/overflow trick that
   relies on the box being clipped exactly at its content edge. */
.lock-body + .lock-head {
  padding: 0 0 26px;
  font-size: 13px;
  font-weight: 400;
}

.lock-head a {
  color: var(--dz-accent-text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.lock-head a:hover,
.lock-head a:focus {
  color: var(--dz-accent);
  text-decoration: underline;
}

.lock-body {
  margin: 20px 32px 8px;
  /* lock.min.css clips it (overflow: hidden) to contain the floated form, which also cut the 3px focus ring at the
     fields' sides; flow-root contains the float without clipping */
  display: flow-root;
  overflow: visible;
}

/* Card title in both modes: the logo above leads, the title steps down; the subtitle names the product area */
.page-lock .page-body > .lock-head:first-child {
  font-size: 18px;
  font-weight: 600;
  color: var(--dz-ink);
}

.lock-head .lock-subtitle {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  font-weight: 400;
  color: var(--dz-muted);
}

/* Visible field labels (the placeholder alone disappears once the field is filled) */
.lock-form .lock-label {
  display: block;
  margin: 0 0 6px;
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  color: var(--dz-muted);
}

/* Show / hide password button, sitting inside the right end of the field (login and reset password) */
.lock-form .password-wrapper {
  position: relative;
}

.lock-form .password-wrapper .toggle-pw {
  position: absolute;
  right: 4px;
  bottom: 4px;
  top: auto;
  transform: none;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--dz-faint);
  font-size: 15px;
  cursor: pointer;
  transition: color 0.18s ease, background-color 0.18s ease;
}

.lock-form .password-wrapper .toggle-pw:hover {
  color: var(--dz-accent-text);
  background: rgba(var(--dz-accent-rgb), 0.08);
}

.lock-form .password-wrapper .toggle-pw:focus {
  outline: 0;
}

.lock-form .password-wrapper .toggle-pw:focus-visible {
  color: var(--dz-accent-text);
  box-shadow: 0 0 0 3px rgba(var(--dz-accent-rgb), 0.35);
}

.lock-form .password-wrapper .toggle-pw .lucide {
  width: 18px;
  height: 18px;
}

/* Both Lucide icons ship in the markup; aria-pressed (password visible) decides which one shows */
.lock-form .password-wrapper .toggle-pw[aria-pressed="true"] .lucide-eye,
.lock-form .password-wrapper .toggle-pw:not([aria-pressed="true"]) .lucide-eye-off {
  display: none;
}

/* State icons of the auth cards: link expired, e-mail sent, token check in progress */
.page-lock .lock-state-icon {
  display: block;
  width: 36px;
  height: 36px;
  margin: 0 auto 12px;
}

.page-lock .lock-state-icon.is-danger {
  color: var(--dz-danger-text);
}

.page-lock .lock-state-icon.is-success {
  color: var(--dz-success-text);
}

.page-lock .lock-spinner {
  display: block;
  width: 24px;
  height: 24px;
  margin: 0 auto;
  animation: dz-spin 0.9s linear infinite;
}

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

.lock-form {
  padding: 0 !important; /* Bootstrap's .col-xs-12 gutter; the card padding handles the spacing */
}

.lock-form .form-group {
  width: 100% !important;
  margin: 0 0 14px;
}

.lock-form .form-actions {
  margin-top: 22px;
}

/* Ghost inputs */
.lock-form .form-group .form-control {
  width: 100% !important;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--dz-auth-input-border);
  border-radius: 10px;
  background: var(--dz-auth-input-bg);
  color: var(--dz-ink);
  font-size: 14px;
  box-shadow: none;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.lock-form .form-group .form-control::placeholder {
  color: var(--dz-faint);
  opacity: 1;
}

.lock-form .form-group .form-control:hover {
  border-color: var(--dz-auth-input-border-hover);
}

.lock-form .form-group .form-control:focus {
  outline: 0;
  border-color: var(--dz-accent);
  background: var(--dz-auth-input-bg-focus);
  /* !important: components-rounded.min.css removes every .form-control shadow with !important, so the ring never
     showed (only the autofilled field, whose rule is !important too, had it) */
  box-shadow: 0 0 0 3px rgba(var(--dz-accent-rgb), 0.25) !important;
}

/* Chrome autofill paints a light background of its own (with !important, and again on hover and focus); keep the
   field in the card's palette in every state: an inset shadow covers the browser's color, the text keeps the ink, and
   the browser's background change is pushed out of reach by a very long transition. The prefixed and the standard
   pseudo-class go in separate rules: a browser that does not know one drops the whole rule it sits in. */
.lock-form .form-group .form-control:-webkit-autofill,
.lock-form .form-group .form-control:-webkit-autofill:hover,
.lock-form .form-group .form-control:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--dz-ink) !important;
  caret-color: var(--dz-ink);
  /* the browser's color only paints inside the letters, which the ink covers: it never shows, so no light rim at the
     translucent border nor a light seam where the cover meets the rounded corners */
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-box-shadow: 0 0 0 1000px var(--dz-auth-autofill-bg) inset !important;
  box-shadow: 0 0 0 1000px var(--dz-auth-autofill-bg) inset !important;
  transition: background-color 600000s 0s, color 600000s 0s;
}
.lock-form .form-group .form-control:autofill {
  -webkit-text-fill-color: var(--dz-ink) !important;
  caret-color: var(--dz-ink);
  /* the browser's color only paints inside the letters, which the ink covers: it never shows, so no light rim at the
     translucent border nor a light seam where the cover meets the rounded corners */
  -webkit-background-clip: text !important;
  background-clip: text !important;
  box-shadow: 0 0 0 1000px var(--dz-auth-autofill-bg) inset !important;
  transition: background-color 600000s 0s, color 600000s 0s;
}
/* focused, the autofilled field keeps the focus ring around its cover */
.lock-form .form-group .form-control:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--dz-auth-autofill-bg) inset, 0 0 0 3px rgba(var(--dz-accent-rgb), 0.25) !important;
  box-shadow: 0 0 0 1000px var(--dz-auth-autofill-bg) inset, 0 0 0 3px rgba(var(--dz-accent-rgb), 0.25) !important;
}
.lock-form .form-group .form-control:autofill:focus {
  box-shadow: 0 0 0 1000px var(--dz-auth-autofill-bg) inset, 0 0 0 3px rgba(var(--dz-accent-rgb), 0.25) !important;
}

/* reset-password: room for the show/hide password button inside the field */
.lock-form .password-wrapper .form-control {
  padding-right: 40px;
}

/* Primary buttons of the auth pages (login, send email, set password, back to login).
   .btn is part of the selector so the rule outranks Metronic's .btn:not(.btn-sm):not(.btn-lg) line-height,
   which otherwise wins on the <a> variants and leaves their text at the top of the box. */
.page-lock .btn.lock-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100% !important;
  height: 46px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  background: var(--dz-gradient-brand);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 46px;
  text-transform: none;
  box-shadow: 0 8px 20px rgba(var(--dz-accent-rgb), 0.25);
  transition: background-color 0.2s, box-shadow 0.2s, transform 0.1s;
}

/* inline Lucide icon next to the label */
.page-lock .btn.lock-btn-primary .lucide {
  width: 18px;
  height: 18px;
  flex: none;
}
.page-lock .btn.lock-btn-primary:hover,
.page-lock .btn.lock-btn-primary:focus {
  background: var(--dz-gradient-brand-hover);
  color: #fff;
  outline: 0;
}

.page-lock .btn.lock-btn-primary:focus-visible {
  box-shadow: 0 0 0 3px rgba(var(--dz-accent-rgb), 0.45);
}

.page-lock .btn.lock-btn-primary:active {
  transform: translateY(1px);
  box-shadow: none;
}

/* Back to login (forgot password page): the view hides this link with an inline text-indent; .lock-back
   brings it back as a quiet outlined button under the form */
.lock-head.lock-back {
  text-indent: 0 !important;
  overflow: visible !important;
  margin-top: 0 !important;
  text-align: center;
}

.lock-head.lock-back a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 8px 12px;
  border: 1px solid var(--dz-auth-input-border);
  border-radius: 10px;
  color: var(--dz-muted);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.18s ease, border-color 0.18s ease, background-color 0.18s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  animation: dz-back-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both; /* arrives just after the card */
}

.lock-head.lock-back a .lucide {
  width: 16px;
  height: 16px;
  flex: none;
  transition: transform 0.18s ease;
}

.lock-head.lock-back a:hover,
.lock-head.lock-back a:focus-visible {
  color: var(--dz-accent-text);
  border-color: rgba(var(--dz-accent-rgb), 0.5);
  background: rgba(var(--dz-accent-rgb), 0.08);
  text-decoration: none;
}

/* hover: the arrow keeps pointing the way back with a short repeating nudge */
.lock-head.lock-back a:hover .lucide {
  animation: dz-back-nudge 0.9s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

/* press: the button gives a little, the arrow jumps toward the exit */
.lock-head.lock-back a:active {
  transform: scale(0.96);
  transition-duration: 0.08s;
}

.lock-head.lock-back a:active .lucide {
  animation: none;
  transform: translateX(-5px);
  transition-duration: 0.08s;
}

@keyframes dz-back-in {
  from { opacity: 0; transform: translateX(10px); }
  to { opacity: 1; transform: none; }
}

@keyframes dz-back-nudge {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-4px); }
}

.lock-head.lock-back a:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(var(--dz-accent-rgb), 0.3);
}

@media (prefers-reduced-motion: reduce) {
  .page-lock .lock-spinner { animation-duration: 2.4s; } /* still turns: it is the only sign of progress */
  .lock-head.lock-back a,
  .lock-head.lock-back a:hover .lucide { animation: none; }
  .lock-head.lock-back a:active,
  .lock-head.lock-back a:active .lucide { transform: none; }
}

/* Login error message */
.error_msg {
  min-height: 0;
}

#login-error {
  display: none;
  margin: 14px 32px 0;
  padding: 10px 12px;
  border: 1px solid var(--dz-danger-line);
  border-radius: 8px;
  background: var(--dz-danger-soft);
  color: var(--dz-danger-text-strong);
  font-size: 13px;
  box-shadow: none;
}

.page-footer-custom {
  padding-top: 28px;
  color: var(--dz-faint);
  font-size: 12px;
}

@media (max-width: 480px) {
  .page-lock {
    padding: 24px 0;
  }

  .lock-head {
    padding: 22px 22px 0;
  }

  .lock-body + .lock-head {
    padding: 0 0 22px;
  }

  #login-error {
    margin: 14px 22px 0;
  }

  .lock-body {
    margin: 16px 22px 6px;
  }
}

/* ===== Light mode refinements (dark mode keeps the rules above unchanged) ===== */

/* layered shadow: a tight contact shadow plus a long, blue-tinted one, so the card floats without weight */
html:not([data-theme="dark"]) .page-lock .page-body {
  border-color: #e6ecf5;
  box-shadow:
    0 1px 2px rgba(31, 60, 90, 0.06),
    0 12px 32px -8px rgba(45, 58, 139, 0.14),
    0 32px 64px -24px rgba(61, 177, 245, 0.22);
}


/* the link under the button: more room above, quieter until hovered */
html:not([data-theme="dark"]) .lock-body + .lock-head {
  padding-top: 6px;
}

html:not([data-theme="dark"]) .lock-head a {
  color: var(--dz-muted);
  transition: color 0.18s ease;
}

html:not([data-theme="dark"]) .lock-head a:hover,
html:not([data-theme="dark"]) .lock-head a:focus {
  color: var(--dz-accent-text);
}

/* primary button: a slight lift on hover, a small press on click */
html:not([data-theme="dark"]) .page-lock .btn.lock-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px -6px rgba(var(--dz-accent-rgb), 0.45);
}

html:not([data-theme="dark"]) .page-lock .btn.lock-btn-primary:active {
  transform: scale(0.98);
  box-shadow: 0 4px 10px -4px rgba(var(--dz-accent-rgb), 0.4);
  transition-duration: 0.08s;
}

@media (prefers-reduced-motion: reduce) {
  html:not([data-theme="dark"]) .page-lock .btn.lock-btn-primary:hover,
  html:not([data-theme="dark"]) .page-lock .btn.lock-btn-primary:active {
    transform: none;
  }
}

/* Light / dark switch, top right (the panel header's, sized for the page corner): the moon invites the dark mode
   while it is light, the sun the light mode while it is dark */
.auth-theme {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--dz-auth-card-border);
  border-radius: 10px;
  background: var(--dz-auth-card-bg);
  box-shadow: 0 6px 18px var(--dz-auth-card-shadow);
  color: var(--dz-muted);
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, transform .16s cubic-bezier(0.23, 1, 0.32, 1);
}
.auth-theme .lucide {
  width: 18px;
  height: 18px;
}
html:not([data-theme="dark"]) .auth-theme-sun,
html[data-theme="dark"] .auth-theme-moon {
  display: none;
}
@media (hover: hover) and (pointer: fine) {
  .auth-theme:hover {
    border-color: var(--dz-auth-input-border-hover);
    color: var(--dz-ink);
  }
}
.auth-theme:active {
  transform: scale(0.94);
}
.auth-theme:focus {
  outline: none;
}
.auth-theme:focus-visible {
  border-color: var(--dz-accent);
  box-shadow: 0 0 0 3px rgba(var(--dz-accent-rgb), 0.35);
}
@media (max-width: 480px) {
  .auth-theme { top: 12px; right: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-theme { transition: none; }
}
