/* ==========================================================================
   Auth pages (sign in / sign up / forgot password)
   Reuses design tokens from theme.css (loaded first). Bootstrap/AdminLTE's
   .form-control / .checkbox / .btn-social classes are restyled here to
   match the glass card look instead of their default light theme.
   ========================================================================== */

body.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
}

.auth-theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 60;
}

.auth-shell {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  position: relative;
  z-index: 1;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-lg);
  padding: 36px 32px;
  text-align: center;
  animation: auth-card-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes auth-card-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) { .auth-card { animation: none; } }

.auth-brand {
  margin-bottom: 22px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  color: var(--ink);
}
.auth-brand a { display: inline-flex; align-items: center; gap: 8px; }
.auth-brand img { height: 32px; width: auto; margin: 0 auto; }

/* Icon badge shown above the page title — a small SVG wrapped in
   <div class="auth-box-icon">...</div>, added per-template right before
   .auth-box-title (lock icon for sign in, user-plus for sign up, etc). */
.auth-box-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 18px;
  border-radius: var(--radius-card-sm);
  background: var(--accent-tint);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-box-icon svg { width: 24px; height: 24px; }

.auth-box-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 21px;
  color: var(--ink);
  margin-bottom: 22px;
}

/* Form fields — override Bootstrap's default .form-group/.form-control */
.auth-card .form-group { margin-bottom: 14px; text-align: left; }
.auth-card .form-control,
.auth-card input[type="text"],
.auth-card input[type="email"],
.auth-card input[type="password"] {
  width: 100%;
  font-family: var(--font-body);
  font-size: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper);
  color: var(--ink);
  height: auto;
  box-shadow: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.auth-card .form-control:focus,
.auth-card input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  box-shadow: none;
}
.auth-card .form-control::placeholder { color: var(--muted-light); }
.auth-card .help-block { color: var(--danger); font-size: 12.5px; text-align: left; margin-top: 4px; }
.auth-card .has-error .form-control { border-color: var(--danger); }

/* Left icon inside a field — wrap the Form->control output with
   <div class="input-icon-field"><span class="input-icon">svg</span>...</div> */
.auth-card .input-icon-field { position: relative; }
.auth-card .input-icon-field .form-control { padding-left: 42px; }
.auth-card .input-icon-field .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  display: flex;
  pointer-events: none;
  transition: color 0.15s ease;
}
.auth-card .input-icon-field .input-icon svg { width: 17px; height: 17px; }
.auth-card .input-icon-field .form-control:focus ~ .input-icon,
.auth-card .input-icon-field .input-icon { z-index: 1; }
.auth-card .input-icon-field:focus-within .input-icon { color: var(--accent); }

/* Right-side show/hide toggle for password fields — pairs with the
   .input-icon-field wrapper; add class "has-toggle" to also pad the right
   side of the input so the typed text never runs under the eye icon. */
.auth-card .input-icon-field.has-toggle .form-control { padding-right: 42px; }
.auth-card .pw-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease;
}
.auth-card .pw-toggle:hover { color: var(--accent); }
.auth-card .pw-toggle svg { width: 17px; height: 17px; }
.auth-card .pw-toggle .icon-eye-off { display: none; }
.auth-card .pw-toggle.is-visible .icon-eye { display: none; }
.auth-card .pw-toggle.is-visible .icon-eye-off { display: block; }

/* Checkbox (remember me / accept terms) */
.auth-card .checkbox { text-align: left; margin: 4px 0 16px; font-size: 13.5px; color: var(--ink-soft); }
.auth-card .checkbox label { display: flex; align-items: flex-start; gap: 8px; font-weight: 400; cursor: pointer; }
.auth-card .checkbox input[type="checkbox"] { margin-top: 3px; accent-color: var(--accent); width: 15px; height: 15px; flex-shrink: 0; }
.auth-card .checkbox a { color: var(--accent); text-decoration: underline; }

/* Primary submit button reuses .btn / .btn-primary from theme.css, just
   make sure Bootstrap's .btn-flat doesn't fight the radius/shadow */
