/* ================================
   7. FORMULAIRES
   ================================ */

/* ====== Style global pour tous les formulaires ====== */

/* 1) Inputs, selects et textarea (hors radios) */
form input:not([type="radio"]),
form select,
form textarea {
  width: 300px;
  padding: 0.75rem 1rem;
  border: 1px solid #444;
  border-radius: 6px;
  background-color: #2a2a2a;
  color: #e0e0e0;
  line-height: 1.4;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
  transition:
    border-color 0.2s ease,
    box-shadow    0.2s ease,
    background-color 0.2s ease;
  outline: none;
  box-sizing: border-box;
}

/* 2) Focus */
form input:focus,
form select:focus,
form textarea:focus {
  border-color: #888;
  background-color: #333;
  box-shadow: 0 0 5px rgba(136,136,136,0.5);
}

/* 3) Placeholder */
form input::placeholder,
form textarea::placeholder {
  color: #aaa;
  opacity: 1;
  font-style: italic;
}

/* ====== Radios ronds et robustes ====== */
input[type="radio"] {
  -webkit-appearance: none;
     -moz-appearance: none;
          appearance: none;
  display: inline-block;
  width: 1rem;
  height: 1rem;
  aspect-ratio: 1 / 1;          /* garantit le carré */
  margin: 0 0.5em 0 0;
  border: 2px solid #555;
  border-radius: 50%;
  background-color: #2a2a2a;
  position: relative;
  vertical-align: middle;
  cursor: pointer;
  box-sizing: border-box;
  flex: 0 0 auto;               /* empêche l’écrasement en flex */
  transition: border-color 0.2s ease;
}

/* Pastille interne */
input[type="radio"]::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 50%;
  height: 50%;
  background-color: #0ff;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.12s ease;
}

input[type="radio"]:checked::before {
  transform: translate(-50%, -50%) scale(1);
}

/* Halo focus */
input[type="radio"]::after {
  content: "";
  position: absolute;
  top: -0.4rem;
  left: -0.4rem;
  width: calc(100% + 0.8rem);
  height: calc(100% + 0.8rem);
  border-radius: 50%;
  box-shadow: 0 0 5px rgba(0,255,255,0.4);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

input[type="radio"]:focus { outline: none; }

input[type="radio"]:focus-visible {
  outline: 2px solid rgba(0,255,255,0.6);
  outline-offset: 2px;
}

input[type="radio"]:focus::after { opacity: 1; }
input[type="radio"]:hover { border-color: #0cc; }

/* ====== Animation d'apparition du formulaire multi-étapes ====== */

/* caché par défaut */
.fade-form {
  display: none;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.3s ease, max-height 0.3s ease;
}

/* une fois inséré dans le flux */
.fade-form.showing {
  display: block;
}

/* visible (et laisse déborder le halo) */
.fade-form.visible {
  opacity: 1;
  max-height: 500px;  /* assez grand pour contenir le formulaire */
  overflow: visible;  /* permet le halo focus des radios */
}

/* ====== Groupes et centrages ====== */

/* Groupes génériques */
form .form-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin: 1.5rem;
}

/* Label de groupe */
form .form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: #ccc;
  font-weight: bold;
}

/* Centre un input "solo" (si besoin) */
.activation-group input {
  display: block;
  margin: 0 auto;
}

/* Groupe de genre (radio) */
.gender-form {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  justify-content: center;
  margin-top: .5rem;
}

/* ====== Contextes spécifiques ====== */
.game-interaction-box form .form-group {
  display: flex !important;
  flex-direction: column;
  align-items: center !important;
}
.game-interaction-box form .form-group input,
.game-interaction-box form .form-group select {
  width: 60% !important;
  max-width: 300px;
  margin: 0.5rem auto !important;
}

/* ====== Boutons + champs avec icône ====== */
.login-form .btn {
  width: 100%;
  max-width: 300px;
  display: block;
  margin: 1rem auto;
}

.input-with-icon {
  color: #0ff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.input-with-icon i {
  color: #0ff;
  width: 1.2rem;
  height: 1.2rem;
  flex-shrink: 0;
}

/* ====== Liens ====== */
.link-inline {
  color: #0ff;
  text-decoration: none;
  transition: color 0.2s ease;
}
.link-inline:hover {
  color: #4dcfff;
  text-decoration: underline;
}

/* ====== Étapes du formulaire ====== */
.form-step {
  display: none;              /* cachée par défaut */
  flex-direction: column;
  gap: 1rem;
  animation: fade 0.3s ease;
  align-items: center;        /* centre horizontalement le contenu */
  text-align: center;         /* centre labels et hints */
}

.form-step.active {
  display: flex;              /* visible */
}

