form#user-profile-completion-form{
  margin-bottom: 24px
}

#ajax-wrapper{
  margin-bottom: 2rem;
  margin-top: 2rem;
}

.js-form-item-field-respo-trasformazione{
  margin-bottom: 3rem !important;
}

.js-form-item-field-codice-fiscale, .js-form-item-field-comune, .js-form-item-user-picture{
  margin-bottom: 2rem !important;
}

.js-form-item-field-accettazione-privacy{
  margin-bottom: 1rem !important;
}

.js-form-item-field-titolo-di-studio {
  margin-bottom: 2rem;
}

.user-profile-completion-form.needs-validation .form-group,
#comuni-wrapper, #province-wrapper, .js-form-item-field-regione{
  position: relative;
  margin-bottom: 2rem;
  margin-top: 2rem !important;
}


input.form-textfield, .select-wrapper select{
  border: 1px solid #d9dadb !important;
  color: hsl(210, 17%, 44%) !important;
  font-weight: 400 !important;
  border-radius: 5px !important;
  padding: .375rem .5rem !important;
}

.js-form-required.form-required, .active.option, .js-form-required.form-required, .active{
  color: hsl(210, 17%, 44%) !important;
  font-weight: 400 !important;
}

#edit-user-picture--label{
  color: hsl(210, 17%, 44%) !important;
}

.user-profile-completion-form.needs-validation .js-form-item-files-user-picture.form-group{
  position: relative;
  margin-bottom: 4rem;
  margin-top: 3rem !important;
}

/* Styling per il campo nickname */
.js-form-item-nickname,
.nickname-wrapper {
  margin-bottom: 2rem;
}

/* Alert danger Bootstrap Italia per errori del nickname */
.js-form-item-nickname .alert-danger,
.nickname-wrapper .alert-danger {
  display: block;
  margin-top: 0.75rem;
  padding: 1rem 1.25rem;
  background-color: #f8d7da;
  border: 1px solid #f5c2c7;
  border-radius: 0.375rem;
  color: #842029;
  font-size: 0.95rem;
  line-height: 1.5;
}

.js-form-item-nickname .alert-danger b,
.nickname-wrapper .alert-danger b {
  font-weight: 600;
}

/* Input con errore - bordo rosso */
.js-form-item-nickname.form-item--error input.form-textfield,
.js-form-item-nickname input.error,
input.form-textfield.error {
  border-color: #dc3545 !important;
  border-width: 2px !important;
  background-color: #fff5f5;
}

/* Rimuove il messaggio di errore di default di Drupal */
.js-form-item-nickname .form-item--error-message {
  display: none;
}

/* Stile generale per gli alert danger */
.alert-danger {
  display: block;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  background-color: #f8d7da;
  border: 1px solid #f5c2c7;
  border-radius: 0.375rem;
  color: #842029;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* IPA Autocomplete Styles */
.ipa-autocomplete-container {
  position: relative;
  width: 100%;
}

.ipa-autocomplete-loading {
  padding: 1rem;
  text-align: center;
  font-size: 0.875rem;
  color: #6c757d;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.ipa-autocomplete-spinner {
  border: 2px solid #f3f3f3;
  border-top: 2px solid #0066cc;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  animation: ipa-spin 0.8s linear infinite;
}

@keyframes ipa-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.ipa-autocomplete-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  background: #fff;
  border: 1px solid #d9dadb;
  border-top: none;
  border-radius: 0 0 5px 5px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  max-height: 300px;
  overflow-y: auto;
  margin-top: -1px;
}

.ipa-autocomplete-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ipa-autocomplete-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s ease;
}

.ipa-autocomplete-item:last-child {
  border-bottom: none;
}

.ipa-autocomplete-item:hover,
.ipa-autocomplete-item.active {
  background-color: #f8f9fa;
}

.ipa-autocomplete-item-label {
  font-size: 0.95rem;
  color: #495057;
  line-height: 1.5;
}

.ipa-autocomplete-no-results,
.ipa-autocomplete-error {
  padding: 1rem;
  text-align: center;
  color: #6c757d;
  font-size: 0.9rem;
}

.ipa-autocomplete-error {
  color: #dc3545;
}

/* Ensure the field has proper spacing */
.js-form-item-field-ente-di-appartenenza {
  margin-bottom: 2rem;
}

/* Profile Image Upload - Simple version */
.js-form-item-field-immagine-di-profilo {
  margin-bottom: 2rem;
}

.current-profile-image {
  margin-bottom: 1rem;
}

.current-profile-image img {
  display: block;
  border: 2px solid #e0e0e0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.profile-completion-main__content.bg-dark .ck.ck-editor__editable.ck-focused:not(.ck-editor__nested-editable){
  border: 1px solid #FFFFFF !important;
}

/* Styling per textarea Info su di me */
.js-form-item-field-info-su-di-me {
  margin-bottom: 2rem;
}

.js-form-item-field-info-su-di-me textarea {
  border: 1px solid #d9dadb !important;
  color: hsl(210, 17%, 44%) !important;
  font-weight: 400 !important;
  border-radius: 5px !important;
  padding: .75rem !important;
  font-size: 0.95rem;
  line-height: 1.5;
  resize: vertical;
}
