/* ================================================================
   CRM Biai - Login
   Smooth glass shell with GPU-friendly motion.
   ================================================================ */

@font-face {
  font-family: 'Geist';
  src: url('../fonts/geist/Geist-Variable.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-display: swap;
  font-style: normal;
}

:root {
  --bg-0: #050814;
  --bg-1: #08111f;
  --bg-2: #101827;
  --panel: rgba(8, 14, 28, .74);
  --panel-strong: rgba(10, 18, 34, .88);
  --line: rgba(255,255,255,.12);
  --line-strong: rgba(255,255,255,.2);
  --text-1: #f7f9fc;
  --text-2: #c9d4e4;
  --text-3: #8897ad;
  --brand: #20a7f4;
  --brand-2: #7c5cff;
  --brand-3: #22d3a6;
  --danger: #ef4444;
  --success: #38d996;
  --focus: rgba(32,167,244,.18);
  --shadow: 0 32px 90px rgba(0,0,0,.52);
  --font-sans: 'Geist', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --ease: cubic-bezier(.22,.78,.24,1);
  --ease-soft: cubic-bezier(.16,1,.3,1);
}

* { box-sizing: border-box; }

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

html { background: var(--bg-0); }

body {
  min-height: 100vh;
  overflow: hidden;
  color: var(--text-1);
  font-family: var(--font-sans);
  background:
    linear-gradient(135deg, #050814 0%, #07111f 46%, #0c1020 100%);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input {
  font: inherit;
}

button { -webkit-tap-highlight-color: transparent; }

/* Background stage */
.stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  isolation: isolate;
}

.stage::before {
  content: "";
  position: absolute;
  inset: -22%;
  background:
    conic-gradient(from 130deg at 30% 38%,
      rgba(32,167,244,.34),
      rgba(124,92,255,.18),
      rgba(34,211,166,.18),
      rgba(32,167,244,.34)),
    linear-gradient(120deg, rgba(255,255,255,.08), transparent 34%, rgba(255,255,255,.05) 66%, transparent);
  filter: blur(52px) saturate(1.1);
  opacity: .72;
  transform: translate3d(0,0,0) rotate(0deg);
  animation: stageFlow 34s linear infinite;
  will-change: transform;
}

.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(180deg, transparent 0%, rgba(5,8,20,.36) 100%);
  background-size: 64px 64px, 64px 64px, 100% 100%;
  mask-image: linear-gradient(to bottom, transparent 0%, #000 18%, #000 78%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 18%, #000 78%, transparent 100%);
  opacity: .82;
  animation: gridSlide 42s linear infinite;
  will-change: background-position;
}

.aurora,
.grid,
.particles,
.shooting-star {
  position: absolute;
  inset: 0;
}

.aurora {
  opacity: .5;
  background:
    linear-gradient(100deg, transparent 10%, rgba(32,167,244,.2) 28%, transparent 44%),
    linear-gradient(72deg, transparent 46%, rgba(124,92,255,.2) 62%, transparent 78%);
  transform: translate3d(-4%, 0, 0);
  animation: ribbonDrift 18s var(--ease) infinite alternate;
  will-change: transform, opacity;
}

.aurora-2 {
  opacity: .28;
  transform: translate3d(6%, 0, 0) scaleX(1.1);
  animation-duration: 24s;
  animation-delay: -8s;
}

.aurora-3 {
  opacity: .2;
  transform: translate3d(0, 5%, 0) scaleY(1.2);
  animation-duration: 30s;
  animation-delay: -15s;
}

.grid { display: none; }

.particles {
  background-image:
    radial-gradient(circle at 16% 24%, rgba(255,255,255,.34) 0 1px, transparent 1.5px),
    radial-gradient(circle at 80% 18%, rgba(255,255,255,.22) 0 1px, transparent 1.5px),
    radial-gradient(circle at 24% 78%, rgba(255,255,255,.2) 0 1px, transparent 1.5px),
    radial-gradient(circle at 68% 72%, rgba(255,255,255,.18) 0 1px, transparent 1.5px);
  background-size: 220px 180px, 260px 210px, 300px 240px, 240px 220px;
  opacity: .65;
  animation: particleDrift 28s linear infinite;
  will-change: transform;
}

.shooting-star,
.shooting-star-2 {
  inset: auto auto 22% -18%;
  width: 240px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.9), transparent);
  opacity: 0;
  transform: translate3d(0,0,0) rotate(-16deg);
  animation: starPass 11s linear infinite;
  will-change: transform, opacity;
}