/* éléments centrés dans chaque étape */
.form-step .input-with-icon { justify-content: center; }
.form-step input,
.form-step select,
.form-step textarea {
  margin-left: auto;
  margin-right: auto;
}

/* groupe de boutons de navigation */
.form-step .step-buttons {
  display: flex;
  gap: .75rem;
  justify-content: center;
}

/* éviter que label/hint s’étirent trop */
.form-step > label,
.form-step > .form-hint { width: 100%; }

.login-form label {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: block;
}

.form-hint {
  display: block;
  color: #aaa;
  margin-bottom: 0.3rem;
  margin-top: -0.4rem;
  font-size: 1.2rem;
}

/***************************************
   Overlay thèmes
****************************************/
.theme-checkboxes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  justify-content: center;
  justify-items: center;
  margin: 0 auto;
  max-width: 600px;
}

.theme-checkbox {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  width: 80px;
  box-sizing: border-box;
}

.theme-checkbox input[type="checkbox"] { display: none; }

.theme-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  text-align: center;
}

.theme-icon-small {
  width: 80px;
  height: 80px;
  color: #fff;            /* couleur par défaut de l’icône */
  fill: currentColor;     /* l’<svg> reprend currentColor */
  border: 3px solid transparent;
  border-radius: 10px;
  transition: color .2s, border .2s, transform .2s;
}

/* cible explicitement tous les paths / circles / polygons… */
.theme-icon-small path,
.theme-icon-small circle,
.theme-icon-small polygon,
.theme-icon-small rect {
  fill: currentColor !important;
}

/* état coché */
.theme-checkbox input:checked ~ .theme-content .theme-icon-small {
  color: #0ff;
  border-color: currentColor;
  box-shadow: 0 0 12px currentColor;
  transform: scale(1.1);
}

.theme-label {
  color: white;
  margin-top: 5px;
  font-size: 0.8em;
  text-align: center;
  text-transform: uppercase;
  pointer-events: none;
}

.theme-pack-block { margin-bottom: 1em; }

.theme-pack-title {
  color: white;
  margin-bottom: 0.5em;
  font-size: 1.1em;
  text-transform: uppercase;
  letter-spacing: 1px;
}

#cardCreationForm {
  max-height: 80vh;
  overflow-y: auto;
  padding-right: 1rem;
}

#constraints {
  min-height: 10rem;
  padding: 0.5rem;
  font-size: 1rem;
}

.gender-form label {
  display: inline-flex;       /* radio + texte sur la même ligne */
  align-items: center;
  gap: .5rem;
  width: auto !important;     /* annule tout width hérité */
  margin: 0;                  /* neutralise d'éventuels margins */
}
.gender-form input[type="radio"] {
  margin: 0 .5rem 0 0;        /* petit espace à droite du bouton */
}

/* Le conteneur du champ */
.password-group {
  position: relative;
  width: 100%;
  max-width: 300px;
}

/* Laisse de la place à droite pour le bouton œil */
.password-group input {
  width: 100%;
  padding-right: 3rem;           /* espace pour l’icône dedans */
}

/* Bouton œil INSIDE: occuppe la hauteur du champ, collé aux bords internes */
.reveal-btn {
  position: absolute;
  top: 1px;                      /* à l’intérieur de la bordure de l’input */
  right: 1px;
  height: calc(100% - 2px);      /* même hauteur visuelle que l’input */
  width: 2.5rem;                 /* assez large pour cliquer */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #2a2a2a;           /* même fond que l’input */
  border: 0;
  border-left: 1px solid #444;   /* petite séparation verticale */
  border-top-right-radius: 6px;  /* mêmes coins que l’input */
  border-bottom-right-radius: 6px;
  color: #0ff;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  margin-top: 0rem;
}

/* Focus/hover accessibles */
.reveal-btn:focus-visible { outline: 2px solid rgba(0,255,255,.6); outline-offset: 2px; }
.reveal-btn:hover { filter: brightness(1.05); }

.reveal-btn svg { width: 20px; height: 20px; pointer-events: none; }

/* espace à droite dans l'input */
.password-group input { padding-right: 3rem; }

/* Lien œil overlay, minimal */
.password-group .reveal-link {
  position: absolute;
  top: 1px;
  right: 1px;
  height: calc(100% - 2px);
  width: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;        /* pas de soulignement */
  background: #2a2a2a;          /* même fond que l’input */
  border-left: 1px solid #444;
  border-top-right-radius: 6px;
  border-bottom-right-radius: 6px;
  color: #0ff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.password-group .reveal-link:focus-visible {
  outline: 2px solid rgba(0,255,255,.6);
  outline-offset: 2px;
}
.password-group .reveal-link:hover { filter: brightness(1.05); }
.password-group .reveal-link svg { width: 20px; height: 20px; pointer-events: none; }
