@import url('brand-tokens.css');

/* =========================================================================
   Auth pages (login + register) — v2.0 visual system (REQ-329).
   Core brand tokens come from brand-tokens.css (imported above — the single
   source, shared with the dashboard so the entry funnel stays visually
   continuous); only auth-specific accents are declared here.
   Header / footer styling lives in header.css / footer.css (REQ-271/272);
   this file is only the body background and the centered auth-card.
   ========================================================================= */

:root {
  --rose:      #c87da0;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-sans);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* Star field background — lifted from dashboard.css .stars (split across
   body::before for the static layer + body::after for the twinkling layer
   since auth pages have no .stars div). */
body::before {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(1px 1px at 17% 23%, rgba(255,255,255,0.55), transparent 50%),
    radial-gradient(1px 1px at 82% 15%, rgba(255,255,255,0.4), transparent 50%),
    radial-gradient(1.2px 1.2px at 44% 77%, rgba(255,255,255,0.5), transparent 50%),
    radial-gradient(1px 1px at 67% 52%, rgba(255,255,255,0.3), transparent 50%),
    radial-gradient(1px 1px at 11% 88%, rgba(255,255,255,0.35), transparent 50%),
    radial-gradient(1.2px 1.2px at 93% 66%, rgba(255,255,255,0.4), transparent 50%),
    radial-gradient(1px 1px at 29% 43%, rgba(255,255,255,0.25), transparent 50%),
    radial-gradient(0.8px 0.8px at 55% 11%, rgba(255,255,255,0.3), transparent 50%),
    radial-gradient(1px 1px at 73% 91%, rgba(255,255,255,0.3), transparent 50%),
    radial-gradient(ellipse at 20% 30%, rgba(139, 124, 216, 0.04), transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(201, 168, 109, 0.04), transparent 50%);
  opacity: 0.85;
}
body::after {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(1px 1px at 35% 12%, rgba(255,255,255,0.4), transparent 50%),
    radial-gradient(1px 1px at 88% 38%, rgba(255,255,255,0.3), transparent 50%),
    radial-gradient(0.8px 0.8px at 6% 56%, rgba(255,255,255,0.35), transparent 50%),
    radial-gradient(1px 1px at 51% 64%, rgba(255,255,255,0.3), transparent 50%),
    radial-gradient(0.8px 0.8px at 76% 80%, rgba(255,255,255,0.25), transparent 50%);
  animation: twinkle 8s ease-in-out infinite;
}
@keyframes twinkle {
  0%, 100% { opacity: 0.6; }
  50%      { opacity: 1; }
}

/* ── Layout ── */

.auth-wrapper {
  position: relative; z-index: 1;
  /* Reserve room for header (~72px) + breadcrumbs (~48px) above + footer below. */
  min-height: calc(100vh - 280px);
  min-height: calc(100dvh - 280px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px 120px;
}

/* ── Auth card — mirrors dashboard.css .hero (border + radius + gradient
   bg + L-shaped gold corner accents on ::before/::after). ── */

.auth-card {
  width: 100%;
  max-width: 460px;
  position: relative;
  padding: 56px 48px 44px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(28,25,48,0.6), rgba(22,19,36,0.6));
  overflow: hidden;
}
.auth-card::before,
.auth-card::after {
  content: '';
  position: absolute;
  width: 12px; height: 12px;
  border: 1px solid var(--gold);
}
.auth-card::before {
  top: 16px; left: 16px;
  border-right: none; border-bottom: none;
}
.auth-card::after {
  bottom: 16px; right: 16px;
  border-left: none; border-top: none;
}

.auth-card__glyph {
  text-align: center;
  font-family: var(--f-display);
  font-size: 2.4rem;
  line-height: 1;
  color: var(--gold);
  margin-bottom: 1.1rem;
  -webkit-font-feature-settings: "liga" off;
  font-feature-settings: "liga" off;
  font-variant-emoji: text;
}

.auth-card__title {
  text-align: center;
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 2rem;
  line-height: 1.15;
  color: var(--gold);
  margin: 0 0 0.4rem;
  letter-spacing: 0.01em;
}

.auth-card__subtitle {
  text-align: center;
  font-family: var(--f-mono);
  /* Audit P1-B: was 10.5px — bumped to 12px label floor. */
  font-size: 12px;
  font-weight: 300;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 0 0 2.4rem;
}

/* ── Flash / Error ── */

.flash {
  padding: 0.85rem 1.1rem;
  margin-bottom: 1.5rem;
  font-family: var(--f-sans);
  font-size: 13.5px;
  border-left: 2px solid;
  border-radius: 2px;
}
.flash--error {
  border-color: var(--rose);
  background: rgba(200, 125, 160, 0.06);
  color: var(--rose);
}

/* ── Form ── */

.form-group { margin-bottom: 1.4rem; }

.form-label {
  display: block;
  font-family: var(--f-mono);
  /* Audit P1-B: was 10px — bumped to 12px label floor. */
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 0.55rem;
}

.form-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.55rem;
}
.form-label-row .form-label {
  margin-bottom: 0;
}

