/* ─── Auth pages shared styles ─────────────────────────────────────────── */
/* Loaded after style.css. Page-specific vars (--aside-*, body bg) live in   */
/* a small <style> block inside each HTML file.                               */

:root {
  --auth-bg: #f3f5fa;
  --auth-surface: #ffffff;
  --auth-border: #d8e0ee;
  --auth-muted: #5b6475;
  --auth-text: #0f172a;
  --auth-primary: #b70012;
  --auth-primary-hover: #93000e;
  /* aside defaults — overridden per page */
  --aside-from: #0f172a;
  --aside-via: #172554;
  --aside-to: #1e3a8a;
  --aside-text: #e2e8f0;
  --aside-muted: #93c5fd;
  --aside-angle: 160deg;
}

body {
  min-height: 100dvh;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  color: var(--auth-text);
}

/* ─── Layout ─────────────────────────────────────────────────────────────── */
.authPage {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(360px, 560px) minmax(320px, 1fr);
}

.authAside {
  padding: clamp(28px, 5vw, 56px);
  background: linear-gradient(
    var(--aside-angle),
    var(--aside-from) 0%,
    var(--aside-via) 56%,
    var(--aside-to) 100%
  );
  color: var(--aside-text);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.authBrand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 18px;
}

.authBrand img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

.authAside h1 {
  margin: 26px 0 12px;
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1.08;
}

.authAside p {
  margin: 0;
  color: var(--aside-muted);
  font-size: 16px;
  line-height: 1.55;
  max-width: 44ch;
}

.authAsideDesc { line-height: 1.4; }
.authAsideDesc p { line-height: 1.4; }
.authAsideDesc p + p { margin-top: 1.4em; }

.authAsideMeta {
  margin-top: 28px;
  font-size: 13px;
  color: var(--aside-muted);
}

.authMain {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 3vw, 40px);
}

.loginLayout { width: min(480px, 100%); }

/* ─── Card ───────────────────────────────────────────────────────────────── */
.loginCard {
  background: var(--auth-surface);
  border: 1px solid var(--auth-border);
  border-radius: 20px;
  box-shadow: 0 22px 44px rgba(15, 23, 42, 0.12);
  padding: clamp(22px, 3vw, 34px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.loginHeader h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 34px);
  letter-spacing: -0.01em;
}

.loginHeader p {
  margin: 8px 0 0;
  color: var(--auth-muted);
  font-size: 14px;
}

