/* ============================================================
   FORMS — inputs, textfields, phone, checkbox, social login,
            language-options, structure-autocomplete
   ============================================================ */

/* ============================================================
   FORM GROUP (layout de base)
   ============================================================ */

.form-group {
  margin-bottom: clamp(16px, 2vw, 24px);
}

.form-group label {
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
  letter-spacing: 0.01em;
  transition: var(--transition-fast);
}

.form-group:focus-within label {
  color: var(--primary-color);
}

.label-optional {
  font-weight: 400;
  font-size: 12px;
  color: var(--text-muted);
}

.form-control {
  width: 100%;
  padding: clamp(12px, 1.5vw, 16px);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 16px;
  background: var(--background-white);
  transition: var(--transition-fast);
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
}
.form-control::placeholder {
  color: var(--text-muted);
}

/* ============================================================
   SELECT (custom dropdown with Lucide arrow-down)
   ============================================================ */

.select-wrapper {
  position: relative;
  display: block;
}

.select-wrapper select.form-control {
  width: 100%;
  padding-right: 40px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: var(--background-white);
  cursor: pointer;
  border: 1px solid var(--border-color);
}

.select-wrapper select.form-control option[value=""] {
  color: var(--text-muted);
}

.select-wrapper .select-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.select-wrapper:focus-within .select-icon {
  color: var(--primary-color);
}

/* ============================================================
   TEXTFIELD OUTLINED (labels flottants)
   ============================================================ */

.textfield-outlined {
  position: relative;
  margin-bottom: 20px;
  display: block;
}

.textfield-outlined .input {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 16px;
  background: var(--background-white);
  transition: all var(--transition-normal) cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  box-sizing: border-box;
  display: block;
}

.textfield-outlined .input:focus {
  outline: none;
  border-color: var(--primary-color);
  transform: translateY(-1px);
}

.textfield-outlined .input:hover:not(:focus) {
  border-color: var(--text-secondary);
}

/* Autofill reset */
.textfield-outlined .input:not(:placeholder-shown),
.textfield-outlined .input.filled,
.textfield-outlined .input:not([value=""]) {
  background: var(--background-white) !important;
}

.textfield-outlined .input:-webkit-autofill,
.textfield-outlined .input:-webkit-autofill:hover,
.textfield-outlined .input:-webkit-autofill:focus,
.textfield-outlined .input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 30px var(--background-white) inset !important;
  box-shadow: 0 0 0 30px var(--background-white) inset !important;
  -webkit-text-fill-color: inherit !important;
  background-color: var(--background-white) !important;
}

/* Floating label */
.textfield-outlined span {
  position: absolute;
  top: 12px;
  left: 12px;
  font-size: 14px;
  color: var(--text-muted);
  background: var(--background-white);
  padding: 0 6px;
  transition: all var(--transition-normal) cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  transform-origin: left top;
  z-index: 1;
}

.textfield-outlined .input:focus + span,
.textfield-outlined .input:not([value=""]) + span,
.textfield-outlined .input.filled + span,
.textfield-outlined .input.focused + span {
  top: -6px;
  left: 10px;
  font-size: 11px;
  color: var(--primary-color);
  font-weight: 600;
  background: var(--background-white);
  padding: 0 4px;
}

/* Password toggle */
.textfield-outlined i {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
}

.textfield-outlined i:hover {
  color: var(--text-secondary);
}

.textfield-outlined .spanError {
  position: static;
  top: auto;
  left: auto;
  transform: none;
  margin-top: 8px;
  display: block;
}

/* ============================================================
   TEXTFIELD AVEC ICÔNE
   ============================================================ */

.textfield-icon {
  position: relative;
  margin-bottom: clamp(6px, 0.8vw, 8px);
}

.textfield-icon__label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary) !important;
}

.textfield-icon__wrapper {
  position: relative;
  display: flex;
  align-items: center;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0 clamp(12px, 1.5vw, 16px);
  transition: all var(--transition-fast);
}

.textfield-icon__wrapper:hover {
  border-color: var(--text-muted);
}

.textfield-icon__wrapper:focus-within {
  border-color: var(--primary-color);
  background: var(--background-white);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.textfield-icon__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  margin-right: 12px;
  flex-shrink: 0;
}

.textfield-icon__wrapper:focus-within .textfield-icon__icon {
  color: var(--primary-color);
}

