﻿/* Auth Screen Polish - scoped to login mode */
:root {
  --auth-ink: #0f2842;
  --auth-ink-soft: #5e7690;
  --auth-accent: #0c8da8;
  --auth-accent-strong: #1a4f8d;
  --auth-border: rgba(114, 152, 188, 0.42);
}

body.auth-mode {
  background:
    radial-gradient(circle at 88% 6%, rgba(91, 219, 196, 0.54) 0, rgba(91, 219, 196, 0.24) 22%, transparent 44%),
    radial-gradient(circle at 10% 90%, rgba(117, 158, 223, 0.46) 0, rgba(117, 158, 223, 0.22) 28%, transparent 52%),
    #eaf0f7;
}

body.auth-mode .orb {
  opacity: 0.58;
  filter: blur(62px);
}

body.auth-mode .orb-a {
  width: 300px;
  height: 300px;
  top: -64px;
  right: -62px;
  background: #67e4d6;
}

body.auth-mode .orb-b {
  width: 380px;
  height: 380px;
  left: -96px;
  bottom: -104px;
  background: #79adf6;
}

body.auth-mode .shell {
  padding: 26px 20px;
}

body.auth-mode .content {
  gap: 18px;
  animation: auth-enter 420ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

body.auth-mode .auth-shell {
  width: min(100%, 980px);
  position: relative;
  isolation: isolate;
}

body.auth-mode .auth-shell::before,
body.auth-mode .auth-shell::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
  z-index: 0;
}

body.auth-mode .auth-shell::before {
  width: 308px;
  height: 308px;
  top: -24px;
  right: -30px;
  background: radial-gradient(circle at center, rgba(74, 218, 212, 0.44) 0, rgba(74, 218, 212, 0.22) 44%, rgba(74, 218, 212, 0) 78%);
}

body.auth-mode .auth-shell::after {
  width: 382px;
  height: 382px;
  left: -44px;
  bottom: -40px;
  background: radial-gradient(circle at center, rgba(92, 146, 230, 0.4) 0, rgba(92, 146, 230, 0.2) 48%, rgba(92, 146, 230, 0) 82%);
}

body.auth-mode .auth-card {
  border-radius: 28px;
  border: 1px solid var(--auth-border);
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.93), rgba(241, 249, 255, 0.87));
  box-shadow:
    0 16px 30px rgba(14, 41, 69, 0.12),
    0 34px 72px rgba(10, 44, 78, 0.12);
  padding: 18px 28px 24px;
  position: relative;
  z-index: 1;
}

body.auth-mode .auth-card::before,
body.auth-mode .auth-card::after {
  display: none;
}

body.auth-mode .auth-head {
  padding-right: 0;
  width: min(100%, 880px);
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 4px;
}

body.auth-mode .auth-brand-logo {
  display: block;
  width: min(300px, 82%);
  max-width: 100%;
  height: auto;
  margin: 0 auto 10px;
  object-fit: contain;
  object-position: center;
  transform-origin: center center;
  will-change: transform;
  animation: logo-breathe 4.8s ease-in-out infinite;
}

body.auth-mode .auth-head .brand-kicker {
  font-size: 33px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: #214f8a;
  text-align: center;
  margin-bottom: 2px;
}

body.auth-mode .auth-head h3 {
  margin: 0 auto 8px;
  font-size: clamp(34px, 4.1vw, 52px);
  line-height: 0.98;
  letter-spacing: -0.045em;
  color: var(--auth-ink);
  max-width: 840px;
  text-align: center;
  white-space: nowrap;
}

body.auth-mode .auth-head .muted {
  max-width: 760px;
  color: var(--auth-ink-soft);
  font-size: clamp(22px, 2.2vw, 34px);
  line-height: 1.28;
}

body.auth-mode .auth-card .field {
  margin-bottom: 12px;
}

body.auth-mode .auth-card .field.login-mode-field {
  width: min(100%, 360px);
  margin-left: auto;
  margin-right: auto;
}

body.auth-mode .auth-card .field.login-mode-field label {
  display: block;
  width: 100%;
  text-align: center;
}

body.auth-mode .auth-card .field.auth-input-field {
  width: min(100%, 360px);
  margin-left: auto;
  margin-right: auto;
}

