/* LSense Client Login — mobile-first, English UI (Public Sans), Vazirmatn fallback for Persian data */

:root {
  --cl-blue: #1e6fe8;
  --cl-blue-deep: #0d4bb8;
  --cl-sky: #4a9bff;
  --cl-navy: #0b1f3a;
  --cl-navy-deep: #071527;
  --cl-ink: #10233f;
  --cl-muted: #64748b;
  --cl-line: #e2e8f0;
  --cl-field-bg: #f4f6fa;
  --cl-danger: #dc2626;
  --cl-danger-bg: #fef2f2;
  --cl-radius: 1.35rem;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--cl-navy-deep);
}

html:has(.cl-login),
html:has(.cl-login) body {
  color-scheme: light;
  background: var(--cl-navy-deep);
}

.cl-login,
.cl-login * {
  box-sizing: border-box;
  /* Vazirmatn fallback keeps Persian user input rendering cleanly */
  font-family: "Vazir", "Segoe UI", system-ui, -apple-system, "Noto Sans", Tahoma, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.cl-login {
  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  overflow-y: auto;
  padding: calc(1rem + env(safe-area-inset-top, 0px)) 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
  background: var(--cl-navy-deep);
  isolation: isolate;
}

/* ---------- Background ---------- */
.cl-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(120% 90% at 85% -10%, #123f8f 0%, transparent 55%),
    radial-gradient(110% 90% at 10% 110%, #0e2f66 0%, transparent 60%),
    linear-gradient(160deg, #081832 0%, #0c2a55 55%, #114188 100%);
  pointer-events: none;
}

.cl-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  will-change: transform, opacity;
}

.cl-glow--1 {
  width: 55vmin;
  height: 55vmin;
  top: -18vmin;
  inset-inline-start: -12vmin;
  background: radial-gradient(circle, rgba(74, 155, 255, 0.5) 0%, transparent 70%);
  animation: cl-drift 16s ease-in-out infinite;
}

.cl-glow--2 {
  width: 48vmin;
  height: 48vmin;
  bottom: -16vmin;
  inset-inline-end: -10vmin;
  background: radial-gradient(circle, rgba(30, 111, 232, 0.45) 0%, transparent 70%);
  animation: cl-drift 20s ease-in-out infinite reverse;
}

.cl-glow--3 {
  width: 30vmin;
  height: 30vmin;
  top: 30%;
  inset-inline-start: 55%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.14) 0%, transparent 70%);
  animation: cl-pulse 9s ease-in-out infinite;
}

.cl-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(75% 65% at 50% 40%, rgba(0, 0, 0, 0.85) 0%, transparent 100%);
  -webkit-mask-image: radial-gradient(75% 65% at 50% 40%, rgba(0, 0, 0, 0.85) 0%, transparent 100%);
}

/* ---------- Shell ---------- */
.cl-shell {
  position: relative;
  z-index: 1;
  width: min(1020px, 100%);
  display: grid;
  grid-template-columns: 1fr;
  border-radius: var(--cl-radius);
  overflow: hidden;
  box-shadow:
    0 32px 64px rgba(4, 12, 26, 0.5),
    0 4px 16px rgba(4, 12, 26, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.08);
  animation: cl-rise 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ---------- Form panel ---------- */
.cl-panel {
  position: relative;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(24px) saturate(1.3);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
  padding: 2rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
}

.cl-logo-tile {
  width: 84px;
  height: 84px;
  margin: 0 auto 1.1rem;
  border-radius: 1.25rem;
  background: #fff;
  border: 1px solid var(--cl-line);
  box-shadow: 0 10px 24px rgba(11, 31, 58, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: cl-rise 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.08s both;
}

.cl-logo-tile img {
  width: 64px;
  height: auto;
  display: block;
}

.cl-title {
  margin: 0 0 0.4rem;
  text-align: center;
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--cl-ink);
}

.cl-subtitle {
  margin: 0 auto 1.6rem;
  max-width: 300px;
  text-align: center;
  font-size: 0.86rem;
  font-weight: 400;
  line-height: 1.6;
  color: var(--cl-muted);
}

/* ---------- Form ---------- */
.cl-form {
  display: flex;
  flex-direction: column;
}

.cl-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin-bottom: 1.1rem;
  padding: 0.7rem 0.85rem;
  border-radius: 0.8rem;
  background: var(--cl-danger-bg);
  border: 1px solid #fecaca;
  color: var(--cl-danger);
  font-size: 0.83rem;
  line-height: 1.7;
}

.cl-alert svg {
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
  margin-top: 0.2rem;
}

.cl-alert--ok {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e40af;
}

