/* ===================================================================
   ACCOUNT PAGE — login / register, one page, two tabs.
   Built on the site's existing tokens (--accent*, --liquid-glass-*,
   --page-bg, --text, --muted from style.css) so light/dark mode and the
   language switcher work identically to the rest of the site. The only
   new things here are page-specific layout, the 3D tilt/tab mechanics,
   and the password-field micro-interactions.
   =================================================================== */

:root {
  --ease-out-strong: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out-strong: cubic-bezier(0.77, 0, 0.175, 1);
}

html, body.account-body {
  height: 100%;
  overflow: hidden; /* this page is a single immersive stage, not a scroll page */
}

.account-body {
  background: var(--page-bg);
  position: relative;
}

/* ---- 3D canvas background ---------------------------------------------- */
.account-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
}

/* ---- chrome: back link + theme/lang controls --------------------------- */
.account-back {
  position: fixed;
  top: 22px;
  inset-inline-start: 24px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px 9px 12px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--liquid-glass-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  transition: transform .3s var(--ease-out-strong), border-color .3s;
}
html[dir="rtl"] .account-back svg { transform: rotate(180deg); }
.account-back:hover { transform: translateY(-2px); border-color: var(--liquid-glass-border-hover); }
.account-back svg { width: 16px; height: 16px; }

.account-pref-bar.pref-bar { top: 20px; inset-inline-end: 24px; inset-inline-start: auto; left: auto; transform: none; }

/* ---- stage / layout ----------------------------------------------------- */
.account-stage {
  position: relative;
  z-index: 5;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 100px 20px 40px;
}

.account-card-wrap {
  perspective: 1400px;
  width: 100%;
  max-width: 460px;
}

.account-card {
  position: relative;
  padding: 40px 36px 34px;
  border-radius: 28px;
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform .6s var(--ease-out-strong), box-shadow .6s var(--ease-out-strong);
  animation: cardEnter 1s var(--ease-out-strong) both;
}

@keyframes cardEnter {
  from { opacity: 0; transform: translateY(28px) rotateX(-8deg) scale(.96); }
  to   { opacity: 1; transform: translateY(0) rotateX(0) scale(1); }
}

.account-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 22px;
  transform: translateZ(40px);
}
.account-brand img {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  box-shadow: 0 10px 30px -8px rgba(93, 139, 255, .55);
}

/* ---- tab switcher (sliding pill, same language as bottom-nav/lang-switch) */
.account-tabs {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 5px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .18);
  border: 1px solid var(--glass-border);
  margin-bottom: 28px;
  transform: translateZ(30px);
}
[data-theme="light"] .account-tabs { background: rgba(0, 0, 0, .05); }

.account-tabs__indicator {
  position: absolute;
  top: 5px;
  bottom: 5px;
  inset-inline-start: 5px;
  width: calc(50% - 5px);
  border-radius: 999px;
  background: var(--grad);
  box-shadow: 0 6px 18px -4px rgba(93, 139, 255, .6);
  transition: transform .45s var(--ease-out-strong);
}
.account-tabs__btn[data-tab="register"].is-active ~ .account-tabs__indicator,
.account-tabs:has(.account-tabs__btn[data-tab="register"].is-active) .account-tabs__indicator {
  transform: translateX(100%);
}
html[dir="rtl"] .account-tabs:has(.account-tabs__btn[data-tab="register"].is-active) .account-tabs__indicator {
  transform: translateX(-100%);
}