body.auth-mode .auth-card .field label {
  color: #617b95;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body.auth-mode .login-modes {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  width: min(100%, 360px);
  margin-left: auto;
  margin-right: auto;
  padding: 7px;
  border-radius: 16px;
  border: 1px solid rgba(126, 162, 197, 0.45);
  background: linear-gradient(165deg, rgba(246, 251, 255, 0.95), rgba(237, 246, 255, 0.76));
}

body.auth-mode .mode-btn {
  border-radius: 12px;
  border: 1px solid rgba(137, 171, 206, 0.56);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(243, 249, 255, 0.92));
  color: #1a4168;
  font-size: 15px;
  font-weight: 800;
  min-height: 46px;
}

body.auth-mode .mode-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(82, 132, 186, 0.72);
  box-shadow: 0 6px 14px rgba(25, 64, 106, 0.12);
}

body.auth-mode .mode-btn.active {
  color: #eff8ff;
  border-color: rgba(31, 84, 145, 0.35);
  background: linear-gradient(135deg, #1f5ca6, #14839d);
  box-shadow: 0 10px 18px rgba(26, 78, 135, 0.3);
}

body.auth-mode .auth-card input,
body.auth-mode .auth-card select,
body.auth-mode .auth-card textarea {
  min-height: 52px;
  border-radius: 14px;
  border: 1px solid rgba(126, 162, 197, 0.54);
  background: rgba(252, 254, 255, 0.98);
  color: #122f4c;
  font-size: 16px;
  font-weight: 600;
  padding: 0 14px;
}

body.auth-mode .auth-card input::placeholder {
  color: #8ea4b8;
}

body.auth-mode .auth-card input:focus,
body.auth-mode .auth-card select:focus,
body.auth-mode .auth-card textarea:focus {
  border-color: rgba(39, 118, 193, 0.85);
  box-shadow: 0 0 0 4px rgba(67, 146, 219, 0.16);
}

body.auth-mode #password {
  padding-right: 54px !important;
}

body.auth-mode #togglePasswordBtn {
  width: 36px !important;
  height: 36px !important;
  border-radius: 10px !important;
  border: 1px solid rgba(129, 165, 198, 0.48) !important;
  background: rgba(241, 248, 255, 0.94) !important;
  color: #4e6985 !important;
  right: 9px !important;
  transition: all 180ms ease;
}

body.auth-mode #togglePasswordBtn:hover {
  color: #1d466f !important;
  border-color: rgba(88, 136, 187, 0.8) !important;
  box-shadow: 0 4px 10px rgba(20, 65, 109, 0.12);
}

body.auth-mode #loginBtn {
  display: block;
  margin-top: 6px;
  margin-left: auto;
  margin-right: auto;
  min-height: 52px;
  min-width: 230px;
  border: 1px solid rgba(20, 83, 142, 0.45);
  border-radius: 14px;
  background: linear-gradient(135deg, var(--auth-accent-strong), var(--auth-accent));
  color: #f6fbff;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.01em;
  box-shadow: 0 12px 24px rgba(19, 76, 133, 0.28);
}

body.auth-mode #loginBtn:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
  box-shadow: 0 16px 28px rgba(19, 76, 133, 0.35);
}

body.auth-mode .login-inline-message {
  width: min(100%, 880px);
  margin: 10px auto 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(194, 129, 77, 0.45);
  background: linear-gradient(165deg, rgba(255, 248, 240, 0.95), rgba(255, 236, 220, 0.86));
  color: #8a4f20;
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 180ms ease, transform 180ms ease;
}

body.auth-mode .login-inline-message.show {
  opacity: 1;
  transform: translateY(0);
}

body.auth-mode #openChangePasswordBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(128, 166, 200, 0.5);
  background: rgba(239, 248, 255, 0.85);
  color: #2a5788 !important;
  font-weight: 700 !important;
  opacity: 1 !important;
}

