/* =========================================================================
   Sign-in experience: split-screen shell, form controls and a decorative
   branded panel. Markup: app/core/auth-shell.php. Tokens are scoped to
   .auth-page so these pages look the same regardless of the app theme.
   ========================================================================= */

.auth-page {
  --bg: #faf9f6;
  --bg-elevated: #ffffff;
  --bg-subtle: #f2f0eb;
  --fg: #15171b;
  --fg-muted: #555a63;
  --fg-subtle: #858a93;
  --line: #e2dfd8;
  --line-strong: #cbc7be;
  --primary: #1d4ed8;
  --primary-hover: #173fb0;
  --primary-soft: #e6ecfb;
  --success: #128a5b;
  --success-soft: #e1f3ea;
  --warning: #a66b12;
  --danger: #cc3d50;
  --danger-soft: #f9e5e8;
  --ring: rgba(29, 78, 216, 0.32);
  --radius-sm: 6px;
  --radius: 8px;
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 560px) 1fr;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
body.area-auth { margin: 0; background: #faf9f6; }
.auth-page *, .auth-page *::before, .auth-page *::after { box-sizing: border-box; }
.auth-page a { color: var(--primary); text-decoration: none; transition: color 150ms ease; }
.auth-page a:hover { color: var(--primary-hover); }

/* --- Form column --- */
.auth-form-col { display: flex; align-items: center; justify-content: center; padding: 3rem 2.5rem; }
.auth-form-inner { width: 100%; max-width: 400px; }
.auth-form-inner.auth-wide { max-width: 480px; }

.auth-logo {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-weight: 800; font-size: 1.05rem; letter-spacing: -0.01em;
  color: var(--fg) !important; margin-bottom: 2.5rem;
}
.auth-logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--primary); color: #fff; font-weight: 800; font-size: 1rem; flex-shrink: 0;
}
.auth-logo-badge {
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--primary); background: var(--primary-soft); border-radius: 999px; padding: 0.15rem 0.5rem;
}

.auth-heading {
  font-size: 1.85rem; font-weight: 800; letter-spacing: -0.015em; line-height: 1.2;
  margin: 0 0 0.4rem; color: var(--fg); animation: auth-rise 420ms ease both;
}
.auth-subtext { font-size: 0.9rem; color: var(--fg-muted); margin: 0 0 1.75rem; line-height: 1.5; animation: auth-rise 420ms ease 40ms both; }

.auth-alert {
  display: flex; align-items: flex-start; gap: 0.55rem;
  border-radius: var(--radius-sm); padding: 0.65rem 0.85rem;
  font-size: 0.85rem; line-height: 1.45; margin-bottom: 1.1rem; animation: auth-rise 260ms ease both;
}
.auth-alert-error { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger); }
.auth-alert-info { background: var(--success-soft); color: var(--success); border: 1px solid var(--success); }
.auth-alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 0.1rem; }

.auth-form { display: flex; flex-direction: column; }
.auth-field { margin-bottom: 1.1rem; animation: auth-rise 420ms ease both; }
.auth-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 0.85rem; }
.auth-grid-3 { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 0 0.85rem; }
.auth-label { display: block; font-size: 0.8rem; font-weight: 600; margin: 0 0 0.4rem; color: var(--fg-muted); }
.auth-input {
  width: 100%; padding: 0.7rem 0.85rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--bg-elevated); color: var(--fg);
  font-size: 0.92rem; font-family: inherit; transition: border-color 150ms ease, box-shadow 150ms ease;
}
.auth-input::placeholder { color: var(--fg-subtle); }
.auth-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.auth-input-error { border-color: var(--danger); }
.auth-input-error:focus { box-shadow: 0 0 0 3px rgba(209, 73, 91, 0.25); }
.auth-input.auth-code { font-family: var(--font-mono); font-size: 1.25rem; letter-spacing: 0.3em; text-align: center; }
.auth-field-error { display: block; margin-top: 0.35rem; font-size: 0.78rem; color: var(--danger); }
.auth-field-error:empty { display: none; }

.auth-row-between { display: flex; justify-content: space-between; align-items: center; margin: -0.35rem 0 0.9rem; font-size: 0.82rem; }
.auth-forgot-link { font-size: 0.82rem; font-weight: 600; }

