/* =========================================================
   Xfer360 — Portal Login
   Modern dark/blue theme, self-contained (no CDN deps)
   ========================================================= */

/* ---------- Tokens ---------- */
:root {
  --brand: #2f6bff;
  --brand-strong: #1a55e6;
  --brand-soft: #6ea0ff;
  --cyan: #37d5ff;

  --bg: #05070f;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text: #edf2ff;
  --text-dim: #9aa7c6;
  --text-faint: #8491b1;

  --danger: #ff6b6b;
  --danger-bg: rgba(255, 107, 107, 0.1);
  --success: #38d39f;
  --success-bg: rgba(56, 211, 159, 0.1);

  --radius-lg: 28px;
  --radius-md: 16px;
  --radius-sm: 12px;

  --font: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;

  --shadow-card: 0 40px 80px -40px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Ambient background: glows + fine grid */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

body::before {
  background:
    radial-gradient(900px 620px at 8% -12%, rgba(47, 107, 255, 0.28), transparent 62%),
    radial-gradient(760px 560px at 102% 6%, rgba(55, 213, 255, 0.13), transparent 58%),
    radial-gradient(700px 520px at 46% 118%, rgba(47, 107, 255, 0.18), transparent 62%);
}

body::after {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(1100px 700px at 30% 10%, #000 0%, transparent 75%);
  mask-image: radial-gradient(1100px 700px at 30% 10%, #000 0%, transparent 75%);
  opacity: 0.7;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--brand-soft);
}

:focus-visible {
  outline: 2px solid var(--brand-soft);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 20;
  padding: 10px 16px;
  border-radius: 10px;
  background: #fff;
  color: #060b17;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 16px;
}

/* ---------- Shell ---------- */
.auth {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.02fr 1fr;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---------- Brand panel (desktop) ---------- */
.brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 48px;
  padding: 56px 64px;
  overflow: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  background:
    radial-gradient(680px 520px at 22% 18%, rgba(47, 107, 255, 0.24), transparent 68%),
    linear-gradient(180deg, rgba(9, 14, 30, 0.55), rgba(4, 6, 14, 0.15));
}

.brand__logo {
  width: 168px;
  height: auto;
  filter: drop-shadow(0 16px 40px rgba(0, 0, 0, 0.55));
}

.brand__copy {
  max-width: 520px;
}

.brand__chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #cbdcff;
  background: rgba(47, 107, 255, 0.12);
  border: 1px solid rgba(110, 160, 255, 0.28);
  border-radius: 999px;
}

.brand__chip::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 4px rgba(55, 213, 255, 0.16);
}

.brand__title {
  margin: 0 0 18px;
  font-size: clamp(30px, 3.2vw, 44px);
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}

.brand__title span {
  background: linear-gradient(96deg, #7aa6ff 0%, #37d5ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand__text {
  margin: 0;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-dim);
}

.brand__footer {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: var(--text-faint);
}

.brand__signal {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 26px;
}

.brand__signal i {
  display: block;
  width: 5px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--cyan), var(--brand));
  transform-origin: bottom;
  animation: signal 2.6s ease-in-out infinite;
}

.brand__signal i:nth-child(1) {
  height: 12px;
  animation-delay: 0s;
}
.brand__signal i:nth-child(2) {
  height: 22px;
  animation-delay: 0.18s;
}
.brand__signal i:nth-child(3) {
  height: 16px;
  animation-delay: 0.36s;
}
.brand__signal i:nth-child(4) {
  height: 26px;
  animation-delay: 0.54s;
}

@keyframes signal {
  0%,
  100% {
    transform: scaleY(0.65);
    opacity: 0.7;
  }
  50% {
    transform: scaleY(1);
    opacity: 1;
  }
}

/* Soft rotating ring ornament */
.brand__orb {
  position: absolute;
  right: -180px;
  bottom: -180px;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  border: 1px solid rgba(110, 160, 255, 0.16);
  box-shadow:
    0 0 0 60px rgba(47, 107, 255, 0.05),
    0 0 0 130px rgba(47, 107, 255, 0.03);
  pointer-events: none;
}

/* ---------- Form panel ---------- */
.panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 48px 32px;
  position: relative;
  z-index: 1;
}

.panel__brand {
  display: none;
}

.card {
  width: 100%;
  max-width: 448px;
  padding: 40px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(19, 26, 46, 0.82), rgba(9, 13, 26, 0.88));
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: var(--shadow-card);
  animation: rise 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.card__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-soft);
}

.card__eyebrow svg {
  width: 14px;
  height: 14px;
}

.card__title {
  margin: 0 0 8px;
  font-size: 26px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: #fff;
}

.card__subtitle {
  margin: 0 0 28px;
  font-size: 14.5px;
  color: var(--text-dim);
}

/* ---------- Alerts ---------- */
.alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 20px;
  padding: 13px 15px;
  font-size: 13.5px;
  line-height: 1.5;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  animation: rise 0.3s ease both;
}