.shooting-star-2 {
  bottom: 72%;
  animation-duration: 15s;
  animation-delay: -6s;
  opacity: 0;
}

@keyframes stageFlow {
  to { transform: translate3d(0,0,0) rotate(360deg); }
}

@keyframes gridSlide {
  to { background-position: 64px 64px, 64px 64px, 0 0; }
}

@keyframes ribbonDrift {
  from { transform: translate3d(-5%, -1%, 0) scale(1); opacity: .36; }
  to { transform: translate3d(5%, 2%, 0) scale(1.04); opacity: .62; }
}

@keyframes particleDrift {
  to { transform: translate3d(-90px, -70px, 0); }
}

@keyframes starPass {
  0%, 68% { opacity: 0; transform: translate3d(0,0,0) rotate(-16deg); }
  72% { opacity: .85; }
  84%, 100% { opacity: 0; transform: translate3d(138vw, -18vh, 0) rotate(-16deg); }
}

/* Layout */
.login-stage {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px;
  perspective: 1200px;
}

.login-card {
  --rx: 0deg;
  --ry: 0deg;
  --glow-x: 50%;
  --glow-y: 0%;
  position: relative;
  width: min(100%, 444px);
  border-radius: 28px;
  transform: translate3d(0,0,0) rotateX(var(--rx)) rotateY(var(--ry));
  transform-style: preserve-3d;
  transition: transform .42s var(--ease-soft), filter .42s var(--ease);
  will-change: transform;
}

.login-card:hover {
  filter: brightness(1.03);
}

.card-border {
  position: absolute;
  inset: -1px;
  z-index: 0;
  border-radius: 29px;
  overflow: hidden;
  pointer-events: none;
}

.card-border::before {
  content: "";
  position: absolute;
  inset: -45%;
  background: conic-gradient(
    from 0deg,
    rgba(32,167,244,.0),
    rgba(32,167,244,.95),
    rgba(124,92,255,.9),
    rgba(34,211,166,.75),
    rgba(32,167,244,.0)
  );
  opacity: .62;
  transform: translate3d(0,0,0) rotate(0deg);
  animation: borderOrbit 10s linear infinite;
  will-change: transform;
}

.card-border::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 27px;
  background: var(--panel-strong);
}

@keyframes borderOrbit {
  to { transform: translate3d(0,0,0) rotate(360deg); }
}

.card-inner {
  position: relative;
  z-index: 1;
  padding: 38px 38px 30px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 27px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.075), transparent 32%),
    radial-gradient(circle at var(--glow-x) var(--glow-y), rgba(32,167,244,.18), transparent 42%),
    rgba(8,14,28,.82);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.08);
  backdrop-filter: blur(22px) saturate(1.35);
  -webkit-backdrop-filter: blur(22px) saturate(1.35);
  transform: translateZ(0);
}

.card-inner::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(120deg, rgba(255,255,255,.12), transparent 26%, transparent 68%, rgba(255,255,255,.06));
  opacity: .55;
  pointer-events: none;
}

.brand,
.card-head,
.login-alert,
.login-form,
.card-foot {
  position: relative;
  z-index: 1;
}

/* Brand */
.brand {
  display: flex;
  justify-content: center;
  margin-bottom: 26px;
}

.brand-logo-wrap {
  position: relative;
  display: grid;
  min-width: 150px;
  min-height: 74px;
  place-items: center;
  padding: 14px 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(255,255,255,.09), rgba(255,255,255,.035));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 16px 42px rgba(0,0,0,.24);
  overflow: hidden;
}

.brand-logo-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.14), transparent);
  transform: translate3d(-110%, 0, 0);
  animation: logoSweep 5.5s var(--ease) infinite;
  will-change: transform;
}

.brand-logo {
  position: relative;
  display: block;
  max-width: 138px;
  max-height: 52px;
  object-fit: contain;
  filter: drop-shadow(0 8px 18px rgba(32,167,244,.28));
}

.brand-pulse { display: none; }

@keyframes logoSweep {
  0%, 52% { transform: translate3d(-110%, 0, 0); }
  72%, 100% { transform: translate3d(110%, 0, 0); }
}

/* Header */
.card-head {
  margin-bottom: 26px;
  text-align: center;
}

.card-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 0 10px;
  color: var(--text-1);
  font-size: clamp(26px, 4vw, 31px);
  font-weight: 820;
  letter-spacing: 0;
  line-height: 1.12;
}