.auth-card .btn-captcha,
.auth-card .btn-primary {
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-sm);
  margin-top: 4px;
}

/* Captcha slot */
.auth-card .captcha { margin: 14px 0; display: flex; justify-content: center; }

/* "OR" divider between the form and social sign-in options */
.auth-card .auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 14px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.auth-card .auth-divider::before,
.auth-card .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}
/* Legacy "- OR -" markup (kept for templates not yet updated) still gets a
   sensible look instead of raw plain text. */
.auth-card .social-auth-links > p:first-child {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 14px;
}
.auth-card .social-auth-links > p:first-child::before,
.auth-card .social-auth-links > p:first-child::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* Social auth */
.auth-card .social-auth-links { margin-top: 20px; }
.auth-card .social-auth-links p {
  color: var(--muted);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 14px;
}
.auth-card .btn-social {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  width: 100%;
  padding: 11px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid var(--glass-border);
  background: var(--surface);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.auth-card .btn-social + .btn-social { margin-top: 10px; }
.auth-card .btn-social:hover { transform: translateY(-1px); text-decoration: none; }
.auth-card .btn-social svg { width: 16px; height: 16px; flex-shrink: 0; }
.auth-card .btn-facebook { color: var(--ink); }
.auth-card .btn-facebook svg { color: #1877F2; }
.auth-card .btn-facebook:hover { border-color: #1877F2; background: rgba(24, 119, 242, 0.08); }
.auth-card .btn-twitter { color: var(--ink); }
.auth-card .btn-twitter svg { color: #1DA1F2; }
.auth-card .btn-twitter:hover { border-color: #1DA1F2; background: rgba(29, 161, 242, 0.08); }
.auth-card .btn-google:hover { border-color: var(--accent); background: var(--accent-tint); }

/* Live validation: password strength meter + match/format hints */
.field-hint {
  font-size: 12px;
  margin: 6px 0 14px 2px;
  text-align: left;
  min-height: 15px;
  transition: color 0.15s ease;
}
.field-hint:empty { display: none; }
.field-hint.is-valid { color: var(--success, #1a9e6b); }
.field-hint.is-invalid { color: var(--danger); }

.pw-strength { margin: 6px 0 16px 2px; }
.pw-strength-bar {
  display: flex;
  gap: 4px;
  height: 4px;
  margin-bottom: 5px;
}
.pw-strength-bar span {
  flex: 1;
  border-radius: 2px;
  background: var(--line);
  transition: background 0.2s ease;
}
.pw-strength-label { font-size: 11.5px; color: var(--muted); text-align: left; }
.pw-strength[data-level="1"] .pw-strength-bar span:nth-child(1) { background: var(--danger); }
.pw-strength[data-level="1"] .pw-strength-label { color: var(--danger); }
.pw-strength[data-level="2"] .pw-strength-bar span:nth-child(-n+2) { background: #e6a23c; }
.pw-strength[data-level="2"] .pw-strength-label { color: #e6a23c; }
.pw-strength[data-level="3"] .pw-strength-bar span:nth-child(-n+3) { background: var(--accent); }
.pw-strength[data-level="3"] .pw-strength-label { color: var(--accent); }
.pw-strength[data-level="4"] .pw-strength-bar span { background: var(--success, #1a9e6b); }
.pw-strength[data-level="4"] .pw-strength-label { color: var(--success, #1a9e6b); }

/* Footer links (forgot password / register) */
.auth-card > a {
  display: inline-block;
  margin-top: 14px;
  font-size: 13.5px;
  color: var(--accent);
}
.auth-card > a:hover { color: var(--accent-hover); text-decoration: underline; }
.auth-card > br { display: none; }

.auth-card p { color: var(--ink-soft); font-size: 13.5px; }

/* Flash messages inside the card */
.auth-card .flash-message,
.auth-shell > .flash-message {
  margin-bottom: 16px;
}
.auth-card .alert {
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  padding: 10px 14px;
  font-size: 13.5px;
  text-align: left;
}

.auth-footer {
  margin-top: 22px;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}