.textfield-icon__input {
  flex: 1;
  border: none;
  padding: clamp(12px, 1.2vw, 14px) 0;
  font-size: 16px;
  font-family: inherit;
  color: var(--text-primary);
  outline: none;
  min-width: 0;
  background-color: var(--background-white);
}

.textfield-icon__input::placeholder {
  color: var(--text-muted);
}

.textfield-icon__input:-webkit-autofill,
.textfield-icon__input:-webkit-autofill:hover,
.textfield-icon__input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 30px var(--background-white) inset !important;
  -webkit-text-fill-color: var(--text-primary) !important;
}

.textfield-icon__wrapper:focus-within .textfield-icon__input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 30px var(--background-white) inset !important;
}

/* Readonly state (e.g. prefilled invitation email) */
.textfield-icon__input--readonly ~ * {
  pointer-events: none;
}
.textfield-icon:has(.textfield-icon__input--readonly) .textfield-icon__wrapper,
.textfield-icon:has(.textfield-icon__input--readonly)
  .textfield-icon__wrapper:hover,
.textfield-icon:has(.textfield-icon__input--readonly)
  .textfield-icon__wrapper:focus-within {
  background: var(--background-light);
  border-color: var(--border-color);
  box-shadow: none;
  cursor: default;
}
.textfield-icon__input--readonly {
  color: var(--text-secondary);
  cursor: default;
  background-color: var(--background-light);
}

/* Error state */
.textfield-icon--error .textfield-icon__wrapper {
  border-color: var(--error-color);
  background: var(--error-light);
}
.textfield-icon--error .textfield-icon__icon {
  color: var(--error-color);
}
.textfield-icon__error {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--error-color);
  padding-left: 16px;
}

/* Password visibility toggle (two icons, show one by state) */
.password-toggle {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
.password-toggle__icon--hide {
  display: none;
}
.password-toggle.is-visible .password-toggle__icon--show {
  display: none;
}
.password-toggle.is-visible .password-toggle__icon--hide {
  display: inline-block;
}

/* ============================================================
   PHONE INPUT (sélecteur de pays intégré)
   ============================================================ */

.phone-country-selector {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 0 12px 0 0;
  cursor: pointer;
  border-right: 1px solid var(--border-color);
  margin-right: 12px;
  transition: all var(--transition-fast);
}

.phone-country-selector:hover {
  background: var(--background-light);
}
.phone-country-selector.visible {
  display: flex;
}

.country-flag {
  display: flex;
  align-items: center;
  font-size: 18px;
}

.country-code {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  min-width: 36px;
}

.phone-chevron {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}

.phone-country-selector:hover .phone-chevron {
  color: var(--text-secondary);
}

.phone-input-divider {
  display: none;
  width: 1px;
  height: 20px;
  background: var(--border-color);
  margin-right: 12px;
}

.phone-input-divider.visible {
  display: block;
}

/* Country dropdown */
.country-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 8px;
  background: var(--background-white);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  max-height: 300px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.country-search {
  padding: 12px 16px;
  border: none;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
  outline: none;
  font-family: inherit;
}

.country-search:focus {
  background: var(--background-light);
}

.country-list-container {
  overflow-y: auto;
  max-height: 240px;
}

.country-list-container::-webkit-scrollbar {
  width: 6px;
}
.country-list-container::-webkit-scrollbar-track {
  background: transparent;
}
.country-list-container::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}
.country-list-container::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.country-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.country-item:hover {
  background: var(--primary-light);
}
.country-item-flag {
  font-size: 18px;
}
.country-item-name {
  flex: 1;
  font-size: 14px;
  color: var(--text-primary);
}
.country-item-code {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ============================================================
   CHECKBOX
   ============================================================ */

.checkbox {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  cursor: pointer;
  gap: 10px;
}

.checkbox input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.checkbox span:first-of-type {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  background: var(--background-white);
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.checkbox input[type="checkbox"]:checked + span:first-of-type {
  background: var(--primary-color);
  border-color: var(--primary-color);
}

/* Icône de coche Lucide : masquée par défaut, affichée quand coché */
.checkbox__check {
  width: 14px;
  height: 14px;
  color: white;
  stroke-width: 3;
  opacity: 0;
  transition: var(--transition-fast);
}

.checkbox input[type="checkbox"]:checked + span:first-of-type .checkbox__check {
  opacity: 1;
}

.checkbox span:last-child {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.4;
  flex: 1;
}

/* ============================================================
   STEP BUTTONS
   ============================================================ */

.step-buttons {
  display: flex;
  width: 100%;
  max-width: 50rem;
  justify-content: space-between;
  align-items: center;
  margin: clamp(16px, 2vw, 24px) auto 0;
  gap: clamp(10px, 1.2vw, 12px);
}

/* Boutons "bruts" (.ripple) sans variante .button-- : stylés ici uniquement.
   Les éléments porteurs de .button/.button-- sont stylés par components.css. */
.step-buttons button:not(.button),
.step-buttons a:not(.button) {
  flex: none;
  width: 200px;
  height: 48px;
  padding: 0 24px;
  border-radius: 24px;
  font-size: clamp(14px, 1.2vw, 15px);
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  border: none;
  cursor: pointer;
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.step-buttons button:not(.button):not(.secondary),
.step-buttons a:not(.button):not(.secondary) {
  background: var(--primary-color);
  color: white;
}

.step-buttons button:not(.button):not(.secondary):hover:not(:disabled),
.step-buttons a:not(.button):not(.secondary):hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
}

.step-buttons button.secondary {
  background: var(--background-white);
  color: var(--secondary-color);
  border: 2px solid var(--border-color);
}

.step-buttons button.secondary:hover {
  background: var(--background-light);
  border-color: var(--secondary-color);
  color: var(--secondary-hover);
}

.step-buttons button:disabled {
  background: var(--border-color);
  color: var(--text-muted);
  cursor: not-allowed;
  transform: none;
}

.step-buttons button:disabled:hover {
  background: var(--border-color);
  color: var(--text-muted);
  border-color: var(--border-color);
  transform: none;
  box-shadow: none;
}

/* ============================================================
   LOGIN ENHANCEMENTS (bouton login, social, mot de passe)
   ============================================================ */

/* Boutons .button du login (Connexion / Créer un compte) : 200x48, centrés.
   Le .step-buttons mono-bouton est centré aussi. */
.login-fullscreen .step-buttons {
  justify-content: center;
}
.login-fullscreen .button--primary,
.login-fullscreen .button--outline {
  width: 200px;
  height: 48px;
}

.forgot-password-link {
  text-align: right;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.forgot-password-link a {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
  transition: var(--transition-fast);
  background: var(--background-white);
  padding: 2px 6px;
  border-radius: 4px;
}

.forgot-password-link a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
  background: var(--primary-light);
}

.login-button {
  width: 200px;
  height: 48px;
  padding: 0 24px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--primary-hover) 100%
  );
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  letter-spacing: 0.01em;
}

