#address-form-dialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.3);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
}

#address-form-dialog.active {
  display: flex;
}

.address-form-content {
  background: #fff;
  border-radius: 16px;
  padding: 1em;
  min-width: 320px;
  max-width: 95vw;
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  gap: 1em;
  position: relative;
}

.address-form-content hr {
  width: 100%;
  border: none;
  border-top: 2px solid gray;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}

.form-header-row {
  display: flex;
  align-items: flex-start;
  gap: 1em;
}

.form-icon .fa-address-card{
  font-size: 2em;
  color: #4B2991;
}

.form-title {
  font-weight: bold;
  font-size: 1.2em;
}

.form-desc {
  font-size: 0.95em;
  color: #666;
}

.form-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 1em;
}

.form-group {
  display: flex;
  flex-direction: column;
  flex: 1 1 220px;
  min-width: 140px;
  margin: 5px 1px;
  position: relative;
}

.form-group label {
  font-weight: 500;
  margin-bottom: 0.2em;
}

.form-group input,
.form-group select {
  padding: 0.5em;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 1em;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  border-color: #4B2991;
  outline: none;
  box-shadow: 0 0 0 2px rgba(75, 41, 145, 0.1);
}

/* Style pour l'input pays hybride */
.country-input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.country-input-container input[type="text"] {
  flex: 1;
  padding-right: 40px;
  border-radius: 8px 0 0 8px;
}

.country-dropdown-btn {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 40px;
  background: #f8f9fa;
  border: 1px solid #ccc;
  border-left: none;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 10;
}

.country-dropdown-btn:hover {
  background: #e9ecef;
  border-color: #4B2991;
}

.country-dropdown-btn.active {
  background: #4B2991;
  color: white;
  border-color: #4B2991;
}

.country-dropdown-btn i {
  transition: transform 0.2s;
}

.country-dropdown-btn.active i {
  transform: rotate(180deg);
}

/* Liste des suggestions de pays */
.country-suggestions-list {
  position: absolute;
  background: #fff;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1001;
  max-height: 250px;
  overflow-y: auto;
  width: 100%;
  border: 1px solid #ddd;
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  display: none;
}

