/*
 * Banca Julian - Sign in / Create account page.
 * Markup: resources/views/frontend/auth/login.blade.php (one page, two panels).
 * Behaviour: public/frontend/customs/js/auth/auth.js
 *
 * The two forms share one card. ".is-register" on the card slides the sign-in form out,
 * swings the diagonal shapes across and slides the registration form in.
 * --S = delay step when the element enters, --D = delay step when it leaves.
 */

.bj-auth {
  --au-primary: #6366f1;
  --au-secondary: #06b6d4;
  --au-accent: #a855f7;
  --au-bg: #0b1120;
  --au-text: #e5e7eb;
  --au-muted: #9ca3af;
  --au-line: rgba(229, 231, 235, 0.35);
  --au-error: #fb7185;
  --au-w: 960px;
  --au-h: 640px;

  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: 88px 16px 40px;
  overflow: hidden;
  background:
    radial-gradient(700px 400px at 90% 10%, rgba(168, 85, 247, 0.22), transparent 70%),
    radial-gradient(600px 380px at 5% 95%, rgba(6, 182, 212, 0.16), transparent 70%),
    var(--au-bg);
  color: var(--au-text);
  font-family: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

/* Brand link back to the site */
.bj-auth__brand {
  position: absolute;
  top: 22px;
  left: 24px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #f3f4f6;
  font-size: 20px;
  font-weight: 700;
  text-decoration: none;
  z-index: 2;
}

.bj-auth__brand:hover {
  color: #fff;
}

.bj-auth__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(129, 140, 248, 0.4);
  border-radius: 10px;
  background: linear-gradient(135deg, #4f46e5, #9333ea);
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.35);
  color: #fff;
  font-size: 14px;
  letter-spacing: 0.05em;
}

/* Flash message */
.bj-auth__flash {
  width: 100%;
  max-width: var(--au-w);
  margin-bottom: 16px;
  padding: 12px 16px;
  border: 1px solid rgba(251, 113, 133, 0.45);
  border-radius: 12px;
  background: rgba(251, 113, 133, 0.12);
  color: #fecdd3;
  font-size: 14px;
}

.bj-auth__flash--success {
  border-color: rgba(52, 211, 153, 0.45);
  background: rgba(52, 211, 153, 0.12);
  color: #a7f3d0;
}

/* Card */
.bj-auth__card {
  position: relative;
  width: 100%;
  max-width: var(--au-w);
  height: var(--au-h);
  border: 2px solid rgba(99, 102, 241, 0.75);
  border-radius: 20px;
  background: var(--au-bg);
  box-shadow: 0 0 28px rgba(99, 102, 241, 0.45), 0 30px 60px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  /* clip: focusing a field must never scroll the card and shift the shapes */
  overflow: clip;
}

/* Diagonal shapes */
.bj-auth__shape {
  position: absolute;
  right: 0;
  top: -5px;
  width: 1120px;
  height: 860px;
  background: linear-gradient(45deg, #0b1120 10%, #4f46e5 55%, #a855f7 100%);
  transform: rotate(10deg) skewY(40deg);
  transform-origin: bottom right;
  transition: transform 1.5s ease 1.6s;
}

.bj-auth__card.is-register .bj-auth__shape {
  transform: rotate(0deg) skewY(0deg);
  transition-delay: 0.5s;
}

.bj-auth__shape2 {
  position: absolute;
  left: 330px;
  top: 100%;
  width: 1120px;
  height: 960px;
  border-top: 3px solid var(--au-accent);
  background: var(--au-bg);
  transform: rotate(0deg) skewY(0deg);
  transform-origin: bottom left;
  transition: transform 1.5s ease 0.5s;
}

.bj-auth__card.is-register .bj-auth__shape2 {
  transform: rotate(-11deg) skewY(-41deg);
  transition-delay: 1.2s;
}

/* Form panels */
.bj-auth__form {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  z-index: 1;
}

.bj-auth__form--login {
  left: 0;
  padding: 0 52px;
}

.bj-auth__form--register {
  right: 0;
  padding: 0 52px 0 60px;
}

.bj-auth .anim {
  transition: transform 0.7s ease, opacity 0.7s ease, filter 0.7s ease;
}

/* Sign-in panel: visible by default, leaves to the left */
.bj-auth__form--login .anim {
  transform: translateX(0);
  opacity: 1;
  transition-delay: calc(0.1s * var(--S));
}

.bj-auth__card.is-register .bj-auth__form--login .anim {
  transform: translateX(-120%);
  opacity: 0;
  transition-delay: calc(0.1s * var(--D));
}

/* Register panel: hidden on the right, enters with a blur */
.bj-auth__form--register .anim {
  transform: translateX(120%);
  opacity: 0;
  filter: blur(10px);
  transition-delay: calc(0.1s * var(--D));
}

.bj-auth__card.is-register .bj-auth__form--register .anim {
  transform: translateX(0);
  opacity: 1;
  filter: blur(0);
  transition-delay: calc(0.1s * var(--S));
}

/* The panel that is not shown must not be reachable with the keyboard */
.bj-auth__card:not(.is-register) .bj-auth__form--register,
.bj-auth__card.is-register .bj-auth__form--login {
  pointer-events: none;
}

.bj-auth__title {
  margin: 0 0 6px;
  font-size: 32px;
  font-weight: 700;
  color: #fff;
}

.bj-auth__subtitle {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--au-muted);
}

