:root {
  --auth-bg-1: #050b18;
  --auth-bg-2: #0a1630;
  --auth-card: rgba(9, 17, 34, 0.74);
  --auth-border: rgba(255, 255, 255, 0.12);
  --auth-text: #f4f8ff;
  --auth-muted: rgba(227, 236, 255, 0.74);
  --auth-primary: #4a7aff;
  --auth-secondary: #c043e5;
  --auth-cyan: #50dfdb;
  --auth-danger: #ff6f91;
  --auth-success: #4ee49b;
  --auth-radius-lg: 22px;
  --auth-radius-md: 14px;
  --auth-shadow: 0 20px 55px rgba(3, 8, 20, 0.55);
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  color: var(--auth-text);
  background:
    radial-gradient(1200px 700px at 15% 10%, rgba(80, 223, 219, 0.12), transparent 65%),
    radial-gradient(1000px 600px at 90% 20%, rgba(192, 67, 229, 0.16), transparent 70%),
    linear-gradient(145deg, var(--auth-bg-1), var(--auth-bg-2));
  background-attachment: fixed;
  background-size: 140% 140%;
  animation: ambientGradient 18s ease-in-out infinite;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  font-family: "Bahnschrift", "Segoe UI", sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin: 0;
  padding: 84px 0;
  min-height: auto;
  position: relative;
  z-index: 2;
  overflow-x: clip;
  width: 100%;
}

#classic-signup {
  width: min(1080px, 94vw);
  margin: 0 auto;
  padding: 24px 0;
  position: relative;
}

#multiStepForm {
  width: 100%;
  box-sizing: border-box;
  margin: 0 auto;
  padding: clamp(24px, 3vw, 34px);
  border-radius: var(--auth-radius-lg);
  border: 1px solid var(--auth-border);
  background: var(--auth-card);
  box-shadow: var(--auth-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
  animation: cardReveal 0.65s ease both;
}

#multiStepForm::before,
#multiStepForm::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

#multiStepForm::before {
  top: -120px;
  left: -120px;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(80, 223, 219, 0.28), transparent 70%);
}

#multiStepForm::after {
  bottom: -120px;
  right: -100px;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(74, 122, 255, 0.28), transparent 70%);
}

#multiStepForm h2 {
  margin: 2px 0 18px;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-align: center;
  color: var(--auth-text);
  font-size: clamp(1.35rem, 2vw, 1.75rem);
}

.progress-bar-container {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  margin-bottom: 24px;
  height: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--auth-primary), var(--auth-secondary));
  border-radius: 999px;
  transition: width 0.3s ease;
  position: relative;
}

.progress-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent, rgba(255, 255, 255, 0.26), transparent);
  transform: translateX(-120%);
  animation: lineShine 2.2s linear infinite;
}

.step {
  display: none;
  animation: fadeInStep 0.45s ease forwards;
}

.step.active {
  display: block;
}

.groupe {
  margin-bottom: 18px;
}

/* Modern profile image uploader (round preview + hidden file input) */
.profile-preview-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}
.profile-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(2,6,23,0.45);
  border: 1px solid rgba(255,255,255,0.04);
}
.profile-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.profile-preview .placeholder {
  font-size: 28px;
  color: rgba(234,246,255,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Hidden native file input, make a modern button */
#profile_image { display: none; }
.profile-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(100deg, var(--auth-primary), var(--auth-secondary));
  color: white;
  border: none;
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(74,122,255,0.12);
}
.profile-upload-actions { display:flex; gap:10px; align-items:center; }

/* subtle note text */
.profile-upload-note { color: var(--auth-muted); font-size: 0.9rem; }

.groupe label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
  color: var(--auth-muted);
  font-size: 0.95rem;
}

.groupe input[type="text"],
.groupe input[type="email"],
.groupe input[type="password"],
.groupe input[type="file"],
.groupe textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--auth-radius-md);
  background: rgba(7, 14, 28, 0.9);
  color: var(--auth-text);
  padding: 13px 14px;
  font-size: 0.98rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.username-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.username-status .username-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--auth-cyan);
  animation: spin 0.9s linear infinite;
  display: inline-block;
}

.username-status .username-msg {
  font-size: 0.9rem;
  color: var(--auth-muted);
  display: inline-block;
  font-weight: 800;
}

.username-status .username-msg.ok {
  color: var(--auth-success) !important;
}

.username-status .username-msg.bad {
  color: var(--auth-danger) !important;
}

.groupe input[type="file"] {
  padding: 10px 12px;
}

