/* ==========================================================================
   MailControl — auth screens (login / register / forgot-password)
   Shares tokens + buttons from styles.css. Layout + auth components here.
   ========================================================================== */

.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
}

/* --------------------------------------------------------------------------
   Form column
   -------------------------------------------------------------------------- */
.auth__form-col {
  display: flex;
  flex-direction: column;
  padding: clamp(28px, 4vw, 48px) clamp(24px, 5vw, 64px);
  background: var(--bg);
}

.auth__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.auth__back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--fg-secondary);
  font-family: var(--font-mono);
  letter-spacing: 0.01em;
  transition: color 0.15s;
}
.auth__back:hover { color: var(--fg); }
.auth__back svg { width: 14px; height: 14px; }

.auth__main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 420px;
  width: 100%;
  margin-inline: auto;
  padding-block: clamp(40px, 6vw, 72px);
}

.auth__head { margin-bottom: 28px; }
.auth__eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.auth__title {
  font-size: clamp(28px, 3.4vw, 36px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin-top: 10px;
}
.auth__subtitle {
  margin-top: 12px;
  font-size: 15px;
  color: var(--fg-secondary);
  line-height: 1.55;
  max-width: 42ch;
}

/* form stack */
.auth__form { display: grid; gap: 16px; }

.auth__field { display: grid; gap: 7px; }
.auth__field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--fg);
}
.auth__field-label a {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--accent);
  font-family: var(--font-mono);
  letter-spacing: 0.01em;
}
.auth__field-label a:hover { color: var(--accent-hover); }

.auth__input {
  width: 100%;
  padding: 11px 13px;
  font-size: 14.5px;
  font-family: var(--font-mono);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.auth__input::placeholder { color: #A0A49A; font-family: var(--font-mono); }
.auth__input:focus {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.auth__input.is-invalid { border-color: var(--error); }
.auth__input.is-invalid:focus { box-shadow: 0 0 0 3px var(--error-soft); }

.auth__field-error {
  font-size: 12.5px;
  color: var(--error);
  font-family: var(--font-mono);
  display: none;
}
.auth__field.has-error .auth__field-error { display: block; }

/* password field with visibility toggle */
.auth__password { position: relative; }
.auth__password .auth__input { padding-right: 44px; }
.auth__toggle {
  position: absolute;
  top: 50%; right: 8px;
  transform: translateY(-50%);
  width: 30px; height: 30px;
  display: grid; place-items: center;
  color: var(--fg-secondary);
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}
.auth__toggle:hover { color: var(--fg); background: var(--muted); }
.auth__toggle svg { width: 17px; height: 17px; }

/* password strength */
.auth__strength { display: grid; gap: 8px; margin-top: 4px; }
.auth__strength-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.auth__strength-bar i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 2px;
  transition: width 0.2s, background 0.2s;
}
.auth__strength-bar i.lv-1 { width: 25%; background: var(--error); }
.auth__strength-bar i.lv-2 { width: 50%; background: var(--warning); }
.auth__strength-bar i.lv-3 { width: 75%; background: #5A8C3A; }
.auth__strength-bar i.lv-4 { width: 100%; background: var(--success); }
.auth__strength-label {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--fg-secondary);
  letter-spacing: 0.01em;
}
.auth__strength-label strong { font-weight: 600; }

/* requirement checklist */
.auth__reqs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 14px;
  margin-top: 4px;
}
.auth__req {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--fg-secondary);
  transition: color 0.15s;
}
.auth__req .mk {
  width: 15px; height: 15px;
  flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: transparent;
  transition: all 0.15s;
}
.auth__req .mk svg { width: 9px; height: 9px; }
.auth__req.is-met { color: var(--fg); }
.auth__req.is-met .mk {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}

