/* ---------- Auth page shell ---------- */
#login-app {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}
.auth-topbar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 2.5rem;
}
.auth-logo img {
  height: 42px;
  width: auto;
  display: block;
}
.auth-back {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: color var(--tr);
}
.auth-back:hover { color: var(--white); }

.auth-page {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem 3rem;
  flex: 1 0 auto;
}

/* ---------- Split card ---------- */
.auth-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  max-width: 1000px;
  border-radius: 22px;
  overflow: hidden;
  background: #0e0b1f;
  border: 1px solid rgba(168,85,247,0.18);
  box-shadow: 0 24px 70px rgba(0,0,0,0.5);
}

.auth-form-side {
  padding: 2.6rem 2.4rem;
  display: flex;
  align-items: center;
}
.auth-form-inner { width: 100%; }

.auth-mark {
  display: flex;
  justify-content: center;
  margin-bottom: 1.1rem;
}
.auth-mark img { height: 46px; width: auto; display: block; }

.auth-title {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-align: center;
  margin-bottom: 0.4rem;
}
.auth-sub {
  font-size: 0.92rem;
  color: var(--muted);
  text-align: center;
  margin-bottom: 1.5rem;
}

/* ---------- Tabs ---------- */
.auth-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.28rem;
  border-radius: 999px;
  background: rgba(124,58,237,0.08);
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
}
.auth-tabs button {
  flex: 1;
  padding: 0.55rem 1rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--stardust);
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--tr), color var(--tr);
}
.auth-tabs button.active {
  background: linear-gradient(100deg, var(--purple), var(--violet));
  color: #fff;
}

/* ---------- Fields ---------- */
.auth-fields { display: flex; flex-direction: column; gap: 0.9rem; }
.auth-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.auth-group { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.auth-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--stardust);
}
.auth-group input,
.auth-group select {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  background: rgba(124,58,237,0.06);
  border: 1px solid var(--border);
  color: var(--white);
  font-family: var(--font);
  font-size: 0.92rem;
  transition: border-color var(--tr), background var(--tr);
}
.auth-group input::placeholder { color: rgba(200,190,225,0.4); }
.auth-group input:focus,
.auth-group select:focus {
  outline: none;
  border-color: var(--violet);
  background: rgba(124,58,237,0.12);
}
.auth-group input.err,
.auth-group select.err { border-color: #f87171; }
.auth-group select.placeholder-selected { color: rgba(200,190,225,0.45); }
.auth-group select option { background: #14102c; color: var(--white); }

.auth-err {
  font-size: 0.76rem;
  color: #f87171;
  line-height: 1.4;
}

.auth-tos {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
}
.auth-tos input { margin-top: 0.15rem; accent-color: var(--violet); flex-shrink: 0; }
.auth-tos a { color: var(--violet); text-decoration: none; }
.auth-tos a:hover { text-decoration: underline; }

.auth-forgot { text-align: right; }
.auth-forgot a {
  font-size: 0.8rem;
  color: var(--violet);
  text-decoration: none;
}

/* ---------- Buttons ---------- */
.auth-submit {
  width: 100%;
  padding: 0.8rem 1.2rem;
  margin-top: 0.3rem;
  border: none;
  border-radius: 10px;
  background: linear-gradient(100deg, var(--purple), var(--violet));
  color: #fff;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform var(--tr), opacity var(--tr);
}
.auth-submit:hover:not(:disabled) { transform: translateY(-1px); }
.auth-submit:disabled { opacity: 0.6; cursor: not-allowed; }
.auth-submit-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  margin-top: 1.4rem;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin: 1.3rem 0 1rem;
  color: var(--muted);
  font-size: 0.8rem;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-social {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.75rem 1.2rem;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--white);
  font-family: var(--font);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--tr), border-color var(--tr), transform var(--tr);
}
.auth-social:hover:not(:disabled) {
  background: rgba(255,255,255,0.08);
  border-color: var(--violet);
  transform: translateY(-1px);
}
.auth-social:disabled { opacity: 0.6; cursor: not-allowed; }

.auth-switch {
  margin-top: 1.3rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}
.auth-switch a {
  color: var(--violet);
  font-weight: 600;
  text-decoration: none;
}
.auth-switch a:hover { text-decoration: underline; }

/* ---------- Success state ---------- */
.auth-success { text-align: center; padding: 1rem 0; }
.auth-success-icon {
  width: 60px; height: 60px;
  margin: 0 auto 1.1rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--glow);
  background: rgba(124,58,237,0.14);
  border: 1px solid rgba(168,85,247,0.35);
}
.auth-success h1 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}
.auth-success p {
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.7;
}