.groupe input:focus,
.groupe textarea:focus {
  outline: none;
  border-color: rgba(80, 223, 219, 0.9);
  box-shadow: 0 0 0 3px rgba(80, 223, 219, 0.2);
  transform: translateY(-1px);
}

.groupe.double-inputs {
  display: flex;
  gap: 14px;
}

.groupe.double-inputs > div {
  flex: 1;
}

.multi-buttons {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.multi-buttons button,
.signup-landing-actions a {
  flex: 1;
  border: 0;
  border-radius: 13px;
  min-height: 50px;
  padding: 12px 14px;
  font-weight: 700;
  font-size: 0.97rem;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.22s ease, filter 0.22s ease, background 0.22s ease;
  position: relative;
  overflow: hidden;
}

.multi-buttons button::after,
.signup-landing-actions a::after {
  content: "";
  position: absolute;
  top: 0;
  left: -140%;
  width: 70%;
  height: 100%;
  background: linear-gradient(110deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-18deg);
  transition: left 0.55s ease;
}

.multi-buttons button:hover::after,
.signup-landing-actions a:hover::after {
  left: 180%;
}

.btn-connexion {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.2);
}

.btn-next {
  color: #fff;
  background: linear-gradient(100deg, var(--auth-primary), var(--auth-secondary));
  box-shadow: 0 14px 28px rgba(74, 122, 255, 0.28);
}

.btn-prev {
  color: #fff;
  background: linear-gradient(100deg, #ff6b7f, #ff4f66);
  box-shadow: 0 14px 28px rgba(255, 79, 102, 0.25);
}

.btn-next:disabled,
#btnNextStep1:disabled {
  color: rgba(230, 236, 245, 0.8);
  background: linear-gradient(100deg, #5c6278, #4a5064);
  box-shadow: none;
  cursor: not-allowed;
  filter: grayscale(0.25);
  opacity: 0.82;
}

.btn-next:disabled:hover,
#btnNextStep1:disabled:hover {
  transform: none;
  filter: grayscale(0.25);
}

.btn-connexion:hover,
.btn-next:hover,
.btn-prev:hover,
.btn-connexion:focus-visible,
.btn-next:focus-visible,
.btn-prev:focus-visible {
  transform: translateY(-2px);
  filter: brightness(1.02);
}

.signup-landing {
  width: min(980px, 94vw);
  margin: 0 auto 22px;
}

.signup-landing-inner {
  border-radius: var(--auth-radius-lg);
  border: 1px solid var(--auth-border);
  background: var(--auth-card);
  box-shadow: var(--auth-shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: clamp(24px, 3vw, 34px);
  text-align: center;
  animation: cardReveal 0.65s ease both;
}

.signup-landing-inner h1 {
  margin: 0 0 8px;
  font-size: clamp(1.45rem, 2.2vw, 2rem);
}

.signup-landing-inner p {
  margin: 0;
  color: var(--auth-muted);
  line-height: 1.55;
}

.signup-landing-actions {
  display: flex;
  gap: 10px;
  margin: 20px 0 12px;
}

.signup-landing-actions a {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-ghost {
  color: var(--auth-text);
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
}

.btn-google {
  color: #0f172a;
  background: #fff;
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.2);
}

.muted a {
  color: var(--auth-cyan);
  text-decoration: none;
  font-weight: 700;
}

.muted a:hover {
  text-decoration: underline;
}

#popup-inscription {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(3, 8, 20, 0.78);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: #fff;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.loader-circle {
  width: 112px;
  height: 112px;
  border: 10px solid rgba(80, 223, 219, 0.28);
  border-top: 10px solid var(--auth-cyan);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  position: relative;
}

.loader-percent {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(18px, 2.6vw, 24px);
  font-weight: 700;
}

#popup-text {
  margin-top: 18px;
  font-size: clamp(15px, 2vw, 20px);
  text-align: center;
  color: var(--auth-text);
}

@font-face {
  font-family: "Bahnschrift";
  src: url("https://db.onlinewebfonts.com/t/0a6ee448d1bd65c56f6cf256a7c6f20a.ttf") format("truetype");
  font-display: swap;
}

@media (max-width: 900px) {
  body {
    background-attachment: scroll;
  }

  .groupe.double-inputs,
  .multi-buttons,
  .signup-landing-actions {
    flex-direction: column;
  }

  #classic-signup,
  .signup-landing {
    width: 94vw;
  }

  #multiStepForm,
  .signup-landing-inner {
    border-radius: 16px;
  }
}

@media (max-width: 700px) {
  .main-content {
    padding: 70px 0;
    flex: 0 0 auto;
  }

  #classic-signup,
  .signup-landing {
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
  }

  #multiStepForm,
  .signup-landing-inner {
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
  }
}