/* Floating-label fields */
.bj-auth__field {
  position: relative;
  width: 100%;
  margin-top: 22px;
}

.bj-auth__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.bj-auth__field input {
  width: 100%;
  height: 46px;
  padding: 14px 30px 0 0;
  border: 0;
  border-bottom: 2px solid var(--au-line);
  border-radius: 0;
  outline: none;
  background: transparent;
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  transition: border-color 0.4s ease;
}

.bj-auth__field input:-webkit-autofill,
.bj-auth__field input:-webkit-autofill:focus {
  -webkit-text-fill-color: #fff;
  -webkit-box-shadow: 0 0 0 1000px var(--au-bg) inset;
  transition: background-color 9999s ease;
}

.bj-auth__field label {
  position: absolute;
  top: 26px;
  left: 0;
  transform: translateY(-50%);
  color: var(--au-muted);
  font-size: 15px;
  pointer-events: none;
  transition: top 0.4s ease, font-size 0.4s ease, color 0.4s ease;
}

.bj-auth__field input:focus,
.bj-auth__field input:not(:placeholder-shown) {
  border-bottom-color: var(--au-primary);
}

.bj-auth__field input:focus ~ label,
.bj-auth__field input:not(:placeholder-shown) ~ label {
  top: 0;
  color: #a5b4fc;
  font-size: 12px;
}

.bj-auth__icon {
  position: absolute;
  top: 26px;
  right: 0;
  display: inline-flex;
  transform: translateY(-50%);
  color: var(--au-muted);
  transition: color 0.4s ease;
}

.bj-auth__field input:focus ~ .bj-auth__icon,
.bj-auth__field input:not(:placeholder-shown) ~ .bj-auth__icon {
  color: #a5b4fc;
}