/* ─── Form fields ────────────────────────────────────────────────────────── */
.loginForm {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.fieldRow {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.fieldLabelRow {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.loginForm label {
  font-size: 13px;
  font-weight: 700;
  color: var(--auth-text);
}

.loginForm input[type="text"],
.loginForm input[type="email"],
.loginForm input[type="password"] {
  width: 100%;
  min-height: 46px;
  border-radius: 12px;
  border: 1px solid #c8d2e6;
  padding: 10px 14px;
  font-size: 16px;
  font-family: inherit;
  outline: none;
  background: #fff;
  color: var(--auth-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.loginForm input:focus {
  border-color: #6478ff;
  box-shadow: 0 0 0 3px rgba(100, 120, 255, 0.15);
}

.loginForm input[aria-invalid="true"] {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

/* ─── Password wrapper with show/hide toggle ─────────────────────────────── */
.pwdWrapper { position: relative; }
.pwdWrapper input { padding-right: 44px; }

.pwdToggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--auth-muted);
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: color 0.12s;
}

.pwdToggle:hover { color: var(--auth-text); }
.pwdToggle:focus-visible { outline: 2px solid #6478ff; outline-offset: 1px; }

/* Toggle SVG icons via aria-pressed — no JS innerHTML needed */
.pwdToggle .icon-eye-off { display: none; }
.pwdToggle[aria-pressed="true"] .icon-eye { display: none; }
.pwdToggle[aria-pressed="true"] .icon-eye-off { display: block; }

/* ─── Field errors and hints ─────────────────────────────────────────────── */
.fieldError {
  font-size: 12px;
  color: #dc2626;
  line-height: 1.35;
  display: none;
}
.fieldError.visible { display: block; }

.fieldHint {
  font-size: 12px;
  color: var(--auth-muted);
  line-height: 1.35;
}

.forgotLink {
  font-size: 12px;
  color: var(--auth-muted);
  text-decoration: none;
  font-weight: 600;
}
.forgotLink:hover { color: var(--auth-primary); }

/* ─── Password strength ──────────────────────────────────────────────────── */
.pwdStrengthBar {
  height: 3px;
  border-radius: 2px;
  background: #e2e8f0;
  overflow: hidden;
}

.pwdStrengthFill {
  height: 100%;
  width: 0;
  border-radius: 2px;
  transition: width 0.25s ease, background-color 0.25s ease;
}

.pwdStrengthFill.weak   { width: 33%; background: #ef4444; }
.pwdStrengthFill.medium { width: 66%; background: #f59e0b; }
.pwdStrengthFill.strong { width: 100%; background: #22c55e; }

.pwdStrengthLabel {
  font-size: 11px;
  color: var(--auth-muted);
}
.pwdStrengthLabel.weak   { color: #ef4444; }
.pwdStrengthLabel.medium { color: #d97706; }
.pwdStrengthLabel.strong { color: #16a34a; }

/* ─── Remember me ────────────────────────────────────────────────────────── */
.rememberMe {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--auth-muted);
  cursor: pointer;
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.loginActions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.primaryBtn,
.secondaryBtn {
  width: 100%;
  min-height: 46px;
  border-radius: 12px;
  padding: 0 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease,
    transform 0.1s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.primaryBtn {
  border: none;
  background: var(--auth-primary);
  color: #fff;
}
.primaryBtn:hover:not(:disabled) { background: var(--auth-primary-hover); }
.primaryBtn:active:not(:disabled) { transform: translateY(1px); }
.primaryBtn:disabled { opacity: 0.65; cursor: not-allowed; }

.secondaryBtn {
  border: 1px solid #c8d2e6;
  background: #fff;
  color: #0f172a;
}
.secondaryBtn:hover:not(:disabled) { background: #f8fafc; border-color: #b0bcd4; }
.secondaryBtn:active:not(:disabled) { transform: translateY(1px); }

.secondaryBtn.gosuslugi {
  border-color: #0d4cd3;
  color: #0d4cd3;
}
.secondaryBtn.gosuslugi:hover:not(:disabled) { background: #f0f4ff; border-color: #0b3fae; }
.secondaryBtn.gosuslugi:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: var(--auth-border);
  color: var(--auth-muted);
}

.comingSoonBadge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 20px;
  background: #e8edf5;
  color: #7c8fa6;
  line-height: 1.6;
}

/* Spinner inside primaryBtn */
.btnSpinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: authSpin 0.6s linear infinite;
  flex-shrink: 0;
  display: none;
}
.primaryBtn.loading .btnSpinner { display: block; }
.primaryBtn.loading .btnText { opacity: 0.8; }

@keyframes authSpin {
  to { transform: rotate(360deg); }
}

/* ─── Divider ────────────────────────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #90a1bc;
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

/* ─── Footer links ───────────────────────────────────────────────────────── */
.notice {
  margin: 0;
  font-size: 12px;
  color: var(--auth-muted);
  line-height: 1.45;
}

.authLinks,
.loginFooter {
  text-align: center;
  font-size: 14px;
  color: var(--auth-muted);
}

.authLinks a,
.loginFooter a {
  color: var(--auth-primary);
  text-decoration: none;
  font-weight: 700;
}
.authLinks a:hover,
.loginFooter a:hover { text-decoration: underline; }

.authLegal {
  text-align: center;
  font-size: 12px;
}
.authLegal a {
  color: #64748b;
  text-decoration: none;
  font-weight: 700;
}
.authLegal a:hover { text-decoration: underline; }

/* ─── Status toast ───────────────────────────────────────────────────────── */
.loginStatus {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(560px, calc(100% - 24px));
  font-size: 14px;
  text-align: center;
  color: #fff;
  background: #ef4444;
  padding: 11px 16px;
  border-radius: 10px;
  display: none;
  z-index: 1200;
  animation: toastIn 0.2s ease;
}
.loginStatus.visible { display: block; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ─── Orbit scene ────────────────────────────────────────────────────────── */

.authAside { position: relative; overflow: hidden; }

.orbitScene {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.asideContent {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}

/* Central pulsing glow */
.orbitCore {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 52px;
  height: 52px;
  margin: -26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 0 40px rgba(255, 255, 255, 0.06);
  animation: orbitPulse 3s ease-in-out infinite;
}

.orbitCore::before,
.orbitCore::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.07);
  animation: orbitPulse 3s ease-in-out infinite;
}

.orbitCore::before { inset: -16px; animation-delay: 0.7s; }
.orbitCore::after  { inset: -32px; animation-delay: 1.4s; }

@keyframes orbitPulse {
  0%, 100% { transform: scale(1);    opacity: 0.9; }
  50%       { transform: scale(1.18); opacity: 0.2; }
}

/* Orbit rings */
.orbitRing {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--orbit-d);
  height: var(--orbit-d);
  margin-top: calc(var(--orbit-d) / -2);
  margin-left: calc(var(--orbit-d) / -2);
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.07);
  animation: orbitRingSpin var(--orbit-dur, 20s) linear infinite;
}

.orbitRing--rev { animation-direction: reverse; }

@keyframes orbitRingSpin { to { transform: rotate(360deg); } }

/* Icon items — positioned absolutely on the ring */
.orbitItem {
  position: absolute;
  width: 36px;
  height: 36px;
}

/* Per-icon accent colors via --c */
.orbitScene > .orbitRing:nth-child(2) > .orbitItem:nth-child(1) { --c: #22d3ee; }
.orbitScene > .orbitRing:nth-child(2) > .orbitItem:nth-child(2) { --c: #fbbf24; }
.orbitScene > .orbitRing:nth-child(3) > .orbitItem:nth-child(1) { --c: #4ade80; }
.orbitScene > .orbitRing:nth-child(3) > .orbitItem:nth-child(2) { --c: #f472b6; }
.orbitScene > .orbitRing:nth-child(3) > .orbitItem:nth-child(3) { --c: #a78bfa; }
.orbitScene > .orbitRing:nth-child(4) > .orbitItem:nth-child(1) { --c: #fb923c; }
.orbitScene > .orbitRing:nth-child(4) > .orbitItem:nth-child(2) { --c: #38bdf8; }
.orbitScene > .orbitRing:nth-child(4) > .orbitItem:nth-child(3) { --c: #a3e635; }
.orbitScene > .orbitRing:nth-child(4) > .orbitItem:nth-child(4) { --c: #f87171; }

.orbitIcon {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  background: color-mix(in srgb, var(--c, white) 12%, rgba(0, 0, 0, 0.15));
  border: 1px solid color-mix(in srgb, var(--c, white) 30%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c, rgba(255, 255, 255, 0.55));
  box-shadow: 0 2px 14px color-mix(in srgb, var(--c, transparent) 22%, transparent);
  /* counter-rotate so icon stays upright as ring spins */
  animation: orbitIconCCW var(--orbit-dur, 20s) linear infinite;
}

/* for reversed rings the icon spins the opposite way */
.orbitRing--rev .orbitIcon { animation-name: orbitIconCW; }

@keyframes orbitIconCCW { to { transform: rotate(-360deg); } }
@keyframes orbitIconCW  { to { transform: rotate(360deg);  } }

/* Improve text legibility over orbit visuals */
.authAside h1,
.authBrand {
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}

.authAside p,
.authAsideDesc p,
.authAsideMeta {
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.35);
}

/* Hide orbits on mobile (perf + space) */
@media (max-width: 960px) {
  .orbitScene { display: none; }
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  .orbitRing, .orbitIcon, .orbitCore,
  .orbitCore::before, .orbitCore::after {
    animation: none;
  }
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .authPage { grid-template-columns: 1fr; }
  .authAside {
    padding: 20px 18px;
    gap: 12px;
  }
  .authAside h1 {
    font-size: clamp(20px, 5vw, 26px);
    margin: 10px 0 0;
  }
  .authAside p { max-width: none; }
  .authAsideDesc { display: none; }
  .authAsideMeta { display: none; }
}

@media (max-width: 640px) {
  .authMain { padding: 14px; }
}

/* ─── Health status dots ─────────────────────────────────────────────────── */
.healthDotsBar {
  display: flex;
  gap: 5px;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  position: relative;
  z-index: 2;
}

.healthDotsBar.visible {
  opacity: 1;
  pointer-events: auto;
}

.healthDot {
  position: relative;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.healthDot[data-status="up"] {
  background: rgba(15, 23, 42, 0.75);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.healthDot[data-status="down"] {
  background: #ffffff;
}

.healthDot[data-status="restarting"] {
  background: #ffffff;
  animation: dotBlink 1.1s ease-in-out infinite;
}

.healthDot[data-status="unknown"] {
  background: rgba(255, 255, 255, 0.15);
}

@keyframes dotBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.08; }
}

/* Tooltip — appears above the dot, inside aside bounds */
.healthDot::after {
  content: attr(data-label);
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.92);
  color: #e2e8f0;
  font-size: 10px;
  font-weight: 500;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  white-space: nowrap;
  padding: 3px 7px;
  border-radius: 4px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.healthDot:hover::after {
  opacity: 1;
}

@media (max-width: 960px) {
  .healthDotsBar { display: none; }
}