@media (max-width: 560px) {
  .main-content {
    padding: 66px 0;
    flex: 0 0 auto;
  }

  #classic-signup,
  .signup-landing {
    width: 96vw;
    max-width: 390px;
  }

  #multiStepForm,
  .signup-landing-inner {
    padding: 18px 14px;
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
  }

  .groupe {
    margin-bottom: 14px;
  }

  .groupe input[type="text"],
  .groupe input[type="email"],
  .groupe input[type="password"],
  .groupe input[type="file"],
  .groupe textarea {
    padding: 12px;
  }

  .groupe textarea {
    min-height: 140px;
  }

  .multi-buttons button,
  .signup-landing-actions a {
    min-height: 46px;
    font-size: 0.93rem;
  }
}

/* popup loader centered percent */

#popup-inscription {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 30000;
  background: linear-gradient(rgba(2,6,23,0.6), rgba(2,6,23,0.6));
}

/* centered card containing the rotating ring and percentage */
.loader-wrap {
  width: 160px;
  padding: 18px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(12,16,30,0.98), rgba(6,10,22,0.98));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(3,8,20,0.7);
  gap: 12px;
}

.loader-stage { position: relative; width: 90px; height: 90px; }
.loader-circle {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* visible rotating ring implemented with conic-gradient for smooth modern look */

.loader-rotator {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(var(--auth-primary), var(--auth-secondary) 45%, rgba(255,255,255,0.06) 100%);
  animation: rotateRing 1.1s linear infinite;
}
.loader-rotator::before {
  /* create a clean inner hole so the ring looks uniform */
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% - 20px);
  height: calc(100% - 20px);
  border-radius: 50%;
  background: transparent;
  box-shadow: 0 0 0 9999px rgba(6,10,18,0.0); /* ensures compositing behaves consistently */
  mix-blend-mode: normal;
}

.loader-core {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.02), rgba(3,8,30,0.98));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(2,6,23,0.5);
  border: 1px solid rgba(255,255,255,0.035);
}

.loader-percent {
  position: relative;
  font-weight: 900;
  color: #eaf6ff;
  font-size: 18px;
  line-height: 1;
}

.loader-text {
  margin: 0;
  color: var(--auth-muted);
  font-size: 0.88rem;
  text-align: center;
}

/* Success modal (blocking, centered) */
#success-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 40000;
  align-items: center;
  justify-content: center;
  background: rgba(2,6,23,0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: auto;
}
#success-modal .modal-card {
  width: min(720px, 92vw);
  max-width: 520px;
  background: linear-gradient(180deg, rgba(10,14,26,0.98), rgba(6,10,18,0.95));
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 30px 80px rgba(2,6,20,0.75);
  border: 1px solid rgba(255,255,255,0.04);
  text-align: center;
}
#success-modal .modal-title {
  font-size: 1.18rem;
  font-weight: 900;
  margin-bottom: 8px;
  color: var(--auth-text);
}
#success-modal .modal-body {
  color: var(--auth-muted);
  font-size: 0.98rem;
  margin-bottom: 18px;
  line-height: 1.45;
}
#success-modal .modal-actions { display:flex; gap:10px; justify-content:center; }
#success-modal .btn-primary {
  background: linear-gradient(100deg, var(--auth-primary), var(--auth-secondary));
  color: white;
  padding: 10px 14px;
  border-radius: 10px;
  border: 0;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease;
}
#success-modal .btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.03);
}
#success-modal .btn-secondary {
  background: rgba(255,255,255,0.04);
  color: var(--auth-text);
  padding: 10px 14px;
  border-radius: 10px;
  border: 0;
}

@keyframes rotateRing { to { transform: rotate(360deg); } }

@media (max-width: 420px) {
  .main-content {
    padding: 64px 0;
    flex: 0 0 auto;
  }

  #classic-signup,
  .signup-landing {
    max-width: 340px;
  }

  #multiStepForm,
  .signup-landing-inner {
    max-width: 320px;
    padding: 14px 10px;
  }

  #multiStepForm h2 {
    font-size: 1.18rem;
    margin-bottom: 14px;
  }

  .progress-bar-container {
    margin-bottom: 16px;
    height: 10px;
  }

  .loader-circle {
    width: 90px;
    height: 90px;
    border-width: 8px;
  }

  .loader-percent {
    font-size: 1rem;
  }

  #popup-text {
    font-size: 0.95rem;
    padding: 0 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@keyframes fadeInStep {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cardReveal {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes ambientGradient {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

@keyframes lineShine {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(220%);
  }
}