.account-tabs__btn {
  position: relative;
  z-index: 1;
  padding: 10px 0;
  border-radius: 999px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--muted);
  transition: color .3s;
}
.account-tabs__btn.is-active { color: #04122e; }
[data-theme="light"] .account-tabs__btn.is-active { color: #04122e; }
.account-tabs__btn:not(.is-active):hover { color: var(--text); }

/* ---- panels: only one visible/interactive at a time, 3D cross-transition */
.account-panels {
  position: relative;
  transform-style: preserve-3d;
}

.account-panel {
  transform: translateZ(20px);
}
.account-panel:not(.is-active) {
  display: none;
}

.account-panel .kicker { text-align: center; justify-content: center; display: flex; }
.account-panel h1 {
  text-align: center;
  font-size: clamp(22px, 4vw, 27px);
  font-weight: 800;
  margin: 8px 0 6px;
}
.account-sub {
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  margin: 0 0 24px;
}

.account-alert {
  background: rgba(242, 83, 107, .12);
  border: 1px solid rgba(242, 83, 107, .3);
  color: #ff9caa;
  font-size: 13px;
  padding: 11px 14px;
  border-radius: 12px;
  margin-bottom: 18px;
  text-align: center;
  animation: alertIn .4s var(--ease-out-strong);
}
@keyframes alertIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- fields --------------------------------------------------------------- */
.account-form { display: flex; flex-direction: column; gap: 16px; }

.a-field-3d { position: relative; }

.a-field-3d label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 7px;
  transition: color .25s;
}

.a-field-3d input {
  width: 100%;
  padding: 13px 16px;
  border-radius: 13px;
  background: var(--glass);
  border: 1px solid var(--liquid-glass-border);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: border-color .25s, box-shadow .25s, transform .25s var(--ease-out-strong);
}
.a-field-3d--password input { padding-inline-end: 46px; }

.a-field-3d input:hover { border-color: var(--liquid-glass-border-hover); }

.a-field-3d input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(93, 139, 255, .16);
  transform: translateY(-1px);
}
.a-field-3d:focus-within label { color: var(--accent-2); }

.a-field-3d__error {
  display: none;
  font-size: 11.5px;
  color: #ff8fa3;
  margin-top: 6px;
}
.a-field-3d.has-error input { border-color: #f2536b; }
.a-field-3d.has-error .a-field-3d__error { display: block; animation: alertIn .3s var(--ease-out-strong); }

/* Animated password visibility toggle */
.a-pw-toggle {
  position: absolute;
  inset-inline-end: 6px;
  top: 34px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  transition: color .2s, background .2s;
}
.a-pw-toggle:hover { color: var(--text); background: rgba(255, 255, 255, .06); }
.a-pw-toggle svg { width: 18px; height: 18px; position: absolute; transition: opacity .3s var(--ease-out-strong), transform .3s var(--ease-out-strong); }
.a-pw-toggle__eye-off { opacity: 0; transform: scale(.6) rotate(-20deg); }
.a-pw-toggle__eye { opacity: 1; transform: scale(1) rotate(0); }
.a-pw-toggle.is-visible .a-pw-toggle__eye { opacity: 0; transform: scale(.6) rotate(20deg); }
.a-pw-toggle.is-visible .a-pw-toggle__eye-off { opacity: 1; transform: scale(1) rotate(0); }

/* ---- submit button ------------------------------------------------------ */
.account-submit {
  margin-top: 6px;
  padding: 14px;
  border-radius: 14px;
  border: none;
  background: var(--grad);
  color: #04122e;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 16px 34px -10px rgba(93, 139, 255, .55);
  transition: transform .18s var(--ease-out-strong), box-shadow .3s, filter .2s;
  position: relative;
  overflow: hidden;
}
.account-submit:hover { filter: brightness(1.06); box-shadow: 0 20px 40px -8px rgba(93, 139, 255, .65); }
.account-submit:active { transform: scale(.98); }
.account-submit:disabled { opacity: .7; cursor: default; transform: none; }

.account-submit.is-loading span { visibility: hidden; }
.account-submit.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid rgba(4, 18, 46, .35);
  border-top-color: #04122e;
  animation: submitSpin .7s linear infinite;
}
@keyframes submitSpin { to { transform: rotate(360deg); } }

.account-switch {
  text-align: center;
  margin: 20px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}
.account-switch button {
  background: none;
  border: none;
  color: var(--accent-2);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  padding: 0 3px;
}
.account-switch button:hover { text-decoration: underline; }

/* ---- shake feedback on validation failure ------------------------------- */
@keyframes fieldShake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}
.account-form.is-shaking { animation: fieldShake .5s var(--ease-in-out-strong); }

/* ---- responsive ----------------------------------------------------------- */
@media (max-width: 520px) {
  .account-stage { padding: 84px 14px 24px; }
  .account-card { padding: 30px 22px 26px; border-radius: 24px; }
  .account-back span { display: none; }
  .account-back { padding: 10px; }
}

/* ---- accessibility -------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .account-card { animation: none; opacity: 1; }
  .account-canvas { display: none; }
  .a-field-3d input:focus { transform: none; }
  .account-submit:active { transform: none; }
}
