/* ═══════════════════════════════════════════════════════════
   auth.css  —  Cosmos auth pages (login, register, forgot, reset)
   Place at: public/css/auth.css
═══════════════════════════════════════════════════════════ */

/* ── Tokens ──────────────────────────────────────────────── */
:root {
  --bg:       #0a0a0b;
  --bg2:      #111113;
  --bg3:      #18181c;
  --surface:  #1e1e24;
  --surface2: #26262e;
  --border:   rgba(255,255,255,0.07);
  --border2:  rgba(255,255,255,0.13);
  --border3:  rgba(255,255,255,0.20);
  --text:     #f0ede8;
  --text2:    #a09a90;
  --text3:    #6b6560;
  --accent:      #e8c547;
  --accent2:     #d4a843;
  --accent-glow: rgba(232,197,71,0.18);
  --accent-glow2:rgba(232,197,71,0.08);
  --green:    #4ecb71;
  --green-bg: rgba(78,203,113,0.1);
  --red:      #ef4444;
  --red-bg:   rgba(239,68,68,0.1);
  --red-border:rgba(239,68,68,0.28);
  --blue:     #3b82f6;
  --orange:   #f97316;

  --radius:    5px;
  --radius-lg: 12px;
  --radius-xl: 18px;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
  --font-mono:    'DM Mono', 'Courier New', monospace;
  --trans: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a    { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; color: inherit; }
input  { font-family: inherit; }
[x-cloak] { display: none !important; }

/* ── Animations ──────────────────────────────────────────── */
@keyframes grain {
  0%,100% { transform: translate(0,0); }
  10%      { transform: translate(-2%,-3%); }
  30%      { transform: translate(3%,-1%); }
  50%      { transform: translate(-1%, 2%); }
  70%      { transform: translate(2%, 3%); }
  90%      { transform: translate(-3%, 1%); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ═══════════════════════════════════════════════════════════
   PAGE SHELL
═══════════════════════════════════════════════════════════ */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Animated grain overlay */
.auth-page::before {
  content: '';
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none; opacity: 0.4;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='.04'/%3E%3C/svg%3E");
  animation: grain 8s steps(10) infinite;
}

/* Radial glow behind the card */
.auth-page::after {
  content: '';
  position: fixed;
  top: 0; left: 50%;
  width: 700px; height: 500px;
  transform: translate(-50%, -30%);
  background: radial-gradient(ellipse at center,
    rgba(232,197,71,0.07) 0%,
    transparent 65%
  );
  pointer-events: none; z-index: 0;
}

/* ─────────────────────────────────────────────────────────
   TOP NAV BAR
───────────────────────────────────────────────────────── */
.auth-topbar {
  position: relative; z-index: 10;
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.auth-logo {
  display: flex; align-items: center; gap: 10px;
}
.auth-logo__icon {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 16px; font-weight: 900;
  color: var(--bg);
  box-shadow: 0 0 22px var(--accent-glow);
  flex-shrink: 0;
}
.auth-logo__text { display: flex; flex-direction: column; line-height: 1; }
.auth-logo__name { font-family: var(--font-display); font-size: 17px; font-weight: 700; }
.auth-logo__sub  { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: .14em; margin-top: 2px; }

.auth-topbar__link {
  font-size: 13px; font-weight: 600; color: var(--text3);
  padding: 8px 16px; border-radius: var(--radius);
  border: 1px solid var(--border2); background: var(--surface);
  transition: all var(--trans);
}
.auth-topbar__link:hover { color: var(--text); border-color: var(--border3); }

/* ─────────────────────────────────────────────────────────
   MAIN — centres the card
───────────────────────────────────────────────────────── */
.auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 24px 60px;
  position: relative; z-index: 1;
}

/* ─────────────────────────────────────────────────────────
   CARD
───────────────────────────────────────────────────────── */
.auth-card {
  width: 100%; max-width: 440px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-xl);
  padding: 40px 40px 36px;
  box-shadow:
    0 0 0 1px var(--border),
    0 24px 60px rgba(0,0,0,0.5),
    0 0 80px rgba(232,197,71,0.04);
  animation: fadeUp 0.4s cubic-bezier(0.4,0,0.2,1) both;
}

/* Card header */
.auth-card__head { margin-bottom: 28px; }
.auth-card__eyebrow {
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--accent); margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.auth-card__eyebrow::before {
  content: ''; display: block;
  width: 18px; height: 2px;
  background: var(--accent); border-radius: 1px;
}
.auth-card__title {
  font-family: var(--font-display);
  font-size: 28px; font-weight: 900;
  letter-spacing: -.6px; line-height: 1.12;
  color: var(--text);
  margin-bottom: 8px;
}
.auth-card__title em { font-style: italic; color: var(--accent); }
.auth-card__sub {
  font-size: 14px; color: var(--text2); line-height: 1.6;
}

/* ─────────────────────────────────────────────────────────
   OAUTH BUTTONS
───────────────────────────────────────────────────────── */
.oauth-group { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }

.oauth-btn {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  font-size: 14px; font-weight: 600; color: var(--text2);
  transition: all var(--trans);
}
.oauth-btn:hover { border-color: var(--border3); color: var(--text); background: var(--surface2); transform: translateY(-1px); }
.oauth-btn__icon {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.oauth-btn__icon--google { background: #fff; }
.oauth-btn__icon--github { background: #24292e; }
.oauth-btn__text { flex: 1; text-align: left; }
.oauth-btn__arrow { font-size: 12px; color: var(--text3); }

/* Divider */
.auth-divider {
  display: flex; align-items: center; gap: 14px;
  margin: 0 0 24px;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text3); text-transform: uppercase; letter-spacing: .1em;
}
.auth-divider::before,
.auth-divider::after {
  content: ''; flex: 1;
  height: 1px; background: var(--border2);
}

/* ─────────────────────────────────────────────────────────
   FORM
───────────────────────────────────────────────────────── */
.auth-form { display: flex; flex-direction: column; gap: 16px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em; color: var(--text3);
  display: flex; align-items: center; justify-content: space-between;
}
.form-label a { color: var(--accent); font-weight: 600; text-transform: none; letter-spacing: 0; font-family: var(--font-body); font-size: 12px; transition: opacity var(--trans); }
.form-label a:hover { opacity: .8; }

.form-input-wrap { position: relative; }

.form-input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 13px 16px;
  font-size: 15px; color: var(--text);
  outline: none;
  transition: border-color var(--trans), box-shadow var(--trans), background var(--trans);
  display: block;
}
.form-input:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-glow2);
}
.form-input::placeholder { color: var(--text3); }
.form-input.error { border-color: var(--red); }
.form-input.error:focus { box-shadow: 0 0 0 3px var(--red-bg); }

/* Password toggle eye button */
.pw-toggle {
  position: absolute; right: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--text3); font-size: 16px;
  padding: 4px; transition: color var(--trans);
  line-height: 1;
}
.pw-toggle:hover { color: var(--text2); }