.auth-submit {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  width: 100%; margin-top: 0.4rem; padding: 0.8rem; border: 0; border-radius: 10px;
  background: var(--primary); color: #fff; font-weight: 700; font-size: 0.95rem; font-family: inherit;
  cursor: pointer; transition: background-color 180ms ease, transform 150ms ease;
}
.auth-submit:hover:not(:disabled) { background: var(--primary-hover); transform: translateY(-1px); }
.auth-submit:active:not(:disabled) { transform: translateY(1px); }
.auth-submit:disabled { opacity: 0.65; cursor: default; }
.auth-submit-arrow { display: inline-block; transition: transform 180ms ease; }
.auth-submit:hover:not(:disabled) .auth-submit-arrow { transform: translateX(4px); }
.auth-submit.is-busy .auth-submit-arrow { display: none; }
.auth-submit.is-busy::before {
  content: ""; width: 15px; height: 15px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.3); border-top-color: #fff; animation: auth-spin 800ms linear infinite;
}
@keyframes auth-spin { to { transform: rotate(360deg); } }
.auth-secondary-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 100%;
  padding: 0.68rem; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--bg-elevated); color: var(--fg) !important; font-weight: 600; font-size: 0.88rem;
  font-family: inherit; cursor: pointer; transition: background-color 150ms ease;
}
.auth-secondary-btn:hover { background: var(--bg-subtle); }

/* Password field: input + visibility toggle */
.auth-input-wrap { position: relative; }
.auth-input-wrap .auth-input { padding-right: 2.7rem; }
.auth-eye-btn {
  position: absolute; top: 50%; right: 0.35rem; transform: translateY(-50%);
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent;
  color: var(--fg-subtle); cursor: pointer; transition: color 150ms ease, background-color 150ms ease;
}
.auth-eye-btn:hover, .auth-eye-btn.is-on { color: var(--fg); background: var(--bg-subtle); }
.auth-eye-btn svg { width: 17px; height: 17px; }