body.auth-mode .auth-card-meta {
  width: min(100%, 360px);
  margin: 16px auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

body.auth-mode .auth-version {
  position: relative;
  width: 100%;
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #97a4b4;
}

body.auth-mode .auth-version::before {
  content: "";
  width: 96px;
  height: 1px;
  margin-bottom: 2px;
  background: linear-gradient(90deg, rgba(139, 162, 188, 0), rgba(139, 162, 188, 0.7), rgba(139, 162, 188, 0));
}

body.auth-mode .auth-version strong {
  color: #8f9dac;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

body.auth-mode .auth-version span {
  color: #b0bac6;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

body.auth-mode .status-card {
  width: min(100%, 980px);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid rgba(112, 151, 187, 0.44);
  border-radius: 20px;
  padding: 12px;
  background:
    linear-gradient(162deg, rgba(250, 253, 255, 0.88), rgba(238, 247, 255, 0.76));
  box-shadow:
    0 12px 28px rgba(17, 49, 78, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(7px);
}

body.auth-mode .status-card::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, rgba(19, 93, 158, 0), rgba(19, 93, 158, 0.75), rgba(26, 167, 166, 0.7), rgba(19, 93, 158, 0));
  z-index: -1;
}

body.auth-mode .status-card::after {
  content: "";
  position: absolute;
  width: 210px;
  height: 210px;
  right: -92px;
  top: -96px;
  border-radius: 999px;
  background: radial-gradient(circle at center, rgba(57, 176, 187, 0.22), rgba(57, 176, 187, 0));
  pointer-events: none;
  z-index: -1;
}

body.auth-mode .status-card h3 {
  margin: 0 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #4e6d8b;
}

body.auth-mode .status-card h3::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #1ba39f;
  box-shadow:
    0 0 0 0 rgba(27, 163, 159, 0.6),
    0 0 0 6px rgba(27, 163, 159, 0.15);
  animation: status-pulse 1.9s ease-out infinite;
}

body.auth-mode .status-out {
  position: relative;
  min-height: 62px;
  max-height: 140px;
  border-radius: 14px;
  border: 1px solid rgba(42, 94, 140, 0.86);
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.02) 0,
      rgba(255, 255, 255, 0.02) 1px,
      transparent 1px,
      transparent 3px
    ),
    linear-gradient(180deg, #04182b, #072540 65%, #062236);
  color: #d2ebff;
  padding: 13px 14px;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.01em;
  box-shadow:
    inset 0 0 0 1px rgba(126, 167, 211, 0.08),
    inset 0 10px 16px rgba(0, 0, 0, 0.17);
}

body.auth-mode .status-out::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(83, 174, 235, 0), rgba(83, 174, 235, 0.42), rgba(83, 174, 235, 0));
}

@media (max-width: 980px) {
  body.auth-mode .auth-head h3 {
    font-size: clamp(32px, 7.4vw, 44px);
    white-space: normal;
  }

  body.auth-mode .auth-head .muted {
    font-size: clamp(18px, 4vw, 28px);
  }

}