.forgot-password-link {
  font-family: var(--f-mono);
  /* Audit P1-B: was 9.5px — bumped to 12px label floor. Now also a
     reachable link via min-height tap padding. */
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-3);
  text-decoration: none;
  border-bottom: 1px dotted transparent;
  cursor: pointer;
  display: inline-block;
  padding: 6px 2px;
  transition: color var(--t) var(--ease),
              border-color var(--t) var(--ease);
}
.forgot-password-link:hover {
  color: var(--gold);
  border-bottom-color: var(--gold-dim);
}
.forgot-password-link:focus-visible {
  outline: 2px solid var(--gold-2);
  outline-offset: 2px;
  border-radius: 1px;
}

.form-input {
  width: 100%;
  padding: 12px 14px;
  font-family: var(--f-sans);
  /* 16px floor prevents iOS Safari auto-zoom on focus (UX-audit login F01 / register F02). */
  font-size: 16px;
  color: var(--text);
  background: rgba(11, 10, 18, 0.6);
  border: 1px solid var(--line);
  border-radius: 2px;
  outline: none;
  transition: border-color var(--t) var(--ease),
              box-shadow var(--t) var(--ease);
}
.form-input::placeholder {
  color: var(--text-3);
}
.form-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(201, 168, 109, 0.15);
}

/* ── Password field with show/hide eye toggle (REQ-515) ── */

.password-field {
  position: relative;
}
.password-field .form-input {
  /* room for the toggle so long passwords never slide under it */
  padding-right: 46px;
}
.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--text-3);
  cursor: pointer;
  transition: color var(--t) var(--ease);
}
.password-toggle:hover,
.password-toggle:focus-visible {
  color: var(--gold);
  outline: none;
}
.password-toggle.is-revealed {
  color: var(--gold);
}

/* ── "Forgot your password?" link under the login password field ── */

.auth-forgot {
  margin: 8px 0 0;
  text-align: right;
  font-size: 13px;
}
.auth-forgot a {
  color: var(--text-3);
  text-decoration: none;
  transition: color var(--t) var(--ease);
}
.auth-forgot a:hover {
  color: var(--gold);
}

/* ── Submit button — matches .btn-primary in dashboard.css ── */

.btn-submit {
  display: block;
  width: 100%;
  margin-top: 0.4rem;
  padding: 14px 22px;
  font-family: var(--f-sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #0e0c16;
  background: var(--gold);
  border: 1px solid var(--gold);
  border-radius: 2px;
  cursor: pointer;
  transition: background-color var(--t) var(--ease),
              border-color var(--t) var(--ease);
}
.btn-submit:hover {
  background: var(--gold-2);
  border-color: var(--gold-2);
}
.btn-submit:focus-visible {
  outline: 2px solid var(--gold-2);
  outline-offset: 2px;
}

/* ── OR divider + social auth row (REQ-333) ──
   Distinct from the ✦ .auth-divider below: this one separates auth methods
   (form vs. social), while .auth-divider separates form from footer link. */

.auth-or-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  padding: 1.4rem 0 1.0rem;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.4em;
  color: var(--text-3);
  text-transform: uppercase;
}
.auth-or-divider::before,
.auth-or-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--line), transparent);
}

.social-auth-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 0;
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--line);
  border-radius: 2px;
  cursor: pointer;
  transition: color var(--t) var(--ease),
              border-color var(--t) var(--ease),
              background-color var(--t) var(--ease);
}
.social-btn:hover {
  color: var(--gold);
  border-color: var(--gold-dim);
  background: rgba(201, 168, 109, 0.06);
}
.social-btn:focus-visible {
  outline: 2px solid var(--gold-2);
  outline-offset: 2px;
}

.social-btn__icon {
  width: 18px;
  height: 18px;
  display: block;
}

/* ── Toast (REQ-332/REQ-333 stub click feedback) ── */

.auth-toast {
  position: fixed;
  left: 50%;
  /* Audit P1-C: keep toast above the iOS home-indicator strip. */
  bottom: calc(32px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(20px);
  padding: 12px 20px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--gold-dim);
  border-radius: 2px;
  font-family: var(--f-sans);
  font-size: 13px;
  letter-spacing: 0.02em;
  opacity: 0;
  pointer-events: none;
  z-index: 1000;
  transition: opacity 200ms var(--ease),
              transform 200ms var(--ease);
}
.auth-toast--show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Divider ── */

.auth-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  padding: 1.8rem 0 1.4rem;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.4em;
  color: var(--gold-dim);
  opacity: 0.7;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--line), transparent);
}

/* ── Footer link ── */

.auth-card__footer {
  text-align: center;
  font-family: var(--f-sans);
  font-size: 14px;
  color: var(--text-2);
}
.auth-card__footer a {
  color: var(--gold);
  text-decoration: none;
  border-bottom: 1px dotted var(--gold-dim);
  transition: color var(--t) var(--ease),
              border-color var(--t) var(--ease);
}
.auth-card__footer a:hover {
  color: var(--gold-2);
  border-color: var(--gold);
}

/* ── Responsive ── */

@media (max-width: 768px) {
  .auth-wrapper { padding: 56px 16px 72px; }
  .auth-card    { padding: 44px 28px 32px; }
}

@media (max-width: 480px) {
  .auth-card           { padding: 36px 20px 28px; }
  .auth-card__title    { font-size: 1.65rem; }
  /* Audit P1-B: keep 12px floor on mobile too. */
  .auth-card__subtitle { font-size: 12px; letter-spacing: 0.26em; }
  .social-auth-row     { gap: 6px; }
  .social-btn          { padding: 10px 0; }
  .social-btn__icon    { width: 16px; height: 16px; }
}