.cl-login .otp-digits {
  gap: 0.4rem;
  margin: 0.15rem 0 0.85rem;
}

.cl-login .otp-digit {
  width: 2.55rem;
  height: 3rem;
  border-radius: 0.8rem;
  background: var(--cl-field-bg);
  border-color: var(--cl-line);
  color: var(--cl-ink);
}

.cl-login .otp-digit:focus {
  background: #fff;
  border-color: var(--cl-blue);
  box-shadow: 0 0 0 3px rgba(30, 111, 232, 0.16);
}

.cl-login .otp-timer-text {
  color: var(--cl-navy);
}

.cl-login .otp-switch {
  margin: 1.1rem 0 0;
}

.cl-login .otp-switch a {
  font-size: 0.84rem;
  font-weight: 650;
  color: var(--cl-blue);
}

.cl-field-group {
  margin-bottom: 1.05rem;
}

.cl-label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: #334155;
}

.cl-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
}

.cl-label-row .cl-label {
  margin-bottom: 0;
}

.cl-forgot {
  font-size: 0.8125rem;
  color: var(--cl-sky);
  text-decoration: none;
}

.cl-forgot:hover {
  text-decoration: underline;
}

.cl-submit--link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  margin-top: 0.5rem;
}

.cl-back-row {
  margin: 0.75rem 0 0;
  text-align: center;
  font-size: 0.86rem;
}

.cl-field {
  position: relative;
  display: flex;
  align-items: center;
}

.cl-field-icon {
  position: absolute;
  inset-inline-start: 0.95rem;
  display: flex;
  color: #94a3b8;
  pointer-events: none;
  transition: color 0.2s ease;
}

.cl-field-icon svg {
  width: 1.2rem;
  height: 1.2rem;
}

.cl-field:focus-within .cl-field-icon {
  color: var(--cl-blue);
}

.cl-input {
  width: 100%;
  min-height: 3.25rem;
  padding: 0.65rem 1rem;
  padding-inline-start: 2.9rem;
  border: 1.5px solid var(--cl-line);
  border-radius: 0.9rem;
  background: var(--cl-field-bg);
  color: var(--cl-ink);
  font-size: 1rem;
  line-height: 1.4;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  appearance: none;
  color-scheme: light;
}

.cl-input::placeholder {
  color: #a3aebd;
  font-weight: 300;
}

.cl-input:focus {
  outline: none;
  background: #fff;
  border-color: var(--cl-blue);
  box-shadow: 0 0 0 4px rgba(30, 111, 232, 0.14);
}

/* Room for the visibility toggle */
#cl-password {
  padding-inline-end: 2.9rem;
}

.cl-pass-toggle {
  position: absolute;
  inset-inline-end: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border: none;
  border-radius: 0.65rem;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.cl-pass-toggle:hover,
.cl-pass-toggle:focus-visible {
  color: var(--cl-blue);
  background: rgba(30, 111, 232, 0.08);
  outline: none;
}

.cl-pass-toggle svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* UA stylesheet's [hidden] rule doesn't reach inline SVG */
.cl-pass-toggle svg[hidden] {
  display: none;
}

.cl-error {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--cl-danger);
}

/* ---------- Remember me ---------- */
.cl-remember {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0.15rem 0 1.35rem;
  cursor: pointer;
  user-select: none;
}

.cl-remember-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.cl-remember-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 0.4rem;
  border: 1.5px solid #cbd5e1;
  background: #fff;
  color: #fff;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.cl-remember-box svg {
  width: 0.8rem;
  height: 0.8rem;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.cl-remember-input:checked + .cl-remember-box {
  background: var(--cl-blue);
  border-color: var(--cl-blue);
}

.cl-remember-input:checked + .cl-remember-box svg {
  opacity: 1;
  transform: scale(1);
}

.cl-remember-input:focus-visible + .cl-remember-box {
  box-shadow: 0 0 0 4px rgba(30, 111, 232, 0.18);
}

.cl-remember-text {
  font-size: 0.86rem;
  color: #475569;
}

/* ---------- Submit ---------- */
.cl-submit {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 3.25rem;
  border: none;
  border-radius: 0.95rem;
  background: linear-gradient(135deg, var(--cl-blue) 0%, var(--cl-blue-deep) 100%);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.cl-submit::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.22) 50%, transparent 65%);
  transform: translateX(160%);
  transition: transform 0.7s ease;
}

.cl-submit:hover {
  box-shadow: 0 12px 28px rgba(30, 111, 232, 0.42);
  transform: translateY(-1px);
}

.cl-submit:hover::before {
  transform: translateX(-160%);
}

.cl-submit:active {
  transform: translateY(0) scale(0.985);
}