.country-suggestion-item {
  padding: 0.75em;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  transition: background-color 0.2s;
  font-size: 0.9em;
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.country-suggestion-item:hover,
.country-suggestion-item.highlighted {
  background: #f8f9fa;
  color: #4B2991;
}

.country-suggestion-item:last-child {
  border-bottom: none;
}

.country-flag {
  font-size: 1.2em;
  min-width: 24px;
}

.country-name {
  flex: 1;
}

.country-code {
  font-size: 0.8em;
  color: #666;
  background: #f0f0f0;
  padding: 0.2em 0.4em;
  border-radius: 4px;
}

.required {
  color: red;
}

.phone-row {
  display: flex;
  gap: 0;
  align-items: stretch;
}

.phone-row select[name="countryCode"] {
  flex: 0 0 auto;
  width: 85px;
  min-width: 85px;
  border-radius: 8px 0 0 8px;
  border-right: none;
  text-align: center;
  font-size: 0.95em;
  padding: 0.5em 0.3em;
  background-color: #f8f9fa;
  cursor: pointer;
}

.phone-row select[name="countryCode"]:focus {
  border-color: #4B2991;
  background-color: #fff;
  outline: none;
  box-shadow: 0 0 0 2px rgba(75, 41, 145, 0.1);
}

.phone-row input[type="tel"] {
  flex: 1;
  border-radius: 0 8px 8px 0;
  border-left: 1px solid #ddd;
}

.phone-row input[type="tel"]:focus {
  border-color: #4B2991;
  outline: none;
  box-shadow: 0 0 0 2px rgba(75, 41, 145, 0.1);
}

.form-submit-btn {
  margin-top: 1em;
  background: #4B2991;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.7em 2em;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.2s;
}

.form-submit-btn:hover {
  background: #6c47c7;
}

.dialog-close {
  position: fixed;
  bottom: 16px;
  right: 16px;
  background: rgba(75, 41, 145, 0.5);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.5em 1em;
  cursor: pointer;
}

.dialog-close:hover {
  background: rgba(75, 41, 145, 0.7);
}

@media (max-width: 600px) {
  .form-fields {
    display: contents;
    flex-direction: column;
  }
  
  .phone-row {
    flex-direction: row;
  }
  
  .phone-row select[name="countryCode"] {
    width: 90px;
    min-width: 90px;
    border-radius: 8px 0 0 8px;
  }
  
  .phone-row input[type="tel"] {
    border-radius: 0 8px 8px 0;
  }
  
  .country-input-container {
    width: 100%;
  }
  
  .country-suggestions-list {
    max-height: 200px;
  }
}

.address-form-content {
  max-height: 90vh;
  overflow-y: auto;
}



.suggestions-list {
  position: absolute;
  background: #fff;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1001;
  max-height: 300px;
  overflow-y: auto;
  width: 100%;
  border: 1px solid #ddd;
  border-top: none;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  display: none;
}

.suggestion-item {
  padding: 0.75em 1em;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: all 0.2s ease;
  font-size: 0.9em;
  display: flex;
  flex-direction: column;
  gap: 0.3em;
}

.suggestion-item:hover,
.suggestion-item.highlighted {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  color: #4B2991;
  border-left: 3px solid #4B2991;
}

.suggestion-item:last-child {
  border-bottom: none;
  border-radius: 0 0 12px 12px;
}

.suggestion-main {
  font-weight: 500;
  color: #333;
  line-height: 1.3;
}

.suggestion-item:hover .suggestion-main,
.suggestion-item.highlighted .suggestion-main {
  color: #4B2991;
}

.suggestion-type {
  font-size: 0.8em;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 400;
}

.suggestion-item:hover .suggestion-type,
.suggestion-item.highlighted .suggestion-type {
  color: #6c47c7;
}

/* Animation d'apparition des suggestions */
.suggestions-list[style*="block"] {
  animation: slideDownFade 0.2s ease-out;
}

@keyframes slideDownFade {
  from {
    opacity: 0;
    transform: translateY(-10px);
    max-height: 0;
  }
  to {
    opacity: 1;
    transform: translateY(0);
    max-height: 300px;
  }
}

/* Style pour le conteneur d'adresse avec position relative */
.form-group-address {
  position: relative;
}

/* Amélioration du style de l'input street quand les suggestions sont actives */
#street-input.suggestions-active {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: #4B2991;
  box-shadow: 0 0 0 2px rgba(75, 41, 145, 0.1);
}

/* Loader pour les suggestions */
.suggestions-loading {
  padding: 1em;
  text-align: center;
  color: #666;
  font-style: italic;
}

.suggestions-loading::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #4B2991;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 0.5em;
  vertical-align: middle;
}

/* Message quand aucune suggestion */
.suggestions-empty {
  padding: 1em;
  text-align: center;
  color: #999;
  font-style: italic;
}

/* Responsive pour les suggestions */
@media (max-width: 768px) {
  .suggestions-list {
    max-height: 250px;
    border-radius: 0 0 8px 8px;
  }
  
  .suggestion-item {
    padding: 1em 0.8em;
  }
  
  .suggestion-main {
    font-size: 0.95em;
  }
  
  .suggestion-type {
    font-size: 0.75em;
  }
}

@media (max-width: 480px) {
  .suggestions-list {
    max-height: 200px;
    left: -5px;
    right: -5px;
    width: calc(100% + 10px);
  }
  
  .suggestion-item {
    padding: 0.8em 0.6em;
  }
}


.spinner {
  margin: 1em auto;
  border: 4px solid #eee;
  border-top: 4px solid #4B2991;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  100% {
    transform: rotate(360deg);
  }
}




.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.switch input {
  display: none;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  border-radius: 20px;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  border-radius: 50%;
  transition: .4s;
}

input:checked+.slider {
  background-color: #4B2991;
}

input:checked+.slider:before {
  transform: translateX(16px);
}

/* Styles pour le système téléphone amélioré */
.phone-row {
  display: flex;
  gap: 0;
  align-items: stretch;
}

#country-code-select {
  min-width: 80px;
  max-width: 100px;
  flex: 0 0 auto;
  border-radius: 8px 0 0 8px;
  border-right: none;
  font-size: 0.9em;
  padding: 0.5em 0.3em;
  background: #f8f9fa;
}