.alert svg {
  flex: none;
  width: 17px;
  height: 17px;
  margin-top: 1px;
}

.alert--error {
  color: #ffc9c9;
  background: var(--danger-bg);
  border-color: rgba(255, 107, 107, 0.28);
}

.alert--success {
  color: #b6f3dd;
  background: var(--success-bg);
  border-color: rgba(56, 211, 159, 0.26);
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field__label {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #c3cde6;
}

.field__control {
  position: relative;
  display: flex;
  align-items: center;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.field__control:hover {
  border-color: var(--border-strong);
}

.field__control:focus-within {
  border-color: rgba(110, 160, 255, 0.75);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 4px rgba(47, 107, 255, 0.16);
}

.field__icon {
  position: absolute;
  left: 16px;
  width: 18px;
  height: 18px;
  color: var(--text-faint);
  pointer-events: none;
  transition: color 0.18s ease;
}

.field__control:focus-within .field__icon {
  color: var(--brand-soft);
}

.field__input {
  width: 100%;
  height: 54px;
  padding: 0 16px 0 46px;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: var(--radius-md);
  outline: none;
  appearance: none;
}

.field__input::placeholder {
  color: #7b87a3;
}

/* keep autofill on-theme */
.field__input:-webkit-autofill,
.field__input:-webkit-autofill:hover,
.field__input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px #101728 inset;
  caret-color: var(--text);
}

.field--password .field__input {
  padding-right: 54px;
}

.field__toggle {
  position: absolute;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  color: var(--text-dim);
  background: transparent;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease;
}

.field__toggle:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

.field__toggle svg {
  width: 19px;
  height: 19px;
}

.field__toggle .icon-eye-off {
  display: none;
}

.field__toggle[aria-pressed="true"] .icon-eye {
  display: none;
}

.field__toggle[aria-pressed="true"] .icon-eye-off {
  display: block;
}

/* ---------- Button ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 54px;
  margin-top: 4px;
  padding: 0 20px;
  font: inherit;
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #fff;
  background: linear-gradient(180deg, #3f78ff, #1f5bef);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-md);
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 14px 30px -14px rgba(47, 107, 255, 0.9), 0 1px 0 rgba(255, 255, 255, 0.18) inset;
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.28) 50%, transparent 80%);
  transform: translateX(-120%);
  transition: transform 0.65s ease;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 18px 36px -14px rgba(47, 107, 255, 0.95), 0 1px 0 rgba(255, 255, 255, 0.18) inset;
}

.btn:hover::after {
  transform: translateX(120%);
}

.btn:active {
  transform: translateY(0);
  filter: brightness(0.97);
}

.btn__arrow {
  width: 18px;
  height: 18px;
  transition: transform 0.2s ease;
}

.btn:hover .btn__arrow {
  transform: translateX(3px);
}

.btn__spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.btn.is-loading {
  pointer-events: none;
}

.btn.is-loading .btn__label,
.btn.is-loading .btn__arrow {
  display: none;
}

.btn.is-loading .btn__spinner {
  display: block;
}

/* ---------- Card meta / footer ---------- */
.card__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 12.5px;
  color: var(--text-faint);
}

.card__meta svg {
  flex: none;
  width: 15px;
  height: 15px;
  color: var(--success);
}

.legal {
  max-width: 448px;
  margin: 0;
  font-size: 12.5px;
  text-align: center;
  color: #7c88a8;
}

.legal strong {
  color: #a6b1cc;
  font-weight: 600;
}

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .brand {
    padding: 44px 40px;
  }

  .brand__logo {
    width: 140px;
  }

  .card {
    padding: 34px;
  }
}

@media (max-width: 900px) {
  .auth {
    grid-template-columns: 1fr;
    place-items: center;
  }

  .brand {
    display: none;
  }

  .panel {
    width: 100%;
    max-width: 520px;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 40px 20px 32px;
    justify-content: center;
    gap: 26px;
  }

  .panel__brand {
    display: block;
    width: 132px;
    margin: 0 auto 2px;
    filter: drop-shadow(0 18px 34px rgba(0, 0, 0, 0.6));
  }

  .card {
    padding: 28px 22px;
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(19, 26, 46, 0.86), rgba(9, 13, 26, 0.92));
  }

  .card__title {
    font-size: 23px;
  }

  .card__subtitle {
    margin-bottom: 22px;
    font-size: 14px;
  }

  .legal {
    padding: 0 8px;
  }
}

@media (max-width: 420px) {
  .panel {
    padding: 28px 16px 24px;
    gap: 22px;
  }

  .card {
    padding: 24px 18px;
  }

  .panel__brand {
    width: 112px;
  }
}

/* ---------- Motion & contrast preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media (prefers-contrast: more) {
  :root {
    --border: rgba(255, 255, 255, 0.28);
    --text-dim: #c3cde6;
    --text-faint: #9aa7c6;
  }
}