.title-line,
.card-sub,
.field,
.form-row,
.btn-submit,
.card-foot {
  opacity: 0;
  animation: riseIn .72s var(--ease-soft) forwards;
}

.title-line-1 { animation-delay: .06s; }
.title-line-2 { animation-delay: .16s; }
.card-sub { animation-delay: .26s; }
.field:nth-of-type(1) { animation-delay: .34s; }
.field:nth-of-type(2) { animation-delay: .42s; }
.form-row { animation-delay: .5s; }
.btn-submit { animation-delay: .58s; }
.card-foot { animation-delay: .66s; }

.hl {
  color: transparent;
  background: linear-gradient(120deg, #ffffff 0%, #8edcff 42%, #b8a7ff 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.card-sub {
  margin: 0;
  color: var(--text-3);
  font-size: 13px;
}

@keyframes riseIn {
  from { opacity: 0; transform: translate3d(0, 10px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

/* Alert */
.login-alert {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  margin-bottom: 20px;
  padding: 10px 12px;
  border: 1px solid rgba(239,68,68,.28);
  border-radius: 14px;
  color: #fecaca;
  background: rgba(127,29,29,.24);
  font-size: 13px;
  font-weight: 560;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
  animation: alertIn .35s var(--ease), alertNudge .34s var(--ease) .08s;
  transition: opacity .45s var(--ease);
}

.login-alert i {
  flex: 0 0 auto;
  color: #fb7185;
}

.login-alert span { flex: 1; }

.login-alert__close {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 9px;
  color: var(--text-3);
  background: transparent;
  cursor: pointer;
  transition: color .2s var(--ease), background .2s var(--ease);
}

.login-alert__close:hover {
  color: var(--text-1);
  background: rgba(255,255,255,.08);
}

@keyframes alertIn {
  from { opacity: 0; transform: translate3d(0, -6px, 0); }
}

@keyframes alertNudge {
  0%, 100% { transform: translate3d(0,0,0); }
  32% { transform: translate3d(-5px,0,0); }
  64% { transform: translate3d(5px,0,0); }
}

/* Form */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.field__control {
  position: relative;
  display: flex;
  align-items: center;
}

.field__icon {
  position: absolute;
  left: 16px;
  z-index: 2;
  color: var(--text-3);
  font-size: 14px;
  pointer-events: none;
  transition: color .22s var(--ease), transform .22s var(--ease);
}

.field__input {
  width: 100%;
  height: 56px;
  padding: 19px 50px 7px 46px;
  border: 1px solid var(--line);
  border-radius: 16px;
  outline: 0;
  color: var(--text-1);
  background: rgba(3, 7, 18, .48);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
  font-size: 14px;
  font-weight: 540;
  transition:
    border-color .22s var(--ease),
    background-color .22s var(--ease),
    box-shadow .22s var(--ease),
    transform .22s var(--ease);
}

.field__input::placeholder { color: transparent; }

.field__input:hover {
  border-color: var(--line-strong);
  background: rgba(3, 7, 18, .56);
}

.field__input:focus {
  border-color: rgba(32,167,244,.74);
  background: rgba(3, 7, 18, .68);
  box-shadow: 0 0 0 4px var(--focus), inset 0 1px 0 rgba(255,255,255,.05);
}

.field__control:focus-within .field__icon {
  color: var(--brand);
  transform: translate3d(0, -1px, 0);
}

.field__label {
  position: absolute;
  left: 46px;
  top: 50%;
  z-index: 1;
  color: var(--text-3);
  font-size: 14px;
  font-weight: 520;
  pointer-events: none;
  transform: translate3d(0, -50%, 0) scale(1);
  transform-origin: left center;
  transition: transform .22s var(--ease-soft), color .22s var(--ease);
}

.field__input:focus + .field__label,
.field__input:not(:placeholder-shown) + .field__label,
.field__input:-webkit-autofill + .field__label {
  color: var(--brand);
  transform: translate3d(0, -18px, 0) scale(.78);
}

.field__underline {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 0;
  height: 1px;
  border-radius: 99px;
  background: linear-gradient(90deg, transparent, rgba(32,167,244,.85), transparent);
  opacity: 0;
  transform: scaleX(.25);
  transition: opacity .24s var(--ease), transform .32s var(--ease);
  pointer-events: none;
}

.field__control:focus-within .field__underline {
  opacity: 1;
  transform: scaleX(1);
}

.field__toggle {
  position: absolute;
  right: 9px;
  top: 50%;
  z-index: 2;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 12px;
  color: var(--text-3);
  background: transparent;
  cursor: pointer;
  transform: translate3d(0, -50%, 0);
  transition: color .2s var(--ease), background .2s var(--ease), transform .2s var(--ease);
}

.field__toggle:hover {
  color: var(--brand);
  background: rgba(32,167,244,.11);
}

.field__toggle:active { transform: translate3d(0, -50%, 0) scale(.97); }

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 30px;
  margin: 0 0 3px;
}

.forgot {
  color: #92d7ff;
  font-size: 12px;
  font-weight: 560;
  text-decoration: none;
  transition: color .2s var(--ease);
}

.forgot:hover { color: #ffffff; }

.check {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
}

.check input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.check__box {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: transparent;
  background: rgba(3,7,18,.46);
  font-size: 10px;
  transition: background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease), transform .2s var(--ease);
}

.check input:checked + .check__box {
  color: #03111d;
  border-color: transparent;
  background: linear-gradient(135deg, #9ae6ff, #39d7a4);
  transform: scale(1.04);
}

.check input:focus-visible + .check__box {
  box-shadow: 0 0 0 4px var(--focus);
}

.check__label {
  color: var(--text-2);
  font-size: 13px;
  font-weight: 530;
}

/* Submit */
.btn-submit {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 56px;
  margin-top: 8px;
  overflow: hidden;
  border: 0;
  border-radius: 16px;
  color: #ffffff;
  background:
    linear-gradient(135deg, #149eea 0%, #2563eb 52%, #7357ff 100%);
  box-shadow: 0 18px 42px rgba(37,99,235,.3), inset 0 1px 0 rgba(255,255,255,.24);
  cursor: pointer;
  font-size: 15px;
  font-weight: 760;
  letter-spacing: 0;
  transition: transform .2s var(--ease-soft), box-shadow .24s var(--ease), filter .24s var(--ease);
  will-change: transform;
}

.btn-submit::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.22), transparent);
  transform: translate3d(-110%, 0, 0) skewX(-18deg);
  transition: transform .75s var(--ease);
  pointer-events: none;
}

.btn-submit:hover {
  transform: translate3d(0, -2px, 0);
  box-shadow: 0 24px 56px rgba(37,99,235,.38), inset 0 1px 0 rgba(255,255,255,.28);
  filter: brightness(1.05);
}

.btn-submit:hover::before { transform: translate3d(110%, 0, 0) skewX(-18deg); }

.btn-submit:active { transform: translate3d(0, 0, 0) scale(.99); }

.btn-submit:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 4px var(--focus), 0 18px 42px rgba(37,99,235,.3);
}

.btn-submit__shine { display: none; }

.btn-submit__text,
.btn-submit__icon {
  position: relative;
  z-index: 1;
}

.btn-submit__icon {
  font-size: 13px;
  transition: transform .22s var(--ease-soft);
}

.btn-submit:hover .btn-submit__icon { transform: translate3d(5px, 0, 0); }

.btn-submit__loader {
  position: relative;
  z-index: 1;
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,.32);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.btn-submit.is-loading .btn-submit__text,
.btn-submit.is-loading .btn-submit__icon { display: none; }

.btn-submit.is-loading .btn-submit__loader { display: inline-block; }

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

/* Footer */
.card-foot {
  display: flex;
  justify-content: center;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.secure {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 560;
}

.secure i {
  color: var(--success);
  font-size: 10px;
}

/* Chrome autofill */
.field__input:-webkit-autofill,
.field__input:-webkit-autofill:hover,
.field__input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text-1);
  -webkit-box-shadow: 0 0 0 1000px rgba(3,7,18,.72) inset;
  caret-color: var(--text-1);
  transition: background-color 9999s ease-in-out 0s;
}

/* Responsive */
@media (max-width: 576px) {
  body { overflow: auto; }
  .login-stage {
    min-height: 100svh;
    padding: 16px;
    perspective: none;
  }
  .login-card {
    width: 100%;
    transform: none !important;
  }
  .card-inner {
    padding: 28px 22px 24px;
    border-radius: 25px;
  }
  .card-border { border-radius: 27px; }
  .card-title { font-size: 25px; }
  .brand-logo-wrap {
    min-width: 132px;
    min-height: 64px;
  }
  .brand-logo {
    max-width: 118px;
    max-height: 44px;
  }
  .form-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .001ms !important;
  }
  .login-card {
    transform: none !important;
  }
}