button.bj-auth__icon {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

button.bj-auth__icon:focus-visible {
  outline: 2px solid var(--au-secondary);
  outline-offset: 2px;
}

.bj-auth__field.has-error input {
  border-bottom-color: var(--au-error);
}

.bj-auth__error,
.bj-auth .error {
  display: block;
  margin-top: 6px;
  color: var(--au-error);
  font-size: 12.5px;
  line-height: 1.4;
}

.bj-auth .text-success {
  display: block;
  margin-top: 6px;
  font-size: 12.5px;
}

/* Phone field (intl-tel-input keeps its own flag button, so the label sits above) */
.bj-auth__field--static label {
  position: static;
  display: block;
  margin-bottom: 4px;
  transform: none;
  color: #a5b4fc;
  font-size: 12px;
}

.bj-auth__field--static input {
  padding-top: 0;
}

.bj-auth .iti {
  width: 100%;
}

.bj-auth .iti__selected-dial-code,
.bj-auth .iti__arrow {
  color: #fff;
}

.bj-auth .iti__arrow {
  border-top-color: #fff;
}

/* Country list: rendered on <body> (dropdownContainer) above the card, in the same dark style */
.iti--container {
  z-index: 2000;
}

.iti--container .iti__country-list {
  position: static;
  width: 100%;
  max-height: 260px;
  margin-top: 6px;
  border: 1px solid rgba(99, 102, 241, 0.5);
  border-radius: 12px;
  background: #111827;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  color: #e5e7eb;
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-size: 14px;
  white-space: normal;
}

.iti--container .iti__country {
  padding: 8px 12px;
}

.iti--container .iti__country.iti__highlight {
  background: rgba(99, 102, 241, 0.25);
}

.iti--container .iti__dial-code {
  color: #9ca3af;
}

.iti--container .iti__divider {
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

.bj-auth .iti--separate-dial-code .iti__selected-flag {
  border-radius: 8px 0 0 8px;
  background: rgba(255, 255, 255, 0.06);
}

.bj-auth .iti--separate-dial-code .iti__selected-flag:hover,
.bj-auth .iti--separate-dial-code .iti__selected-flag:focus {
  background: rgba(99, 102, 241, 0.2);
}

.bj-auth .iti input::placeholder {
  color: rgba(229, 231, 235, 0.35);
}

/* Links and options */
.bj-auth__options {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
  font-size: 13.5px;
}

.bj-auth__link,
.bj-auth__options a {
  color: #a5b4fc;
  font-weight: 600;
  text-decoration: none;
}

.bj-auth__link:hover,
.bj-auth__options a:hover {
  color: #c7d2fe;
  text-decoration: underline;
}

.bj-auth__switch {
  margin: 18px 0 0;
  font-size: 14px;
  text-align: center;
  color: var(--au-muted);
}

.bj-auth__captcha {
  margin-top: 18px;
  transform-origin: left top;
}

/* Button: the gradient slides in on hover */
.bj-auth__btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 48px;
  margin-top: 26px;
  border: 2px solid var(--au-primary);
  border-radius: 40px;
  background: transparent;
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  overflow: hidden;
  z-index: 1;
}

.bj-auth__btn::before {
  content: "";
  position: absolute;
  top: -100%;
  left: 0;
  width: 100%;
  height: 300%;
  background: linear-gradient(var(--au-bg), var(--au-primary), var(--au-bg), var(--au-accent));
  transition: top 0.5s ease;
  z-index: -1;
}

.bj-auth__btn:hover::before,
.bj-auth__btn:focus-visible::before {
  top: 0;
}

.bj-auth__btn:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

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

.bj-auth__btn.is-loading .bj-auth__spinner {
  display: inline-block;
}

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

/* Demo shortcuts (demo environment only) */
.bj-auth__demo {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.bj-auth__demo button,
.bj-auth__demo a {
  height: 34px;
  border: 1px solid var(--au-line);
  border-radius: 10px;
  background: transparent;
  color: var(--au-text);
  font-size: 13px;
  line-height: 32px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

/* Welcome panels */
.bj-auth__info {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  z-index: 1;
  pointer-events: none;
}

.bj-auth__info h2 {
  margin: 0 0 12px;
  color: #fff;
  font-size: 38px;
  font-weight: 700;
  line-height: 1.15;
  text-transform: uppercase;
}

.bj-auth__info p {
  margin: 0;
  color: #e0e7ff;
  font-size: 16px;
  line-height: 1.6;
}

.bj-auth__info--login {
  right: 0;
  padding: 0 44px 80px 190px;
  text-align: right;
}

.bj-auth__info--login .anim {
  transform: translateX(0);
  opacity: 1;
  filter: blur(0);
  transition-delay: calc(0.1s * var(--S));
}

.bj-auth__card.is-register .bj-auth__info--login .anim {
  transform: translateX(120%);
  opacity: 0;
  filter: blur(10px);
  transition-delay: calc(0.1s * var(--D));
}

.bj-auth__info--register {
  left: 0;
  padding: 0 190px 80px 44px;
  text-align: left;
}

.bj-auth__info--register .anim {
  transform: translateX(-120%);
  opacity: 0;
  filter: blur(10px);
  transition-delay: calc(0.1s * var(--D));
}

.bj-auth__card.is-register .bj-auth__info--register .anim {
  transform: translateX(0);
  opacity: 1;
  filter: blur(0);
  transition-delay: calc(0.1s * var(--S));
}

/* First paint: show the requested panel without playing the animation */
.bj-auth__card.no-anim *,
.bj-auth__card.no-anim .anim {
  transition: none !important;
}

/* Step 2 of the registration: a single centred panel */
.bj-auth__card--single {
  max-width: 560px;
  height: auto;
  padding: 44px 48px;
  background:
    radial-gradient(420px 220px at 100% 0%, rgba(168, 85, 247, 0.25), transparent 70%),
    var(--au-bg);
}

/* Account type switch in registration step 1 (Personal / Business) */
.bj-auth__seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-top: 18px;
  padding: 4px;
  border: 1px solid var(--au-line);
  border-radius: 999px;
}

.bj-auth__seg input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.bj-auth__seg label {
  margin: 0;
  padding: 8px 10px;
  border-radius: 999px;
  color: var(--au-muted);
  font-size: 13.5px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.bj-auth__seg input:checked + label {
  background: var(--au-primary);
  color: #fff;
}

.bj-auth__seg input:focus-visible + label {
  outline: 2px solid var(--au-secondary);
  outline-offset: 2px;
}

.bj-auth__seg-hint {
  margin: 8px 0 0;
  color: var(--au-muted);
  font-size: 12.5px;
  line-height: 1.4;
  text-align: center;
}

.bj-auth__types {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 22px;
}

.bj-auth__types input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.bj-auth__type {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 14px;
  border: 2px solid var(--au-line);
  border-radius: 16px;
  color: var(--au-text);
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
}

.bj-auth__type small {
  color: var(--au-muted);
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.4;
}

.bj-auth__type svg {
  color: #a5b4fc;
}

.bj-auth__types input:checked + .bj-auth__type {
  border-color: var(--au-primary);
  background: rgba(99, 102, 241, 0.12);
  box-shadow: 0 0 18px rgba(99, 102, 241, 0.35);
}

.bj-auth__types input:focus-visible + .bj-auth__type {
  outline: 2px solid var(--au-secondary);
  outline-offset: 2px;
}

.bj-auth__terms {
  margin: 20px 0 0;
  color: var(--au-muted);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.bj-auth__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 18px;
  color: var(--au-muted);
  font-size: 14px;
  text-decoration: none;
}

.bj-auth__back:hover {
  color: #fff;
}

/* Medium screens: slightly smaller card */
@media (max-width: 1000px) {
  .bj-auth {
    --au-w: 860px;
  }

  .bj-auth__form--login,
  .bj-auth__form--register {
    padding: 0 36px;
  }

  .bj-auth__info--login {
    padding: 0 32px 80px 150px;
  }

  .bj-auth__info--register {
    padding: 0 150px 80px 32px;
  }

  .bj-auth__info h2 {
    font-size: 32px;
  }
}

/* Phones and tablets: one form at a time, no diagonal shapes */
@media (max-width: 820px) {
  .bj-auth {
    padding-top: 84px;
  }

  .bj-auth__card {
    max-width: 480px;
    height: auto;
    padding: 36px 24px 32px;
    background:
      radial-gradient(360px 200px at 100% 0%, rgba(168, 85, 247, 0.25), transparent 70%),
      var(--au-bg);
  }

  .bj-auth__shape,
  .bj-auth__shape2,
  .bj-auth__info {
    display: none;
  }

  .bj-auth__form {
    position: static;
    width: 100%;
    height: auto;
    padding: 0 !important;
  }

  .bj-auth .anim {
    transform: none !important;
    opacity: 1 !important;
    filter: none !important;
    transition: none !important;
  }

  .bj-auth__card:not(.is-register) .bj-auth__form--register,
  .bj-auth__card.is-register .bj-auth__form--login {
    display: none;
  }

  .bj-auth__card--single {
    padding: 32px 24px;
  }
}

@media (max-width: 420px) {
  .bj-auth__row,
  .bj-auth__types {
    grid-template-columns: 1fr;
  }

  .bj-auth__row {
    row-gap: 0;
  }

  .bj-auth__title {
    font-size: 28px;
  }

  .bj-auth__captcha {
    transform: scale(0.88);
  }
}

@media (prefers-reduced-motion: reduce) {
  .bj-auth *,
  .bj-auth .anim {
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
}
