/* ============================================================
   YouGen — Auth surface (login / register / affiliate register)
   Direction: "Violet aurora split"
   Brand panel (deep violet aurora) + calm, hairline form panel.
   Self-contained: does NOT rely on css/dark-mode.css.
   ============================================================ */

.auth-page {
  /* Light theme tokens — brand = fox orange from the YouGen logo */
  --a-bg: #f7f4f1;
  --a-surface: #ffffff;
  --a-text: #1f1a16;
  --a-muted: #6f675f;
  --a-border: #ece3dc;
  --a-accent: #c2410c;
  --a-accent-bright: #f26522;
  --a-focus: rgba(234, 88, 12, 0.22);
  --a-danger: #dc2626;  --a-danger-bg: #fef2f2;  --a-danger-border: #fec9c9;
  --a-success: #15803d; --a-success-bg: #f0fdf4; --a-success-border: #bbf7d0;
  --a-info: #9a3412;    --a-info-bg: #fff7ed;    --a-info-border: #fed7aa;
  --a-warn: #b45309;    --a-warn-bg: #fffbeb;    --a-warn-border: #fde68a;

  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  background-color: var(--a-bg);
  color: var(--a-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Keep the running-text ticker in flow so it never covers the auth surface. */
.auth-page .running-text-container.running-text-fixed { position: static; }

/* ---------- Shell ---------- */
.auth-shell {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(340px, 1.02fr) 1fr;
  min-height: 100%;
}

/* ---------- Brand panel ---------- */
.auth-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  padding: 48px 52px;
  color: #fff;
  background:
    radial-gradient(120% 90% at 12% 6%, rgba(242, 101, 34, 0.5) 0%, transparent 55%),
    radial-gradient(130% 130% at 92% 100%, rgba(124, 45, 18, 0.85) 0%, transparent 62%),
    linear-gradient(160deg, #1a0f08 0%, #2a1409 45%, #3b1a0a 100%);
}
.auth-brand::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.45;
  pointer-events: none;
}
.auth-brand > * { position: relative; z-index: 1; }

.auth-brand-top { display: flex; flex-direction: column; gap: 26px; }

.auth-brand-head { display: flex; align-items: center; gap: 14px; }
.auth-brand-head .auth-spacer { flex: 1 1 auto; }
.auth-logo {
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  border-radius: 16px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.14);
  padding: 8px;
}
.auth-wordmark { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }

.auth-tagline {
  margin: 0;
  max-width: 34ch;
  font-size: 1.06rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.84);
}
.auth-features { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.auth-features li { display: flex; align-items: center; gap: 13px; font-size: 0.94rem; color: rgba(255, 255, 255, 0.94); }
.auth-features i {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.auth-brand-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.62);
}
.auth-brand-foot .version-badge { color: rgba(255, 255, 255, 0.7); }

/* ---------- Form panel ---------- */
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 28px; }
.auth-card { width: 100%; max-width: 432px; }

.auth-card-head { margin-bottom: 26px; }
.auth-card-head h1 {
  margin: 0 0 8px;
  font-size: 1.72rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--a-text);
}
.auth-card-head p { margin: 0; color: var(--a-muted); font-size: 0.95rem; line-height: 1.5; }

.auth-card-foot { margin-top: 24px; text-align: center; font-size: 0.9rem; color: var(--a-muted); }
.auth-card-foot p { margin: 0; }
.auth-card-foot a,
.auth-page .auth-alt-action a { color: var(--a-accent); font-weight: 600; text-decoration: none; }
.auth-card-foot a:hover,
.auth-page .auth-alt-action a:hover { text-decoration: underline; }

