/* ==========================================================================
   AOS — auth.css: log in, create account, password reset
   ========================================================================== */

.auth-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
}
@media (min-width: 960px) {
  .auth-layout { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); }
}

/* ---------- Brand panel ---------- */
.auth-aside {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: none;
  flex-direction: column;
  justify-content: space-between;
  padding: 2.5rem 3rem 3rem;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg-elev), var(--bg));
}
@media (min-width: 960px) { .auth-aside { display: flex; } }

.auth-aside::before,
.auth-aside::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.auth-aside::before {
  background:
    radial-gradient(70% 50% at 100% 0%, rgba(26, 102, 255, 0.3), transparent 70%),
    radial-gradient(60% 40% at 0% 100%, rgba(140, 155, 180, 0.12), transparent 70%);
}
.auth-aside::after {
  background-image:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(80% 70% at 30% 40%, #000, transparent 85%);
  mask-image: radial-gradient(80% 70% at 30% 40%, #000, transparent 85%);
  opacity: 0.7;
}

.auth-aside .brand { font-size: 2rem; }
.aside-body { max-width: 440px; }
.aside-body h2 { font-size: clamp(2rem, 3.2vw, 2.9rem); }
.aside-body > p { margin-top: 1rem; color: var(--text-muted); font-size: 1.05rem; }
.aside-list { display: grid; gap: 0.9rem; margin-top: 2rem; }
.aside-list li { display: flex; gap: 0.8rem; align-items: flex-start; color: var(--text-muted); }
.aside-list .icon {
  width: 1.5rem; height: 1.5rem;
  padding: 0.3rem;
  margin-top: 0.1rem;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue-bright);
  stroke-width: 2.5;
}
.aside-foot { color: var(--text-dim); font-size: 0.88rem; }

/* ---------- Form panel ---------- */
.auth-main {
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem 2rem;
  background:
    radial-gradient(60% 40% at 50% 0%, rgba(26, 102, 255, 0.1), transparent 70%),
    var(--bg);
}
@media (min-width: 640px) { .auth-main { padding: 1.75rem 2rem 2.5rem; } }

.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 44px; }
.auth-top .brand { font-size: 1.55rem; }
@media (min-width: 960px) { .auth-top .brand { visibility: hidden; } }
.back-link {
  display: inline-flex; align-items: center; gap: 0.45rem;
  min-height: 44px;
  color: var(--text-muted);
  font-size: 0.93rem;
}
.back-link:hover { color: var(--text); text-decoration: none; }
.back-link .icon { width: 1rem; height: 1rem; transform: rotate(180deg); }

.auth-center { flex: 1; display: grid; place-items: center; padding: 1.5rem 0; }
.auth-card {
  width: 100%;
  max-width: 460px;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--surface), var(--bg-elev));
  box-shadow: 0 40px 80px -40px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.auth-card.wide { max-width: 560px; }
.auth-card h1 { font-size: clamp(1.7rem, 3.5vw, 2.1rem); }
.auth-sub { margin-top: 0.6rem; color: var(--text-muted); }

/* ---------- Form controls ---------- */
.auth-form { display: grid; gap: 1.2rem; margin-top: 1.75rem; }
.form-grid-2 { display: grid; gap: 1.2rem; grid-template-columns: 1fr; }
@media (min-width: 520px) { .form-grid-2 { grid-template-columns: 1fr 1fr; } }

.field { display: grid; gap: 0.45rem; min-width: 0; }
.field-row { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.field label,
.field-row label { font-size: 0.92rem; font-weight: 500; }
.optional { color: var(--text-dim); font-weight: 400; }
.link-sm { font-size: 0.9rem; }

.input {
  width: 100%;
  min-height: 50px;
  padding: 0 1rem;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 1rem;           /* 16px: prevents iOS zoom on focus */
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}
.input::placeholder { color: var(--text-dim); }
.input:hover { border-color: #3b4350; }
.input:focus {
  outline: none;
  border-color: var(--blue-bright);
  box-shadow: 0 0 0 3px rgba(77, 141, 255, 0.28);
}
.input[aria-invalid="true"] { border-color: var(--danger); }
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(255, 123, 123, 0.25); }

select.input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.6rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238892a3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  background-size: 1.15rem;
}
select.input option { background: var(--surface-2); color: var(--text); }

.input-wrap { position: relative; }
.input-wrap .input { padding-right: 3.2rem; }
.reveal-btn {
  position: absolute;
  top: 50%; right: 0.4rem;
  display: grid; place-items: center;
  width: 44px; height: 44px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-dim);
}
.reveal-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.reveal-btn .i-hide { display: none; }
.reveal-btn[aria-pressed="true"] .i-show { display: none; }
.reveal-btn[aria-pressed="true"] .i-hide { display: block; }

