/*
 * Log in, forgot/reset password, and profile pages.
 * Builds on public/css/app.css tokens and components.
 */

/* ---------- Shared form pieces ---------- */
.auth-fields { display: grid; gap: 18px; }
.auth-alerts { display: grid; gap: 10px; }
.auth-alerts:has(> :not([hidden])) { margin-bottom: 20px; }
.alert p { margin-top: 2px; }
.alert a { font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }
.alert-danger .alert-title { color: var(--red-700); }
.alert-success { border-color: var(--green-200); background: var(--green-50); }
.alert-success > .icon { color: var(--green-600); }

.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.label-link { font-size: 13px; font-weight: 500; }

.password-field { position: relative; }
.password-field .input { padding-right: 44px; }
.password-toggle {
  position: absolute;
  top: 50%;
  right: 4px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 32px;
  transform: translateY(-50%);
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--gray-400);
  cursor: pointer;
}
.password-toggle:hover { color: var(--gray-700); background: var(--gray-100); }
.password-toggle .icon-eye-off { display: none; }
.password-toggle.is-visible .icon-eye { display: none; }
.password-toggle.is-visible .icon-eye-off { display: block; }

.btn .spinner { width: 14px; height: 14px; }

.recaptcha-slot { min-height: 78px; overflow-x: auto; }

/* Password policy checklist */
.policy-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 12px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  font-size: 12.5px;
  color: var(--text-muted);
}
.policy-list li { display: flex; align-items: center; gap: 6px; transition: color 0.15s var(--ease); }
.policy-list li .icon {
  padding: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gray-100);
  color: transparent;
  stroke-width: 3;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.policy-list li.is-met { color: var(--green-700); }
.policy-list li.is-met .icon { background: var(--green-600); color: #fff; }

.match-hint { margin-top: 8px; }
.match-hint:empty { display: none; }
.match-hint.is-ok { color: var(--green-700); }
.match-hint.is-bad { color: var(--amber-700); }

/* ---------- Logged-out pages ---------- */
.auth-footnote {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13.5px;
}
.auth-footnote a { font-weight: 500; }

.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
}
.auth-back:hover { color: var(--text); }

.auth-result-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 20px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--brand-100);
}
.auth-result-icon .icon { width: 22px; height: 22px; }
.auth-result-icon.is-warning { background: var(--amber-50); color: var(--amber-700); box-shadow: inset 0 0 0 1px var(--amber-200); }
.auth-result .auth-subtitle { margin-bottom: 16px; }
.auth-actions { display: grid; gap: 10px; margin-top: 8px; }

@media (max-width: 900px) {
  .auth-panel { justify-content: flex-start; padding-top: 32px; padding-bottom: 32px; }
  .auth-brand { margin-bottom: 32px; }
  .auth-form { margin: 0 auto; }
}
@media (max-width: 480px) {
  .auth-panel { padding-left: 20px; padding-right: 20px; }
  .auth-title { font-size: 24px; }
  .policy-list { grid-template-columns: 1fr; }
}

/* ---------- Profile ---------- */
.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
}
.stack-lg { display: grid; gap: 18px; }
.card-footer { justify-content: flex-end; }

.account-card { position: sticky; top: 24px; }
.account-identity { display: flex; align-items: center; gap: 14px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.avatar-lg { width: 48px; height: 48px; font-size: 16px; background: var(--accent); }
.account-identity-text { min-width: 0; }
.account-name { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.account-email { font-size: 13px; overflow-wrap: anywhere; }

.account-list { display: grid; gap: 14px; margin: 18px 0 0; }
.account-list > div { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.account-list dt { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 13px; }
.account-list dt .icon { color: var(--gray-400); }
.account-list dd { margin: 0; min-width: 0; font-weight: 500; text-align: right; overflow-wrap: anywhere; }

@media (max-width: 1100px) {
  .profile-grid { grid-template-columns: 1fr; }
  .account-card { position: static; }
}
@media (max-width: 640px) {
  .policy-list { grid-template-columns: 1fr 1fr; }
  .card-footer .btn { width: 100%; }
}