/* ---------- Fields ---------- */
.form-group { margin-bottom: 16px; }
.auth-page label { display: block; margin-bottom: 6px; font-size: 0.85rem; font-weight: 600; color: var(--a-text); }
.auth-page .auth-alt-action {
  margin-top: 14px;
  text-align: center;
  font-size: 0.9rem;
}
.auth-page .form-control {
  display: block;
  width: 100%;
  padding: 0.64rem 0.85rem;
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--a-text);
  background-color: var(--a-surface);
  border: 1px solid var(--a-border);
  border-radius: 10px;
  box-shadow: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.auth-page .form-control::placeholder { color: #a8a3c0; }
.auth-page .form-control:focus {
  outline: none;
  border-color: var(--a-accent);
  box-shadow: 0 0 0 4px var(--a-focus);
  background-color: var(--a-surface);
  color: var(--a-text);
}
.auth-page .form-control:disabled,
.auth-page .form-control[readonly] { opacity: 0.6; cursor: not-allowed; }
.auth-page small,
.auth-page .text-muted { color: var(--a-muted) !important; }
.auth-page small { font-size: 0.78rem; }
.auth-page .text-success { color: var(--a-success) !important; }
.auth-page .text-danger { color: var(--a-danger) !important; }

/* Keyboard focus ring — visible on every interactive control. */
.auth-page a:focus-visible,
.auth-page button:focus-visible,
.auth-page .form-control:focus-visible,
.auth-page input:focus-visible {
  outline: 2px solid var(--a-accent);
  outline-offset: 2px;
}

/* ---------- Primary button ---------- */
.btn-auth {
  display: inline-block;
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 0.74rem 1rem;
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-align: center;
  color: #fff;
  background: linear-gradient(135deg, #f26522 0%, #c2410c 100%);
  box-shadow: 0 10px 24px -12px rgba(194, 65, 12, 0.85);
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.16s ease, box-shadow 0.16s ease;
}
.btn-auth:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-auth:active { transform: translateY(0); }
.btn-auth:disabled,
.btn-auth.disabled { opacity: 0.55; cursor: not-allowed; transform: none; filter: none; box-shadow: none; }
.btn-auth i { margin-right: 8px; }

/* Outline/secondary control (affiliate coupon apply) */
.auth-page .btn-outline-secondary {
  border: 1px solid var(--a-border);
  border-radius: 10px;
  color: var(--a-text);
  background: transparent;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}
.auth-page .btn-outline-secondary:hover {
  border-color: var(--a-accent);
  background: rgba(234, 88, 12, 0.08);
  color: var(--a-accent);
}

/* Bootstrap buttons used inline (e.g. "Login Now", "Back to Admin") — keep them
   on the brand accent so the surface stays one world. */
.auth-page .btn-primary {
  background: var(--a-accent);
  border-color: var(--a-accent);
  color: #fff;
  border-radius: 10px;
}
.auth-page .btn-primary:hover,
.auth-page .btn-primary:focus {
  background: var(--a-accent);
  border-color: var(--a-accent);
  color: #fff;
  filter: brightness(1.06);
}
.auth-page .btn-outline-primary {
  color: var(--a-accent);
  border-color: var(--a-accent);
  border-radius: 10px;
}
.auth-page .btn-outline-primary:hover {
  background: var(--a-accent);
  border-color: var(--a-accent);
  color: #fff;
}

/* Join an input with its trailing button cleanly (affiliate coupon). */
.auth-page .input-group .form-control:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.auth-page .input-group .btn:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.auth-page .input-group .btn { white-space: nowrap; }

/* ---------- Alerts ---------- */
.auth-page .alert {
  border-radius: 12px;
  border: 1px solid var(--a-border);
  padding: 12px 14px;
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 16px;
  background: var(--a-surface);
  color: var(--a-text);
}
.auth-page .alert h4,
.auth-page .alert h5 { font-size: 0.97rem; font-weight: 700; margin: 0 0 4px; color: inherit; }
.auth-page .alert p { margin: 0 0 4px; color: inherit; }
.auth-page .alert p:last-child { margin-bottom: 0; }
.auth-page .alert hr { border: 0; border-top: 1px solid currentColor; opacity: 0.18; margin: 10px 0; }
.auth-page .alert-danger  { background: var(--a-danger-bg);  border-color: var(--a-danger-border);  color: var(--a-danger); }
.auth-page .alert-success { background: var(--a-success-bg); border-color: var(--a-success-border); color: var(--a-success); }
.auth-page .alert-info    { background: var(--a-info-bg);    border-color: var(--a-info-border);    color: var(--a-info); }
.auth-page .alert-warning { background: var(--a-warn-bg);    border-color: var(--a-warn-border);    color: var(--a-warn); }
.auth-page .alert code { background: rgba(0, 0, 0, 0.06); padding: 1px 5px; border-radius: 6px; color: inherit; }
.auth-page .btn-close { opacity: 0.5; }

/* ---------- Dark theme ---------- */
body.dark-mode.auth-page {
  --a-bg: #100c09;
  --a-surface: #1a1410;
  --a-text: #f3ece7;
  --a-muted: #a89c92;
  --a-border: #302621;
  --a-accent: #ff8a4c;
  --a-accent-bright: #ff9d66;
  --a-focus: rgba(255, 138, 76, 0.26);
  --a-danger: #fca5a5;  --a-danger-bg: rgba(220, 38, 38, 0.12);  --a-danger-border: rgba(248, 113, 113, 0.34);
  --a-success: #86efac; --a-success-bg: rgba(22, 163, 74, 0.14); --a-success-border: rgba(74, 222, 128, 0.32);
  --a-info: #fdba74;    --a-info-bg: rgba(234, 88, 12, 0.14);    --a-info-border: rgba(251, 146, 60, 0.32);
  --a-warn: #fcd34d;    --a-warn-bg: rgba(217, 119, 6, 0.14);    --a-warn-border: rgba(251, 191, 36, 0.3);
}
body.dark-mode.auth-page .form-control::placeholder { color: #7a6d63; }
body.dark-mode.auth-page .alert code { background: rgba(255, 255, 255, 0.08); }

/* ---------- Theme toggle ---------- */
.auth-page .dm-toggle {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 11px;
  cursor: pointer;
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  transition: background 0.16s ease, transform 0.12s ease;
}
.auth-page .dm-toggle:hover { background: rgba(255, 255, 255, 0.28); }
.auth-page .dm-toggle:active { transform: scale(0.95); }

/* ---------- Affiliate helpers ---------- */
.aff-banner {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  background: rgba(242, 101, 34, 0.08);
  border: 1px solid rgba(242, 101, 34, 0.26);
}
.aff-banner .who { font-weight: 700; color: var(--a-accent); }
body.dark-mode.auth-page .aff-banner { background: rgba(242, 101, 34, 0.12); border-color: rgba(242, 101, 34, 0.34); }

.price-box {
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
  background: var(--a-surface);
  border: 1px solid var(--a-border);
}
.price-box .total { font-size: 1.55rem; font-weight: 800; letter-spacing: -0.02em; color: var(--a-accent); }
.price-box .strike { text-decoration: line-through; color: var(--a-muted); font-size: 1rem; font-weight: 600; }
.price-box .pkg-name { font-weight: 600; }

/* ---------- Version ---------- */
.version-badge { font-size: 0.78rem; letter-spacing: 0.02em; color: var(--a-muted); }

/* ---------- Entrance motion ---------- */
@keyframes authRise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.auth-card { animation: authRise 0.42s cubic-bezier(0.22, 0.61, 0.36, 1) both; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { padding: 22px 22px 20px; gap: 16px; }
  .auth-brand-top { gap: 0; }
  .auth-tagline,
  .auth-features { display: none; }
  .auth-panel { padding: 30px 20px 44px; }
  .auth-brand-foot { font-size: 0.76rem; }
}
@media (max-width: 480px) {
  .auth-card-head h1 { font-size: 1.45rem; }
  .auth-page .form-control { font-size: 1rem; } /* prevent iOS zoom-on-focus */
}

@media (prefers-reduced-motion: reduce) {
  .auth-card { animation: none; }
  .btn-auth,
  .auth-page .dm-toggle { transition: none; }
}

/* ---------- Floating Telegram help button (same as the YouGen app) ---------- */
.telegram-float {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #0088cc;
  color: #fff !important;
  padding: 10px 18px 10px 14px;
  border-radius: 50px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 4px 14px rgba(0, 136, 204, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.telegram-float:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0, 136, 204, 0.5); color: #fff !important; }
.telegram-float i { font-size: 20px; }
@media (max-width: 576px) {
  .telegram-float { bottom: 16px; right: 16px; padding: 8px 14px 8px 10px; font-size: 12px; }
  .telegram-float i { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { .telegram-float { transition: none; } }