.field-error {
  display: flex; align-items: flex-start; gap: 0.4rem;
  color: var(--danger);
  font-size: 0.88rem;
  line-height: 1.4;
}
.field-error[hidden] { display: none; }
.field-note { color: var(--warning); font-size: 0.86rem; }
.field-note[hidden] { display: none; }
.field-hint { color: var(--text-dim); font-size: 0.86rem; }

/* Checkboxes */
.check-field { display: flex; align-items: flex-start; gap: 0.75rem; }
.check-field input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 22px; height: 22px;
  margin: 1px 0 0;
  border: 1.5px solid #3b4350;
  border-radius: 6px;
  background: var(--surface-2);
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.check-field input[type="checkbox"]:checked {
  border-color: var(--blue);
  background-color: var(--blue);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 14px;
}
.check-field input[type="checkbox"]:focus-visible { outline: 2px solid var(--blue-bright); outline-offset: 3px; }
.check-field input[type="checkbox"][aria-invalid="true"] { border-color: var(--danger); }
.check-field label { color: var(--text-muted); font-size: 0.93rem; line-height: 1.5; cursor: pointer; }

/* Honeypot (hidden from people, tempting to bots) */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Status banner (live region; empty = invisible) */
.form-status { border-radius: var(--radius-sm); font-size: 0.93rem; line-height: 1.45; }
.form-status:empty { margin: 0; padding: 0; border: 0; }
.form-status.is-error,
.form-status.is-info,
.form-status.is-success {
  margin-top: 1.5rem;
  padding: 0.8rem 1rem;
  border: 1px solid;
}
.form-status.is-error   { color: #ffd0d0; border-color: rgba(255, 123, 123, 0.45); background: rgba(255, 123, 123, 0.09); }
.form-status.is-info    { color: #cfe0ff; border-color: rgba(77, 141, 255, 0.45); background: var(--blue-soft); }
.form-status.is-success { color: #c9f5e2; border-color: rgba(61, 220, 151, 0.45); background: rgba(61, 220, 151, 0.09); }
.form-status + .auth-form { margin-top: 1.25rem; }

/* Submit button + loading state */
.auth-form .btn { margin-top: 0.25rem; }
.btn[aria-busy="true"] { pointer-events: none; }
.btn[aria-busy="true"]::before {
  content: "";
  width: 1.05rem; height: 1.05rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.auth-switch { margin-top: 1.6rem; text-align: center; color: var(--text-muted); font-size: 0.95rem; }
.auth-switch a { font-weight: 600; }
.auth-legal { margin-top: 1.25rem; text-align: center; color: var(--text-dim); font-size: 0.82rem; }

/* ---------- Password strength ---------- */
.strength { display: grid; gap: 0.5rem; margin-top: 0.4rem; }
.strength-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.strength-bar span { height: 5px; border-radius: 3px; background: var(--surface-3); transition: background-color 0.25s; }
.strength[data-level="1"] .strength-bar span:nth-child(-n + 1) { background: var(--danger); }
.strength[data-level="2"] .strength-bar span:nth-child(-n + 2) { background: var(--warning); }
.strength[data-level="3"] .strength-bar span:nth-child(-n + 3) { background: var(--blue-bright); }
.strength[data-level="4"] .strength-bar span:nth-child(-n + 4) { background: var(--success); }
.strength-label { color: var(--text-dim); font-size: 0.86rem; }

.reqs { display: grid; gap: 0.35rem; }
.reqs li {
  position: relative;
  padding-left: 1.55rem;
  color: var(--text-dim);
  font-size: 0.86rem;
}
.reqs li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.2em;
  width: 14px; height: 14px;
  border: 1.5px solid #3b4350;
  border-radius: 50%;
  transition: background-color 0.2s, border-color 0.2s;
}
.reqs li.is-met { color: var(--text-muted); }
.reqs li.is-met::before {
  border-color: var(--success);
  background-color: var(--success);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230d0f13' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 9px;
}

/* ---------- Success panel ---------- */
.auth-success { text-align: center; }
.auth-success[hidden] { display: none; }
.auth-success:focus { outline: none; }
.success-icon {
  display: grid; place-items: center;
  width: 64px; height: 64px;
  margin: 0 auto 1.4rem;
  border: 1px solid rgba(77, 141, 255, 0.35);
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue-bright);
  box-shadow: 0 0 40px -8px var(--blue-glow);
}
.success-icon .icon { width: 1.9rem; height: 1.9rem; stroke-width: 2.2; }
.auth-success h2 { font-size: 1.6rem; }
.auth-success p { margin-top: 0.8rem; color: var(--text-muted); }
.auth-success strong { color: var(--text); word-break: break-all; }
.auth-success .btn { margin-top: 1.75rem; }
.demo-note {
  margin-top: 1.25rem !important;
  padding: 0.8rem 1rem;
  border: 1px solid rgba(77, 141, 255, 0.4);
  border-radius: var(--radius-sm);
  background: var(--blue-soft);
  color: #cfe0ff !important;
  font-size: 0.9rem;
  text-align: left;
}
.demo-note[hidden] { display: none; }