.login-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  background: linear-gradient(
    135deg,
    var(--primary-hover) 0%,
    var(--primary-dark) 100%
  );
}

.login-button:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.login-button:disabled {
  background: var(--border-color);
  color: var(--text-muted);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

#kc-login-loader {
  margin-right: 8px;
  transition: var(--transition-fast);
}
.login-button.loading #kc-login-loader {
  animation: spin 1s linear infinite;
}

.divider {
  display: flex;
  align-items: center;
  margin: 32px 0;
  gap: 16px;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.divider-text {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.social-providers-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 24px;
}

.social-provider-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--background-white);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition-normal);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  min-height: 56px;
}

.social-provider-button:hover {
  border-color: var(--primary-color);
  background: var(--primary-light);
  color: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.social-provider-button:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}
.social-provider-button img {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}
.social-provider-button i {
  font-size: 20px;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}
.social-provider-name {
  font-weight: 600;
  flex: 1;
  text-align: center;
  margin-inline-start: -32px;
}

.social-provider-button.loading {
  pointer-events: none;
  opacity: 0.7;
}
.social-provider-button.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.registration-content {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.registration-text {
  color: var(--text-secondary);
  font-size: 14px;
}
.registration-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 200px;
  height: 48px;
  padding: 0 16px;
  color: var(--primary-color);
  text-decoration: none;
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}
.registration-link:hover {
  color: var(--primary-hover);
  background: var(--primary-light);
  text-decoration: none;
}

/* ============================================================
   STRUCTURE AUTOCOMPLETE
   ============================================================ */

.structure-autocomplete {
  position: relative;
}