@media (max-width: 680px) {
  body.auth-mode .shell {
    min-height: 100dvh;
    padding: calc(env(safe-area-inset-top) + 8px) 8px calc(env(safe-area-inset-bottom) + 8px);
  }

  body.auth-mode .content {
    min-height: auto;
    align-content: start;
    justify-items: stretch;
    gap: 8px;
  }

  body.auth-mode .auth-head {
    display: grid;
    justify-items: center;
    width: 100%;
    margin-bottom: 2px;
  }

  body.auth-mode .auth-shell {
    width: 100%;
    max-width: 430px;
    min-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 16px);
    margin-left: auto;
    margin-right: auto;
    display: flex;
  }

  body.auth-mode .auth-card {
    width: 100%;
    min-height: 100%;
    padding: 14px 14px 12px;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
  }

  body.auth-mode .auth-brand-logo {
    width: min(248px, 72vw);
    max-width: 100%;
    margin: 2px auto 10px;
  }

  body.auth-mode {
    background:
      radial-gradient(circle at 88% 6%, rgba(91, 219, 196, 0.64) 0, rgba(91, 219, 196, 0.28) 22%, transparent 46%),
      radial-gradient(circle at 10% 90%, rgba(117, 158, 223, 0.68) 0, rgba(117, 158, 223, 0.28) 34%, transparent 60%),
      #eaf0f7;
  }

  body.auth-mode .orb-a {
    width: 328px;
    height: 328px;
    top: -50px;
    right: -44px;
    background: #68e8da;
    opacity: 0.58;
    filter: blur(64px);
  }

  body.auth-mode .auth-shell::before {
    width: 272px;
    height: 272px;
    top: -16px;
    right: -22px;
    background: radial-gradient(circle at center, rgba(74, 218, 212, 0.46) 0, rgba(74, 218, 212, 0.22) 46%, rgba(74, 218, 212, 0) 78%);
  }

  body.auth-mode .auth-shell::after {
    width: 300px;
    height: 300px;
    left: -24px;
    bottom: -24px;
    background: radial-gradient(circle at center, rgba(92, 146, 230, 0.32) 0, rgba(92, 146, 230, 0.14) 48%, rgba(92, 146, 230, 0) 80%);
  }

  body.auth-mode .orb-b {
    width: 430px;
    height: 430px;
    left: -98px;
    bottom: -108px;
    background: #6fa5f7;
    opacity: 0.72;
    filter: blur(74px);
  }

  body.auth-mode .auth-head .brand-kicker {
    font-size: 28px;
  }

  body.auth-mode .auth-head h3 {
    margin-bottom: 4px;
    font-size: clamp(24px, 7.4vw, 31px);
    line-height: 0.96;
    letter-spacing: -0.04em;
  }

  body.auth-mode .auth-card .field {
    margin-bottom: 9px;
  }

  body.auth-mode .auth-card .field.login-mode-field,
  body.auth-mode .auth-card .field.auth-input-field,
  body.auth-mode .login-modes {
    width: 100%;
  }

  body.auth-mode .auth-card .field.login-mode-field + .field.auth-input-field {
    margin-top: auto;
    padding-top: 10px;
  }

  body.auth-mode .auth-card .field label {
    font-size: 11px;
    letter-spacing: 0.07em;
  }

  body.auth-mode .login-modes {
    gap: 6px;
    padding: 6px;
    border-radius: 14px;
  }

  body.auth-mode .mode-btn {
    min-height: 40px;
    font-size: 14px;
    border-radius: 11px;
  }

  body.auth-mode .auth-card input,
  body.auth-mode .auth-card select,
  body.auth-mode .auth-card textarea {
    min-height: 46px;
    font-size: 15px;
    padding: 0 12px;
  }

  body.auth-mode #togglePasswordBtn {
    width: 34px !important;
    height: 34px !important;
    right: 7px !important;
  }

  body.auth-mode .auth-head .muted {
    font-size: clamp(16px, 4.2vw, 22px);
  }

  body.auth-mode .login-modes {
    grid-template-columns: 1fr;
  }

  body.auth-mode #loginBtn {
    width: 100%;
    min-height: 48px;
    min-width: 0;
    margin-top: 4px;
    font-size: 18px;
  }

  body.auth-mode .login-inline-message {
    margin-top: 8px;
    padding: 8px 10px;
    font-size: 12px;
  }

  body.auth-mode .auth-card-meta {
    margin-top: 10px !important;
    gap: 8px;
  }

  body.auth-mode #openChangePasswordBtn {
    padding: 7px 12px;
    font-size: 13px !important;
  }

  body.auth-mode .auth-version {
    padding-top: 12px;
    gap: 3px;
  }

  body.auth-mode .auth-version strong {
    font-size: 13px;
  }

  body.auth-mode .auth-version span {
    font-size: 11px;
  }

  body.auth-mode .status-card {
    border-radius: 16px;
    padding: 10px;
  }

  body.auth-mode .status-out {
    min-height: 58px;
    max-height: 128px;
    font-size: 11px;
    border-radius: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.auth-mode .auth-brand-logo {
    animation: none;
  }
}

@keyframes logo-breathe {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.028);
  }
}

@keyframes auth-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes status-pulse {
  0% {
    box-shadow:
      0 0 0 0 rgba(27, 163, 159, 0.58),
      0 0 0 6px rgba(27, 163, 159, 0.14);
  }

  70% {
    box-shadow:
      0 0 0 9px rgba(27, 163, 159, 0),
      0 0 0 12px rgba(27, 163, 159, 0);
  }

  100% {
    box-shadow:
      0 0 0 0 rgba(27, 163, 159, 0),
      0 0 0 6px rgba(27, 163, 159, 0);
  }
}