/* ---------- Visual panel ---------- */
.auth-visual {
  position: relative;
  min-height: 100%;
  background:
    radial-gradient(ellipse 75% 60% at 60% 25%, rgba(168,85,247,0.38), transparent 62%),
    linear-gradient(135deg, #1c1450 0%, #0b0818 100%);
}
.auth-visual-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2.8rem 2.2rem;
  pointer-events: none;
}
.auth-visual-overlay h2 {
  font-size: clamp(1.3rem, 2.2vw, 1.8rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.3;
  text-align: center;
  max-width: 18ch;
  text-shadow: 0 2px 18px rgba(0,0,0,0.5);
}

/* ---------- Password field extras ---------- */
.auth-input-wrap { position: relative; display: block; }
.auth-input-wrap input { padding-right: 2.6rem; }
.auth-eye {
  position: absolute;
  top: 50%;
  right: 0.55rem;
  transform: translateY(-50%);
  width: 30px; height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color var(--tr), background var(--tr);
}
.auth-eye:hover { color: var(--white); background: rgba(124,58,237,0.16); }

.auth-strength { display: flex; align-items: center; gap: 0.7rem; }
.auth-strength-bar { display: flex; gap: 4px; flex: 1; }
.auth-strength-seg {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(168,85,247,0.16);
  transition: background var(--tr);
}
.auth-strength-seg.on.weak { background: #f87171; }
.auth-strength-seg.on.fair { background: #fbbf24; }
.auth-strength-seg.on.good { background: #a855f7; }
.auth-strength-seg.on.strong { background: #34d399; }
.auth-strength-label {
  font-size: 0.75rem;
  font-weight: 700;
  min-width: 3.4em;
  text-align: right;
}
.auth-strength-label.weak { color: #f87171; }
.auth-strength-label.fair { color: #fbbf24; }
.auth-strength-label.good { color: var(--violet); }
.auth-strength-label.strong { color: #34d399; }

.auth-reqs {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-size: 0.72rem;
}
.auth-reqs li {
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(124,58,237,0.08);
  border: 1px solid var(--border);
  transition: color var(--tr), background var(--tr), border-color var(--tr);
}
.auth-reqs li.ok {
  color: #34d399;
  background: rgba(52,211,153,0.1);
  border-color: rgba(52,211,153,0.35);
}

/* ---------- Register mode: compact so the form fits the viewport ---------- */
.auth-card.is-register .auth-mark { margin-bottom: 0.7rem; }
.auth-card.is-register .auth-mark img { height: 38px; }
.auth-card.is-register .auth-title { font-size: 1.4rem; }
.auth-card.is-register .auth-sub { margin-bottom: 1rem; font-size: 0.86rem; }
.auth-card.is-register .auth-tabs { margin-bottom: 1rem; }
.auth-card.is-register .auth-fields { gap: 0.7rem; }
.auth-card.is-register .auth-form-side { padding: 1.8rem 2.2rem; }
.auth-card.is-register .auth-divider { margin: 1rem 0 0.85rem; }
.auth-card.is-register .auth-switch { margin-top: 1rem; }

/* If the form is taller than the screen, scroll inside the card rather than
   letting the page run away. */
.auth-form-side {
  max-height: none;
  overflow-y: visible;
}
/* ---------- Footer on the auth page ---------- */
#login-app .site-footer {
  flex-shrink: 0;
  width: 100%;
}

/* ---------- Responsive ---------- */

/* Large desktops — let the card breathe */
@media (min-width: 1400px) {
  .auth-card { max-width: 1120px; }
  .auth-form-side { padding: 3rem 3rem; }
}

/* Small laptops / large tablets */
@media (max-width: 1100px) {
  .auth-card { max-width: 900px; }
  .auth-form-side { padding: 2.2rem 2rem; }
}

/* Tablet portrait — drop the visual panel, single column */
@media (max-width: 900px) {
  .auth-card { grid-template-columns: 1fr; max-width: 560px; }
  .auth-visual { display: none; }
  .auth-form-side { padding: 2rem 1.8rem; }
  .auth-card.is-register .auth-form-side { padding: 1.6rem 1.4rem; }
}

/* Large phones */
@media (max-width: 600px) {
  .auth-topbar { padding: 0.9rem 1.25rem; }
  .auth-logo img { height: 34px; }
  .auth-page { padding: 1rem 1rem 3rem; min-height: 0; }
  .auth-card { border-radius: 18px; }
  .auth-form-side { padding: 1.6rem 1.2rem; }
  .auth-row { grid-template-columns: 1fr; }
  .auth-title { font-size: 1.4rem; }
  .auth-sub { font-size: 0.87rem; }
}

/* Small phones */
@media (max-width: 400px) {
  .auth-form-side { padding: 1.3rem 1rem; }
  .auth-title { font-size: 1.25rem; }
  .auth-mark img { height: 38px; }
  .auth-tabs button { font-size: 0.82rem; padding: 0.5rem 0.6rem; }
  .auth-group input, .auth-group select { font-size: 0.9rem; padding: 0.65rem 0.8rem; }
  .auth-back { font-size: 0.8rem; }
}

/* Landscape phones / short viewports — stop the card being taller than screen */
@media (max-height: 640px) and (orientation: landscape) {
  .auth-page { min-height: 0; padding: 1rem 1rem 2rem; align-items: flex-start; }
  .auth-mark { margin-bottom: 0.6rem; }
  .auth-mark img { height: 34px; }
  .auth-title { font-size: 1.25rem; }
  .auth-sub { margin-bottom: 1rem; }
  .auth-tabs { margin-bottom: 1rem; }
}

/* Prevent iOS zoom-on-focus (needs >=16px) while keeping the visual size */
@media (max-width: 768px) {
  .auth-group input,
  .auth-group select { font-size: 16px; }
}

/* Touch devices — comfortable targets, no sticky hover transforms */
@media (hover: none) {
  .auth-submit, .auth-social, .auth-tabs button { min-height: 44px; }
  .auth-eye { width: 36px; height: 36px; }
  .auth-tos input { width: 18px; height: 18px; }
  .auth-submit:hover, .auth-social:hover { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-submit, .auth-social, .auth-eye, .auth-strength-seg { transition: none; }
}