.phone-input-container {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

#phone-input {
  flex: 1;
  border-radius: 0 8px 8px 0;
  border-left: none;
  padding-right: 60px;
}

.phone-counter {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8em;
  color: #666;
  background: rgba(255, 255, 255, 0.9);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
  pointer-events: none;
}

.phone-counter.valid {
  color: #28a745;
}

.phone-counter.invalid {
  color: #dc3545;
}

.phone-counter.warning {
  color: #ffc107;
}

#phone-input.valid {
  border-color: #28a745;
}

#phone-input.invalid {
  border-color: #dc3545;
}

#phone-input.warning {
  border-color: #ffc107;
}

/* Select compact avec drapeaux */
#country-code-select option {
  padding: 0.3em;
  font-size: 0.9em;
}

/* Responsive pour mobile */
@media (max-width: 480px) {
  .phone-row {
    flex-direction: column;
    gap: 0.5em;
  }
  
  #country-code-select {
    min-width: 100%;
    max-width: 100%;
    border-radius: 8px;
    border-right: 1px solid #ccc;
  }
  
  #phone-input {
    border-radius: 8px;
    border-left: 1px solid #ccc;
  }
}

/* Styles pour l'input région avec suggestions */
.region-input-container {
  position: relative;
  display: flex;
  align-items: stretch;
}

#region-input {
  flex: 1;
  padding: 0.5em;
  border: 1px solid #ccc;
  border-radius: 8px 0 0 8px;
  font-size: 1em;
  transition: border-color 0.2s;
  outline: none;
}

#region-input:focus {
  border-color: #4B2991;
  box-shadow: 0 0 0 2px rgba(75, 41, 145, 0.1);
}

.region-dropdown-btn {
  background: #f8f9fa;
  border: 1px solid #ccc;
  border-left: none;
  border-radius: 0 8px 8px 0;
  padding: 0.5em 0.8em;
  cursor: pointer;
  transition: all 0.2s;
  color: #666;
  min-width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.region-dropdown-btn:hover {
  background: #e9ecef;
  color: #4B2991;
}

.region-dropdown-btn.active {
  background: #4B2991;
  color: white;
  transform: rotate(180deg);
}

.region-dropdown-btn i {
  transition: transform 0.2s;
}

.region-suggestions-list {
  position: absolute;
  background: white;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1002;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  display: none;
}

.region-suggestion-item {
  padding: 0.75em 1em;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.region-suggestion-item:hover,
.region-suggestion-item.highlighted {
  background: #f8f9fa;
  color: #4B2991;
}

.region-suggestion-item:last-child {
  border-bottom: none;
}

.region-name {
  font-weight: 500;
}

.region-type {
  font-size: 0.8em;
  color: #666;
  margin-left: auto;
}

/* État vide pour les régions */
.region-suggestion-item.no-suggestions {
  color: #999;
  font-style: italic;
  justify-content: center;
}

/* Animation pour l'ouverture des suggestions */
.region-suggestions-list.show {
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive pour le champ région */
@media (max-width: 480px) {
  .region-input-container {
    flex-direction: column;
  }
  
  #region-input {
    border-radius: 8px 8px 0 0;
    border-bottom: none;
  }
  
  .region-dropdown-btn {
    border-radius: 0 0 8px 8px;
    border-top: none;
    border-left: 1px solid #ccc;
    padding: 0.8em;
  }
  
  .region-suggestions-list {
    border-radius: 0 0 8px 8px;
    max-height: 150px;
  }
}

/* Styles pour les différentes tailles de form-group */
.form-group-small {
  flex: 0 0 150px;
  min-width: 120px;
  max-width: 200px;
}

.form-group-large {
  flex: 2;
  min-width: 250px;
}

.form-group-address {
  flex: 1 1 100%;
  min-width: 100%;
}

/* Style pour le label avec texte automatique */
.address-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.2em;
}

.address-auto-text {
  font-size: 0.8em;
  color: #666;
  font-style: italic;
  font-weight: normal;
}

/* Animation pour le texte automatique */
.address-auto-text.updating {
  color: #4B2991;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Responsive pour les nouvelles tailles */
@media (max-width: 768px) {
  .form-group-small,
  .form-group-large {
    flex: 1 1 100%;
    min-width: 100%;
    max-width: none;
  }
  
  .address-label-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2em;
  }
}