/* row: remember + forgot */
.auth__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 2px;
}
.auth__check {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--fg-secondary);
  cursor: pointer;
  user-select: none;
}
.auth__check input { position: absolute; opacity: 0; pointer-events: none; }
.auth__check .box {
  width: 16px; height: 16px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface);
  display: grid; place-items: center;
  transition: all 0.15s;
}
.auth__check .box svg { width: 10px; height: 10px; color: #fff; opacity: 0; transition: opacity 0.1s; }
.auth__check input:checked + .box { background: var(--accent); border-color: var(--accent); }
.auth__check input:checked + .box svg { opacity: 1; }
.auth__check input:focus-visible + .box { box-shadow: 0 0 0 3px var(--accent-soft); }

.auth__link {
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
}
.auth__link:hover { color: var(--accent-hover); }

/* primary submit (full width) */
.auth__submit {
  width: 100%;
  padding: 12px 18px;
  margin-top: 4px;
  font-size: 14.5px;
  font-weight: 500;
}

/* divider */
.auth__divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-block: 22px;
  color: var(--fg-secondary);
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.auth__divider::before, .auth__divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* google button */
.auth__google {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 18px;
  font-size: 14.5px;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  transition: border-color 0.15s, background 0.15s, transform 0.06s;
}
.auth__google:hover { border-color: #C5CBBE; background: #FCFCFB; }
.auth__google:active { transform: translateY(1px); }
.auth__google svg { width: 18px; height: 18px; flex-shrink: 0; }
.auth__google .spinner {
  width: 15px; height: 15px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
  display: none;
}
.auth__google.is-loading .google-logo { display: none; }
.auth__google.is-loading .spinner { display: block; }
.auth__google.is-loading { pointer-events: none; color: var(--fg-secondary); }
@keyframes auth-spin { to { transform: rotate(360deg); } }

/* terms line */
.auth__terms {
  font-size: 12.5px;
  color: var(--fg-secondary);
  line-height: 1.55;
  text-align: center;
  margin-top: 4px;
}
.auth__terms a { color: var(--fg); text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 2px; }
.auth__terms a:hover { text-decoration-color: var(--accent); color: var(--accent); }

/* footer (switch screen) */
.auth__footer {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 14px;
  color: var(--fg-secondary);
}
.auth__footer a {
  color: var(--accent);
  font-weight: 500;
  margin-left: 4px;
}
.auth__footer a:hover { color: var(--accent-hover); }

/* success state (forgot password) */
.auth__success {
  display: none;
  text-align: center;
  flex-direction: column;
  align-items: center;
}
.auth__success.is-visible { display: flex; }
.auth__success-icon {
  width: 56px; height: 56px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--success-soft);
  border: 1px solid #CFE6DA;
  color: var(--success);
  margin-bottom: 20px;
}
.auth__success-icon svg { width: 26px; height: 26px; }
.auth__success .auth__title { font-size: clamp(24px, 2.8vw, 30px); }
.auth__success .auth__resend {
  margin-top: 22px;
  font-size: 13px;
  color: var(--fg-secondary);
}
.auth__success .auth__resend button {
  color: var(--accent);
  font-weight: 500;
  font-family: var(--font-mono);
  margin-left: 4px;
}
.auth__success .auth__resend button:hover { color: var(--accent-hover); }
.auth__email-target {
  display: inline-block;
  font-family: var(--font-mono);
  color: var(--fg);
  font-weight: 500;
}

/* demo notice */
.auth__demo {
  margin-top: 18px;
  padding: 10px 12px;
  background: var(--warning-soft);
  border: 1px solid #ECD9B4;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--fg);
  line-height: 1.5;
  display: flex;
  gap: 9px;
  align-items: flex-start;
}
.auth__demo svg { width: 14px; height: 14px; color: var(--warning); flex-shrink: 0; margin-top: 1px; }

/* --------------------------------------------------------------------------
   Brand panel (right column)
   -------------------------------------------------------------------------- */
.auth__brand-col {
  position: relative;
  background: var(--muted);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(32px, 4vw, 56px);
  overflow: hidden;
}

.auth__brand-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 75% 70% at 50% 45%, #000 25%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 75% 70% at 50% 45%, #000 25%, transparent 80%);
  opacity: 0.5;
  pointer-events: none;
}

.auth__brand-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.auth__brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.auth__brand-body {
  margin-top: auto;
  margin-bottom: auto;
  max-width: 420px;
}

.auth__brand-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.auth__brand-headline {
  font-size: clamp(22px, 2.4vw, 27px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-top: 12px;
  color: var(--fg);
}

.auth__brand-points {
  margin-top: 28px;
  display: grid;
  gap: 14px;
}
.auth__brand-point {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
  color: var(--fg);
  line-height: 1.5;
}
.auth__brand-point .mk {
  width: 20px; height: 20px;
  flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  margin-top: 1px;
}
.auth__brand-point .mk svg { width: 11px; height: 11px; }
.auth__brand-point strong { font-weight: 600; }
.auth__brand-point span { color: var(--fg-secondary); }

/* mini operational card on brand panel */
.auth__mini-card {
  margin-top: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  font-size: 12.5px;
}
.auth__mini-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.auth__mini-head .t { font-size: 12px; font-weight: 600; letter-spacing: -0.005em; }
.auth__mini-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
}
.auth__mini-row .k { color: var(--fg-secondary); }
.auth__mini-row .v { color: var(--fg); }

.auth__brand-foot {
  position: relative;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--fg-secondary);
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.auth__brand-foot .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2.4s ease-in-out infinite;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 940px) {
  .auth { grid-template-columns: 1fr; }
  .auth__brand-col { display: none; }
  .auth__form-col { min-height: 100vh; }
}

@media (max-width: 480px) {
  .auth__form-col { padding: 22px 18px; }
  .auth__reqs { grid-template-columns: 1fr; }
  .auth__title { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth__google .spinner, .auth__brand-foot .dot { animation: none !important; }
}
