/* CLMS Auth — full-viewport double-split layout */
:root {
  --auth-blue: #2A7BE4;
  --auth-blue-deep: #1657b0;
  --auth-navy: #0b1f3a;
  --auth-navy-mid: #123056;
  --auth-ink: #0f172a;
  --auth-muted: #64748b;
  --auth-line: #e2e8f0;
  --auth-surface: #ffffff;
  --auth-soft: #f8fafc;
  --auth-ok: #0f9f6e;
  --auth-bad: #dc2626;
  --auth-radius: 12px;
  --auth-font: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  --auth-display: "Outfit", "Plus Jakarta Sans", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body.auth-split-body {
  font-family: var(--auth-font);
  color: var(--auth-ink);
  background: var(--auth-surface);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

.auth-split {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
}

/* ===== Brand panel (left) ===== */
.auth-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(1.5rem, 4vw, 3.5rem);
  color: #fff;
  background:
    linear-gradient(160deg, rgba(11, 31, 58, 0.92) 0%, rgba(18, 48, 86, 0.88) 45%, rgba(42, 123, 228, 0.82) 100%),
    radial-gradient(ellipse at 20% 20%, rgba(74, 158, 255, 0.35), transparent 55%),
    radial-gradient(ellipse at 80% 80%, rgba(16, 87, 176, 0.45), transparent 50%),
    linear-gradient(135deg, var(--auth-navy) 0%, var(--auth-navy-mid) 55%, var(--auth-blue-deep) 100%);
  overflow: hidden;
  isolation: isolate;
}

.auth-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 85%);
  pointer-events: none;
  z-index: 0;
}

.auth-brand::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  right: -120px;
  bottom: -140px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.16), transparent 70%);
  animation: authOrb 12s ease-in-out infinite;
  z-index: 0;
}

@keyframes authOrb {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-24px, -18px) scale(1.08); }
}

.auth-brand-top,
.auth-brand-main,
.auth-brand-foot {
  position: relative;
  z-index: 1;
}

.auth-brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
}

.auth-brand-mark img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.auth-brand-mark span {
  font-family: var(--auth-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
}

.auth-brand-main {
  max-width: 34rem;
  padding: 2rem 0;
  animation: authRise 0.7s ease both;
}

@keyframes authRise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-brand-main h1 {
  font-family: var(--auth-display);
  font-size: clamp(2.6rem, 5vw, 4.25rem);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.04em;
  margin: 0 0 1rem;
}

.auth-brand-main .lead {
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  font-weight: 500;
  opacity: 0.95;
  margin: 0 0 1rem;
}

.auth-brand-main .company {
  font-size: 0.95rem;
  opacity: 0.85;
  margin: 0 0 2rem;
}

.auth-points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.auth-points li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.95rem;
  font-weight: 500;
  opacity: 0;
  animation: authSlide 0.55s ease forwards;
}

.auth-points li:nth-child(1) { animation-delay: 0.15s; }
.auth-points li:nth-child(2) { animation-delay: 0.25s; }
.auth-points li:nth-child(3) { animation-delay: 0.35s; }
.auth-points li:nth-child(4) { animation-delay: 0.45s; }

@keyframes authSlide {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}

.auth-points li i {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.14);
  color: #8ef0c5;
  flex-shrink: 0;
  font-size: 0.75rem;
}

.auth-brand-foot {
  font-size: 0.8rem;
  opacity: 0.7;
}

/* ===== Form panel (right) ===== */
.auth-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--auth-surface);
  padding: clamp(1.5rem, 4vw, 3.5rem);
  position: relative;
  overflow-y: auto;
}

.auth-panel::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 1px;
  background: linear-gradient(180deg, transparent, var(--auth-line), transparent);
}

.auth-panel-inner {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  animation: authRise 0.65s ease 0.08s both;
}

.auth-panel-header {
  margin-bottom: 1.75rem;
}

.auth-panel-header h2 {
  font-family: var(--auth-display);
  font-size: clamp(1.75rem, 2.5vw, 2.15rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 0.4rem;
  color: var(--auth-ink);
}

.auth-panel-header p {
  margin: 0;
  color: var(--auth-muted);
  font-size: 0.98rem;
}

.auth-form .form-group {
  margin-bottom: 1.15rem;
}

.auth-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.auth-form label {
  display: block;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--auth-ink);
  margin-bottom: 0.4rem;
}

.auth-input {
  position: relative;
}

.auth-input i.leading {
  position: absolute;
  left: 0.95rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--auth-muted);
  font-size: 0.9rem;
  pointer-events: none;
}

.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="tel"],
.auth-form input[type="password"] {
  width: 100%;
  border: 1.5px solid var(--auth-line);
  background: var(--auth-soft);
  border-radius: var(--auth-radius);
  padding: 0.85rem 2.75rem 0.85rem 2.65rem;
  font: inherit;
  font-size: 0.98rem;
  color: var(--auth-ink);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.auth-form input:focus {
  border-color: var(--auth-blue);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(42, 123, 228, 0.12);
}

.auth-form input.is-invalid {
  border-color: var(--auth-bad);
}

.auth-form .password-toggle {
  position: absolute;
  right: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--auth-muted);
  cursor: pointer;
  padding: 0.45rem;
  border-radius: 8px;
}