/* Prefix slot (e.g. "cosmos.io/@" for username) */
.input-prefix-wrap { display: flex; align-items: stretch; }
.input-prefix {
  background: var(--surface2);
  border: 1px solid var(--border2); border-right: none;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  padding: 13px 13px;
  font-family: var(--font-mono); font-size: 12px; color: var(--text3);
  white-space: nowrap; display: flex; align-items: center;
}
.input-prefix + .form-input { border-radius: 0 var(--radius-lg) var(--radius-lg) 0; }
.input-prefix-wrap:focus-within .input-prefix { border-color: var(--accent); }

/* Field error message */
.form-error {
  font-size: 12px; color: var(--red);
  display: flex; align-items: center; gap: 5px;
  padding: 8px 12px; border-radius: var(--radius);
  background: var(--red-bg); border: 1px solid var(--red-border);
  animation: fadeUp .15s ease both;
}

/* Password strength bar */
.pw-strength { margin-top: 6px; }
.pw-strength__bar {
  height: 3px; border-radius: 2px;
  background: var(--surface2);
  overflow: hidden;
}
.pw-strength__fill {
  height: 100%; border-radius: 2px;
  transition: width .3s ease, background .3s ease;
}
.pw-strength__label {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--text3); margin-top: 4px; text-align: right;
}