.cl-submit:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(74, 155, 255, 0.4);
}

.cl-submit-arrow {
  width: 1.2rem;
  height: 1.2rem;
  transition: transform 0.2s ease;
}

.cl-submit:hover .cl-submit-arrow {
  transform: translateX(3px);
}

.cl-submit-spinner {
  display: none;
  width: 1.15rem;
  height: 1.15rem;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: cl-spin 0.7s linear infinite;
}

.cl-submit.is-loading {
  pointer-events: none;
  filter: saturate(0.85) brightness(0.95);
}

.cl-submit.is-loading .cl-submit-arrow {
  display: none;
}

.cl-submit.is-loading .cl-submit-spinner {
  display: block;
}

/* ---------- Footer ---------- */
.cl-powered {
  margin: 1.5rem 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.3rem 0.5rem;
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  color: #94a3b8;
}

.cl-powered a {
  color: #475569;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid #cbd5e1;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.cl-powered a:hover,
.cl-powered a:focus-visible {
  color: var(--cl-blue);
  border-bottom-color: var(--cl-blue);
  outline: none;
}

.cl-powered-dot {
  opacity: 0.6;
}

/* ---------- Brand panel (desktop) ---------- */
.cl-brand {
  display: none;
  position: relative;
  color: #fff;
  background:
    radial-gradient(110% 100% at 100% 0%, rgba(74, 155, 255, 0.35) 0%, transparent 55%),
    radial-gradient(120% 110% at 0% 100%, rgba(13, 75, 184, 0.55) 0%, transparent 60%),
    linear-gradient(155deg, #0c2a55 0%, #114188 100%);
}

.cl-brand-inner {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem 2.75rem;
}

.cl-brand-mark {
  position: absolute;
  inset-inline-end: -3.5rem;
  bottom: -2.5rem;
  width: 300px;
  opacity: 0.08;
  filter: brightness(0) invert(1);
  pointer-events: none;
  animation: cl-float 7s ease-in-out infinite;
}

.cl-brand-eyebrow {
  margin: 0 0 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.75);
}

.cl-brand-headline {
  margin: 0 0 1rem;
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.3;
  color: #fff;
}

.cl-brand-lead {
  margin: 0 0 1.9rem;
  font-size: 0.95rem;
  font-weight: 300;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.85);
}

.cl-brand-features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.cl-brand-features li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.92);
  animation: cl-rise 0.6s ease-out both;
}

.cl-brand-features li:nth-child(1) { animation-delay: 0.2s; }
.cl-brand-features li:nth-child(2) { animation-delay: 0.32s; }
.cl-brand-features li:nth-child(3) { animation-delay: 0.44s; }

.cl-brand-feature-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 0.65rem;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.14);
  flex-shrink: 0;
}

.cl-brand-feature-icon svg {
  width: 1.1rem;
  height: 1.1rem;
}

/* ---------- Desktop ---------- */
@media (min-width: 900px) {
  .cl-login {
    padding: 2rem;
  }

  .cl-shell {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    min-height: 600px;
  }

  /* RTL: form (first in DOM) lands on the right, brand fills the left */
  .cl-brand {
    display: block;
  }

  .cl-panel {
    padding: 3rem 3rem 2rem;
    justify-content: center;
  }
}

/* ---------- Animations ---------- */
@keyframes cl-rise {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes cl-drift {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-24px, 20px); }
}

@keyframes cl-pulse {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.15); }
}

@keyframes cl-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

@keyframes cl-spin {
  to { transform: rotate(360deg); }
}

.cl-lang-wrap {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 0.75rem;
}

.cl-lang-wrap--card {
  margin-bottom: 1rem;
}

.cl-lang-wrap .cp-lang-btn {
  border-color: rgba(15, 23, 42, 0.16);
  background: rgba(15, 23, 42, 0.05);
  color: #16324f;
}

.cl-lang-wrap .cp-lang-flag {
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.12);
}

[dir="rtl"] .cl-submit:hover .cl-submit-arrow,
[dir="rtl"] .cl-submit:hover .cp-flip-rtl {
  transform: translateX(-3px) scaleX(-1);
}

[dir="rtl"] .cl-submit:hover::before {
  transform: translateX(-160%);
}

@media (prefers-reduced-motion: reduce) {
  .cl-shell,
  .cl-logo-tile,
  .cl-glow,
  .cl-brand-mark,
  .cl-brand-features li,
  .cl-submit::before {
    animation: none !important;
    transition: none !important;
  }
}

/* The PNG logos are 15:16, not square: keep their shape inside fixed square boxes. */
img[src*="Lsense/logo-"] {
  object-fit: contain;
}