.auth-form .password-toggle:hover {
  color: var(--auth-blue);
  background: rgba(42, 123, 228, 0.08);
}

.invalid-feedback {
  display: block;
  margin-top: 0.4rem;
  color: var(--auth-bad);
  font-size: 0.8rem;
}

.auth-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0.25rem 0 1.25rem;
}

.auth-check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.86rem;
  color: var(--auth-muted);
}

.auth-check input {
  accent-color: var(--auth-blue);
  width: 1rem;
  height: 1rem;
}

.auth-link {
  color: var(--auth-blue);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.86rem;
}

.auth-link:hover {
  text-decoration: underline;
}

.auth-submit {
  width: 100%;
  border: 0;
  border-radius: var(--auth-radius);
  padding: 0.95rem 1.25rem;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, var(--auth-blue) 0%, var(--auth-blue-deep) 100%);
  box-shadow: 0 10px 24px rgba(42, 123, 228, 0.28);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.auth-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(42, 123, 228, 0.34);
}

.auth-submit.loading {
  opacity: 0.75;
  pointer-events: none;
}

.auth-footer {
  margin-top: 1.35rem;
  text-align: center;
  color: var(--auth-muted);
  font-size: 0.9rem;
}

.password-strength {
  margin-top: 0.45rem;
}

.password-strength-bar {
  height: 4px;
  background: var(--auth-line);
  border-radius: 999px;
  overflow: hidden;
}

.password-strength-fill {
  height: 100%;
  width: 0;
  transition: width 0.25s ease, background 0.25s ease;
}

.password-strength-fill.weak { width: 33%; background: var(--auth-bad); }
.password-strength-fill.medium { width: 66%; background: #d97706; }
.password-strength-fill.strong { width: 100%; background: var(--auth-ok); }

.auth-alert-wrap {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 50;
  display: grid;
  gap: 0.6rem;
  max-width: min(400px, calc(100vw - 2rem));
}

.auth-alert {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  color: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
  animation: authRise 0.35s ease;
}

.auth-alert.success { background: var(--auth-ok); }
.auth-alert.error { background: var(--auth-bad); }

.auth-alert button {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  opacity: 0.85;
}

/* Mobile: stacked split */
@media (max-width: 900px) {
  .auth-split {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .auth-brand {
    min-height: auto;
    padding: 1.5rem 1.25rem 1.75rem;
  }

  .auth-brand-main {
    padding: 1rem 0 0.25rem;
  }

  .auth-brand-main h1 {
    font-size: 2.4rem;
  }

  .auth-points {
    display: none;
  }

  .auth-brand-foot {
    display: none;
  }

  .auth-panel {
    padding: 1.75rem 1.25rem 2.5rem;
    min-height: 60vh;
  }

  .auth-panel::before {
    display: none;
  }

  .auth-form .form-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .auth-brand-mark img {
    width: 46px;
    height: 46px;
  }

  .auth-panel-header h2 {
    font-size: 1.65rem;
  }
}

/* =====================================================================
   Polish layer
   ===================================================================== */

/* ----- Brand panel ----- */
.auth-brand {
  background-size: 100% 100%, 100% 100%, 100% 100%, 160% 160%;
  animation: authGradient 18s ease-in-out infinite;
}

@keyframes authGradient {
  0%, 100% { background-position: 0 0, 0 0, 0 0, 0% 50%; }
  50% { background-position: 0 0, 0 0, 0 0, 100% 50%; }
}

.auth-shape {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(2px);
}

.auth-shape.s1 {
  width: 260px;
  height: 260px;
  top: -90px;
  left: -70px;
  background: radial-gradient(circle at 30% 30%, rgba(142, 240, 197, 0.28), transparent 70%);
  animation: authFloat 14s ease-in-out infinite;
}

.auth-shape.s2 {
  width: 150px;
  height: 150px;
  top: 46%;
  right: 8%;
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.03);
  animation: authFloat 11s ease-in-out infinite reverse;
}

.auth-shape.s3 {
  width: 90px;
  height: 90px;
  bottom: 18%;
  left: 46%;
  background: radial-gradient(circle, rgba(74, 158, 255, 0.4), transparent 70%);
  animation: authFloat 9s ease-in-out infinite;
}

@keyframes authFloat {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(14px, -22px); }
}

.auth-brand-mark img {
  background: #fff;
  animation: authPulse 3.2s ease-out infinite;
}

@keyframes authPulse {
  0% { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25), 0 0 0 0 rgba(255, 255, 255, 0.35); }
  70% { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25), 0 0 0 16px rgba(255, 255, 255, 0); }
  100% { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25), 0 0 0 0 rgba(255, 255, 255, 0); }
}

.auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  margin-bottom: 1.25rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(6px);
}

.auth-badge i {
  color: #8ef0c5;
}

.auth-brand-main h1 {
  text-shadow: 0 6px 30px rgba(0, 0, 0, 0.25);
}