.structure-autocomplete__results {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 4px;
  max-height: 200px;
  overflow-y: auto;
  background: var(--background-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  z-index: 10;
  list-style: none;
  padding: 4px 0;
  margin: 0;
}

.structure-autocomplete__results[aria-hidden="true"] {
  display: none;
}
.structure-autocomplete__results[aria-hidden="false"] {
  display: block;
}

.structure-autocomplete__item {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 8px 12px;
  text-align: left;
  border: none;
  background: none;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
}

.structure-autocomplete__address {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.structure-autocomplete__item:hover {
  background: var(--background-light);
}
.structure-autocomplete__loading,
.structure-autocomplete__empty {
  padding: 8px 12px;
  font-size: 14px;
  color: var(--text-muted);
}

/* ============================================================
   LANGUAGE OPTIONS (sélection de langue dans le register)
   ============================================================ */

.language-subtitle {
  margin: 8px 0 0 0;
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 400;
  line-height: 1.5;
}

.language-search-wrapper {
  margin: clamp(16px, 2vw, 24px) 0 clamp(12px, 1.5vw, 16px) 0;
}

.language-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--background-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 3px 12px;
  transition: var(--transition-normal);
}

.language-search:focus-within {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(82, 79, 241, 0.1);
}

/* Icône de recherche à droite (cf. maquette) */
.language-search-icon {
  order: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  font-size: 16px;
}

.language-search-icon i {
  width: 24px;
  height: 24px;
}

.language-search-input {
  order: 1;
  flex: 1;
  border: none;
  outline: none;
  padding: 12px 0;
  font-size: 16px;
  color: var(--text-primary);
  background: transparent;
}

.language-search-input::placeholder {
  color: var(--text-primary);
}

.language-search-clear {
  order: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  transition: var(--transition-normal);
}

.language-search-clear:hover {
  color: var(--text-primary);
}

.language-options-wrapper {
  margin: 24px 0;
  overflow: visible;
}

.language-options {
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1vw, 10px);
  max-height: min(360px, 55vh);
  scrollbar-width: thin;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px;
  margin: 0 -4px;
}

.language-options::-webkit-scrollbar {
  width: 6px;
}
.language-options::-webkit-scrollbar-track {
  background: var(--background-light);
  border-radius: 3px;
}
.language-options::-webkit-scrollbar-thumb {
  background: var(--text-secondary);
  border-radius: 3px;
}
.language-options::-webkit-scrollbar-thumb:hover {
  background: var(--text-primary);
}

.language-option {
  position: relative;
  cursor: pointer;
  transition: var(--transition-normal);
}
.language-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.language-option .option-content {
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--background-white);
  transition: var(--transition-normal);
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  min-height: 44px;
}

.language-option:hover .option-content {
  border-color: var(--text-muted);
}

/* Sélectionné : bordure primaire épaissie via box-shadow pour ne pas décaler le layout.
   Le cercle radio réutilise .option-radio-visual (cf. register.css, comme step-1). */
.language-option input[type="radio"]:checked + .option-content {
  border-color: var(--primary-color);
  box-shadow: inset 0 0 0 1px var(--primary-color);
}

.language-flag {
  font-size: clamp(20px, 2vw, 24px);
  line-height: 1;
}
.language-name-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.language-name {
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
  color: var(--text-primary);
}
.language-name-translated {
  font-size: clamp(11px, 1vw, 12px);
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.2;
}
.language-beta-badge {
  margin-left: auto;
}

.language-option.hidden {
  display: none;
}
.language-no-results {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-secondary);
  font-size: 14px;
}
.language-no-results p {
  margin: 0;
}

/* ============================================================
   FORMS — RESPONSIVE
   ============================================================ */

@media (max-width: 1024px) {
  .login-button {
    font-size: clamp(14px, 1.3vw, 16px);
  }
  .divider {
    margin: clamp(20px, 2.5vw, 32px) 0;
    gap: clamp(10px, 1.2vw, 16px);
  }
  .divider-text {
    font-size: clamp(12px, 1.1vw, 13px);
  }
  .social-providers-grid {
    gap: clamp(12px, 1.5vw, 16px);
    margin-top: clamp(18px, 2vw, 24px);
  }
  .social-provider-button {
    padding: clamp(12px, 1.2vw, 14px) clamp(16px, 1.8vw, 20px);
    min-height: clamp(48px, 5vw, 56px);
    font-size: clamp(13px, 1.2vw, 14px);
  }
  .language-options-wrapper {
    margin: clamp(16px, 2vw, 24px) 0;
  }
  .language-options {
    max-height: min(260px, 45vh);
  }
}