/* ─────────────────────────────────────────────────────────
   REMEMBER + TERMS ROW
───────────────────────────────────────────────────────── */
.form-check {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 13px; color: var(--text2); cursor: pointer;
}
.form-check input[type="checkbox"] {
  width: 16px; height: 16px; margin-top: 2px;
  accent-color: var(--accent); cursor: pointer; flex-shrink: 0;
}
.form-check a { color: var(--accent); border-bottom: 1px solid transparent; transition: border-color var(--trans); }
.form-check a:hover { border-color: var(--accent); }

/* ─────────────────────────────────────────────────────────
   SUBMIT BUTTON
───────────────────────────────────────────────────────── */
.btn-auth {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: var(--accent);
  color: var(--bg);
  font-size: 15px; font-weight: 700;
  letter-spacing: .01em;
  transition: all var(--trans);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  position: relative; overflow: hidden;
  margin-top: 4px;
}
.btn-auth:hover:not(:disabled) {
  background: var(--accent2);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(232,197,71,0.3);
}
.btn-auth:active { transform: translateY(0); }
.btn-auth:disabled {
  opacity: .6; cursor: not-allowed; transform: none;
}
/* Shimmer on hover */
.btn-auth::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.12) 50%, transparent 100%);
  background-size: 200% 100%;
  opacity: 0; transition: opacity .2s;
}
.btn-auth:hover::after { opacity: 1; animation: shimmer 1s ease infinite; }

/* Spinner inside button */
.btn-spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(10,10,11,0.3);
  border-top-color: var(--bg);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* ─────────────────────────────────────────────────────────
   CARD FOOTER (switch link)
───────────────────────────────────────────────────────── */
.auth-card__footer {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 14px; color: var(--text3);
}
.auth-card__footer a {
  color: var(--accent); font-weight: 600;
  transition: opacity var(--trans);
}
.auth-card__footer a:hover { opacity: .8; }

/* ─────────────────────────────────────────────────────────
   ALERT BANNERS (flash messages)
───────────────────────────────────────────────────────── */
.auth-alert {
  padding: 12px 16px; border-radius: var(--radius-lg);
  font-size: 13px; line-height: 1.55;
  display: flex; align-items: flex-start; gap: 10px;
  animation: fadeUp .2s ease both;
}
.auth-alert__icon { font-size: 15px; flex-shrink: 0; margin-top: 1px; }
.auth-alert--success { background: var(--green-bg); border: 1px solid rgba(78,203,113,0.3); color: var(--green); }
.auth-alert--error   { background: var(--red-bg);   border: 1px solid var(--red-border);    color: var(--red); }
.auth-alert--info    { background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.3); color: var(--blue); }

/* ─────────────────────────────────────────────────────────
   TRUST BADGES ROW (below card)
───────────────────────────────────────────────────────── */
.auth-trust {
  display: flex; align-items: center; justify-content: center;
  gap: 20px; flex-wrap: wrap;
  padding: 16px 24px 32px;
  position: relative; z-index: 1;
}
.auth-trust__item {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 11px; color: var(--text3);
}
.auth-trust__item span:first-child { font-size: 13px; }

/* ─────────────────────────────────────────────────────────
   VERIFY EMAIL PAGE (special layout)
───────────────────────────────────────────────────────── */
.verify-icon {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--accent-glow);
  border: 2px solid rgba(232,197,71,0.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; margin: 0 auto 24px;
}

/* ─────────────────────────────────────────────────────────
   RESPONSIVE
───────────────────────────────────────────────────────── */
@media (max-width: 520px) {
  .auth-topbar { padding: 16px; }
  .auth-card   { padding: 28px 22px 24px; border-radius: var(--radius-lg); }
  .auth-card__title { font-size: 24px; }
  .form-input  { padding: 12px 14px; font-size: 14px; }
  .btn-auth    { padding: 13px; font-size: 14px; }
}