.auth-divider {
  display: flex; align-items: center; gap: 0.75rem; margin: 1.5rem 0;
  color: var(--fg-subtle); font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.auth-steps { margin: 0 0 1.25rem; padding-left: 1.2rem; font-size: 0.88rem; color: var(--fg-muted); line-height: 1.6; }
.auth-steps li + li { margin-top: 0.35rem; }
.auth-secret {
  display: inline-block; font-family: var(--font-mono); font-size: 0.85rem; letter-spacing: 0.05em;
  background: var(--bg-subtle); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.15rem 0.45rem;
  word-break: break-all;
}
.auth-recovery {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem 1rem; margin: 0 0 1.25rem; padding: 1rem;
  font-family: var(--font-mono); font-size: 0.88rem; background: var(--bg-elevated);
  border: 1px dashed var(--line-strong); border-radius: var(--radius);
}
.auth-inline-form { display: inline; }
.auth-link-btn { background: none; border: 0; padding: 0; color: var(--primary); font: inherit; font-weight: 600; cursor: pointer; }
.auth-link-btn:hover { color: var(--primary-hover); }

.auth-switch { text-align: center; font-size: 0.85rem; color: var(--fg-muted); margin: 1.75rem 0 0; }
.auth-switch a { font-weight: 600; }
.auth-legal { text-align: center; font-size: 0.75rem; color: var(--fg-subtle); margin: 1.25rem 0 0; line-height: 1.5; }

@keyframes auth-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* --- Showcase panel (decorative, hidden < 900px and from assistive tech) --- */
.auth-panel {
  position: relative; overflow: hidden; display: flex; align-items: center;
  padding: 3.5rem 3.5rem 3.5rem 2.5rem; background: #0a1122; border-left: 1px solid rgba(148, 163, 184, 0.18);
}
.auth-panel-bg { position: absolute; inset: 0; z-index: 0; }
.auth-panel-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.14) 1px, transparent 1px);
  background-size: 42px 42px; opacity: 0.5;
  -webkit-mask-image: radial-gradient(80% 70% at 50% 40%, #000 30%, transparent 80%);
  mask-image: radial-gradient(80% 70% at 50% 40%, #000 30%, transparent 80%);
}
.auth-panel-content { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 3.25rem; max-width: 480px; }
.auth-panel-top { animation: auth-rise 500ms ease both; }
.auth-panel-eyebrow {
  display: inline-block; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em;
  font-size: 0.72rem; font-weight: 600; color: #3ce0f7; margin-bottom: 0.85rem;
}
.auth-panel-heading { font-size: 2.1rem; line-height: 1.15; font-weight: 800; letter-spacing: -0.02em; color: #fff; margin: 0 0 0.85rem; }
.auth-panel-subhead { font-size: 0.98rem; color: #9fb0c9; line-height: 1.6; margin: 0; max-width: 38ch; }

.auth-card-stack { position: relative; height: 190px; }
.auth-lead-card {
  position: absolute; left: 0; width: 100%; display: flex; align-items: center; gap: 0.65rem;
  padding: 0.75rem 1rem; background: #fff; border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: var(--radius); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  animation: auth-card-in 560ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.auth-lead-card-1 { top: 0; transform: rotate(-2deg); animation-delay: 120ms; z-index: 3; }
.auth-lead-card-2 { top: 62px; left: 28px; transform: rotate(1.4deg); animation-delay: 240ms; z-index: 2; }
.auth-lead-card-3 { top: 124px; left: 8px; transform: rotate(-1deg); animation-delay: 360ms; z-index: 1; }
@keyframes auth-card-in { from { opacity: 0; transform: translateY(14px) rotate(0deg); } to { opacity: 1; } }

.auth-favicon-dot {
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
  border-radius: 8px; flex-shrink: 0; font-weight: 700; font-size: 0.8rem; color: #fff;
}
.auth-favicon-dot-primary { background: var(--primary); }
.auth-favicon-dot-success { background: var(--success); }
.auth-favicon-dot-warning { background: var(--warning); }
.auth-lead-text { display: flex; flex-direction: column; min-width: 0; flex-shrink: 0; }
.auth-lead-name { font-size: 0.85rem; font-weight: 700; color: #0f1729; white-space: nowrap; }
.auth-lead-domain { font-size: 0.72rem; color: #5a6b85; white-space: nowrap; }
.auth-lead-email {
  font-family: var(--font-mono); font-size: 0.72rem; color: #5a6b85; background: #eef2f7;
  border-radius: 999px; padding: 0.22rem 0.55rem; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; flex: 1; min-width: 0; text-align: center;
}
.auth-verified { font-size: 0.72rem; font-weight: 700; white-space: nowrap; flex-shrink: 0; }
.auth-verified-success { color: #128a5b; }
.auth-verified-warning { color: #a66b12; }
.auth-verified-primary { color: #1d4ed8; }

.auth-stat-chip {
  position: absolute; z-index: 4; display: flex; flex-direction: column; padding: 0.55rem 0.85rem;
  background: rgba(19, 28, 48, 0.85); border: 1px solid rgba(148, 163, 184, 0.25); border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4); backdrop-filter: blur(8px);
  animation: auth-float 5s ease-in-out infinite, auth-card-in 560ms ease 500ms both;
}
.auth-stat-value { font-family: var(--font-mono); font-weight: 700; font-size: 0.95rem; color: #fff; }
.auth-stat-label { font-size: 0.68rem; color: #9fb0c9; }
.auth-stat-chip-1 { top: -64px; right: 8px; animation-delay: 0s, 480ms; }
.auth-stat-chip-2 { bottom: -62px; right: -8px; animation-delay: 1.4s, 620ms; }
@keyframes auth-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

.auth-testimonial {
  margin: 0; padding: 1.25rem 1.4rem; background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(148, 163, 184, 0.22); border-radius: var(--radius);
  backdrop-filter: blur(8px); animation: auth-rise 500ms ease 200ms both;
}
.auth-testimonial p { margin: 0 0 0.9rem; font-size: 0.9rem; line-height: 1.55; color: #eef2fa; font-style: italic; }
.auth-testimonial footer { display: flex; align-items: center; gap: 0.6rem; }
.auth-testimonial-avatar {
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
  border-radius: 999px; background: var(--primary); color: #fff; font-weight: 700; font-size: 0.75rem; flex-shrink: 0;
}
.auth-testimonial-who { display: flex; flex-direction: column; }
.auth-testimonial-name { font-size: 0.82rem; font-weight: 700; color: #fff; }
.auth-testimonial-title { font-size: 0.75rem; color: #9fb0c9; }

@media (max-width: 900px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-panel { display: none; }
  .auth-form-col { padding: 2.5rem 1.5rem; }
}
@media (max-width: 420px) {
  .auth-form-col { padding: 2rem 1.1rem; }
  .auth-grid-2, .auth-grid-3 { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-page *, .auth-page *::before { animation: none !important; transition: none !important; }
}