@media (max-width: 768px) {
  .form-control,
  .textfield-outlined .input {
    padding: 14px;
    font-size: 16px;
  }
  .social-providers-grid {
    gap: 14px;
  }
  .social-provider-button {
    padding: 12px 16px;
    min-height: 52px;
  }

  .step-buttons {
    flex-direction: column;
    gap: 12px;
  }

  .button {
    width: 100%;
  }
  /* Override la largeur fixe de 200px des boutons login/register en mobile. */
  .login-fullscreen .button--primary,
  .login-fullscreen .button--outline {
    width: 100%;
  }
  .step-buttons button:not(.button),
  .step-buttons a:not(.button) {
    width: 100%;
  }
  .step-buttons button:not(.button):not(.secondary),
  .step-buttons a:not(.button):not(.secondary) {
    order: -1;
  }
  /* Le bouton de validation/continuer passe au-dessus du bouton précédent en mobile. */
  .step-buttons .button--primary {
    order: -1;
  }
}

@media (max-width: 600px) {
  .language-search-wrapper {
    margin: 16px 0 12px 0;
  }
  .language-search-input {
    padding: 10px 0;
  }
  .language-options {
    gap: 8px;
    max-height: calc((44px + 8px) * 5 - 8px);
  }
  .language-option .option-content {
    padding: 10px;
  }
  .language-flag {
    font-size: 20px;
  }
  .language-name {
    font-size: 13px;
  }
  .language-name-translated {
    font-size: 11px;
  }
}

/* On touch devices (e.g. Android), disable hover transform to prevent visual clipping
   caused by scale() overflowing the overflow-x: hidden scroll container. */
@media (hover: none) {
  .language-option:hover {
    transform: none;
  }
  .language-option:hover .option-content {
    border-color: #e0e7ff;
    box-shadow: none;
  }
  .language-option:hover .option-content::before {
    transform: scaleX(0);
  }
}

@media (max-width: 480px) {
  .country-dropdown {
    width: calc(100vw - 48px);
    max-width: 300px;
  }
  .social-providers-grid {
    gap: 12px;
  }
  .social-provider-button {
    padding: 14px 18px;
    min-height: 56px;
  }
  .social-provider-button img {
    width: 22px;
    height: 22px;
  }
  .social-provider-button i {
    font-size: 18px;
  }
  .registration-content {
    text-align: center;
  }

  .step-buttons button:not(.button),
  .step-buttons a:not(.button) {
    font-size: 15px;
  }
}

@media (max-height: 800px) {
  .form-group {
    margin-bottom: 14px;
  }
  .form-group label {
    margin-bottom: 6px;
    font-size: 13px;
  }
  .form-control {
    padding: 10px 12px;
    font-size: 16px;
  }
  .phone-input-container {
    margin-bottom: 12px;
    min-height: 42px;
  }
  .phone-input-container .input {
    padding: 10px;
    font-size: 16px;
  }

  .textfield-outlined {
    margin-bottom: 12px;
  }
  .textfield-outlined .input {
    padding: 10px 12px;
    font-size: 16px;
  }
  .textfield-outlined span {
    top: 10px;
    font-size: 13px;
  }
  .textfield-outlined .input:focus + span,
  .textfield-outlined .input:not([value=""]) + span,
  .textfield-outlined .input.filled + span,
  .textfield-outlined .input.focused + span {
    top: -5px;
    font-size: 10px;
  }

  .textfield-icon {
    margin-bottom: 6px;
  }
  .textfield-icon__label {
    margin-bottom: 6px;
    font-size: 13px;
  }
  .textfield-icon__wrapper {
    padding: 0 12px;
  }
  .textfield-icon__input {
    padding: 10px 0;
    font-size: 16px;
  }
  .textfield-icon__icon {
    font-size: 14px;
    margin-right: 10px;
  }

  .divider {
    margin: 14px 0;
    gap: 10px;
  }
  .divider-text {
    font-size: 12px;
  }
  .social-providers-grid {
    gap: 10px;
    margin-top: 10px;
  }
  .social-provider-button {
    padding: 10px 14px;
    min-height: 44px;
    font-size: 13px;
    border-radius: var(--radius-md);
  }
  .social-provider-button img {
    width: 20px;
    height: 20px;
  }
  .social-provider-button i {
    font-size: 16px;
  }
  .social-provider-name {
    margin-inline-start: -24px;
  }
  .registration-text {
    font-size: 13px;
  }
  .registration-link {
    font-size: 14px;
  }
  .login-button {
    font-size: 14px;
  }

  .step-buttons {
    margin-top: 14px;
    gap: 10px;
  }
  .step-buttons button:not(.button),
  .step-buttons a:not(.button) {
    font-size: 14px;
  }
}