.auth-points li {
  padding: 0.6rem 0.9rem 0.6rem 0.65rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(6px);
  transition: transform 0.25s ease, background 0.25s ease;
}

.auth-points li:hover {
  transform: translateX(4px);
  background: rgba(255, 255, 255, 0.13);
}

/* ----- Form panel ----- */
.auth-panel {
  background:
    radial-gradient(circle at 100% 0%, rgba(42, 123, 228, 0.10), transparent 45%),
    radial-gradient(circle at 0% 100%, rgba(15, 159, 110, 0.07), transparent 45%),
    linear-gradient(180deg, #f8fbff 0%, #ffffff 60%);
}

.auth-panel-inner {
  max-width: 460px;
  padding: clamp(1.5rem, 3vw, 2.5rem);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 22px;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 24px 60px -20px rgba(22, 87, 176, 0.25);
  backdrop-filter: blur(8px);
}

.auth-panel-header {
  text-align: center;
}

.auth-panel-header::before {
  content: "";
  display: block;
  width: 46px;
  height: 4px;
  margin: 0 auto 1.1rem;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--auth-blue), #4a9eff);
}

.auth-form .form-group {
  animation: authRise 0.55s ease both;
}

.auth-form .form-group:nth-of-type(1) { animation-delay: 0.10s; }
.auth-form .form-group:nth-of-type(2) { animation-delay: 0.17s; }
.auth-form .form-group:nth-of-type(3) { animation-delay: 0.24s; }
.auth-form .form-group:nth-of-type(4) { animation-delay: 0.31s; }
.auth-form .form-group:nth-of-type(5) { animation-delay: 0.38s; }
.auth-form .form-row { animation: authRise 0.55s ease 0.10s both; }
.auth-form .form-row .form-group { animation: none; }

.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="tel"],
.auth-form input[type="password"] {
  background: #f4f7fb;
}

.auth-form input:hover:not(:focus) {
  border-color: #c5d3e6;
}

.auth-form input:focus {
  transform: translateY(-1px);
}

.auth-input:focus-within i.leading {
  color: var(--auth-blue);
}

.auth-form input:-webkit-autofill,
.auth-form input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #eef4fd inset;
  -webkit-text-fill-color: var(--auth-ink);
}

.auth-form input.is-invalid {
  background: #fff7f7;
  animation: authShake 0.35s ease;
}

@keyframes authShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.auth-submit {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

.auth-submit span,
.auth-submit i {
  position: relative;
  z-index: 1;
}

.auth-submit i {
  font-size: 0.85rem;
  transition: transform 0.25s ease;
}

.auth-submit:hover i {
  transform: translateX(4px);
}

.auth-submit::after {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 40%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg);
  transition: left 0.6s ease;
}

.auth-submit:hover::after {
  left: 130%;
}

.auth-submit:active {
  transform: translateY(0);
}

.auth-submit:focus-visible,
.auth-link:focus-visible,
.password-toggle:focus-visible {
  outline: 3px solid rgba(42, 123, 228, 0.4);
  outline-offset: 2px;
}

.auth-submit.loading i {
  display: none;
}

.auth-submit.loading::before {
  content: "";
  position: relative;
  z-index: 1;
  width: 16px;
  height: 16px;
  margin-right: 0.15rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  animation: authSpin 0.7s linear infinite;
}

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

.auth-footer {
  padding-top: 1.1rem;
  border-top: 1px solid var(--auth-line);
}

/* ----- Hints: caps lock, strength, match ----- */
.field-hint {
  display: none;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.field-hint.show { display: flex; }
.field-hint.warn { color: #b45309; }
.field-hint.ok { color: var(--auth-ok); }
.field-hint.bad { color: var(--auth-bad); }

.password-strength {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.password-strength-bar {
  flex: 1;
}

.password-strength-label {
  min-width: 3.6rem;
  text-align: right;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--auth-muted);
}

.password-strength-label.weak { color: var(--auth-bad); }
.password-strength-label.medium { color: #d97706; }
.password-strength-label.strong { color: var(--auth-ok); }

.password-rules {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
  margin: 0.55rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.75rem;
  color: var(--auth-muted);
}

.password-rules li i {
  width: 0.9rem;
  margin-right: 0.2rem;
  font-size: 0.65rem;
}

.password-rules li.met { color: var(--auth-ok); font-weight: 600; }

/* ----- Alerts ----- */
.auth-alert {
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(6px);
}

.auth-alert.warning { background: #d97706; }

.auth-alert::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 100%;
  background: rgba(255, 255, 255, 0.55);
  transform-origin: left;
  animation: authCountdown 5s linear forwards;
}

@keyframes authCountdown {
  to { transform: scaleX(0); }
}

/* ----- Responsive refinements ----- */
@media (max-width: 900px) {
  .auth-panel-inner {
    padding: 1.5rem 1.15rem;
    box-shadow: 0 16px 40px -20px rgba(22, 87, 176, 0.3);
  }

  .auth-badge {
    margin-bottom: 0.85rem;
  }
}

@media (max-width: 480px) {
  .auth-panel {
    padding: 1rem 0.75rem 2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .auth-points li {
    opacity: 1;
  }
}
