/**
 * CLICKNVAN - Styles pour la validation des champs obligatoires
 *
 * Ce fichier contient tous les styles relatifs à la validation des formulaires
 * et à l'indication des champs obligatoires dans le dashboard vendeur.
 */

/* =============== CHAMPS OBLIGATOIRES =============== */

/* Astérisque rouge pour les champs obligatoires */
.required-asterisk {
  color: #d63384 !important;
  font-weight: bold;
  margin-left: 4px;
}

/* Style pour les labels des champs obligatoires */
.wcv-field-label.required,
label.required {
  position: relative;
}

.wcv-field-label.required::after,
label.required::after {
  content: " *";
  color: #d63384;
  font-weight: bold;
  margin-left: 4px;
}

/* =============== MESSAGES D'ERREUR =============== */

/* Message d'erreur global en haut du formulaire */
.clicknvan-global-error {
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
  border-radius: 6px;
  padding: 15px;
  margin-bottom: 20px;
  color: #721c24;
  font-size: 14px;
  line-height: 1.5;
}

.clicknvan-global-error strong {
  font-weight: 600;
}

/* Messages d'erreur pour champs individuels */
.clicknvan-field-error {
  color: #d63384 !important;
  font-size: 14px;
  margin-top: 5px;
  font-weight: 500;
  display: block;
  line-height: 1.4;
}

/* Style pour les champs en erreur */
.field-error,
input.field-error,
textarea.field-error,
select.field-error {
  border-color: #d63384 !important;
  box-shadow: 0 0 0 0.2rem rgba(214, 51, 132, 0.25) !important;
}

/* Animation pour attirer l'attention sur les erreurs */
.clicknvan-field-error {
  animation: fadeInError 0.3s ease-in;
}

@keyframes fadeInError {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =============== STYLES POUR LES DIFFÉRENTS TYPES DE CHAMPS =============== */

/* Validation pour les checkboxes (catégories) */
.wcv-product-categories.field-error .wcv-checkbox-group {
  border: 2px solid #d63384;
  border-radius: 4px;
  padding: 10px;
  background-color: rgba(248, 215, 218, 0.1);
}

/* Validation pour les champs texte et textarea */
#wcv_product_description.field-error,
#_regular_price.field-error {
  border-color: #d63384 !important;
  box-shadow: 0 0 0 0.2rem rgba(214, 51, 132, 0.25);
}

/* Validation pour les champs ACF (Google Maps) */
.acf-field.field-error .acf-input {
  border: 2px solid #d63384;
  border-radius: 4px;
  padding: 5px;
  background-color: rgba(248, 215, 218, 0.05);
}

/* =============== AMÉLIORATION UX =============== */

/* Indicateur de chargement lors de la validation */
.validation-loading {
  display: inline-block;
  margin-left: 10px;
}

.validation-loading::after {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #007cba;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Styles pour les tooltips d'aide */
.field-help-tooltip {
  position: relative;
  display: inline-block;
  margin-left: 5px;
  color: #007cba;
  cursor: help;
}

.field-help-tooltip::before {
  content: "?";
  display: inline-block;
  width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  background-color: #007cba;
  color: white;
  border-radius: 50%;
  font-size: 12px;
  font-weight: bold;
}

.field-help-tooltip:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background-color: #333;
  color: white;
  padding: 8px 12px;
  border-radius: 4px;
  white-space: nowrap;
  font-size: 12px;
  z-index: 1000;
}

/* =============== RESPONSIVE =============== */

@media (max-width: 768px) {
  .clicknvan-global-error {
    margin: 10px 15px 20px 15px;
    padding: 12px;
    font-size: 13px;
  }

  .clicknvan-field-error {
    font-size: 13px;
    margin-top: 3px;
  }

  .required-asterisk {
    margin-left: 2px;
  }
}

@media (max-width: 480px) {
  .clicknvan-global-error {
    margin: 5px 10px 15px 10px;
    padding: 10px;
    font-size: 12px;
  }

  .clicknvan-field-error {
    font-size: 12px;
  }
}

/* =============== ÉTAT DE SUCCÈS =============== */

/* Style pour les champs validés avec succès */
.field-success,
input.field-success,
textarea.field-success,
select.field-success {
  border-color: #28a745 !important;
  box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25) !important;
}

.clicknvan-field-success {
  color: #28a745 !important;
  font-size: 14px;
  margin-top: 5px;
  font-weight: 500;
  display: block;
}

/* Message de succès global */
.clicknvan-global-success {
  background-color: #d4edda;
  border: 1px solid #c3e6cb;
  border-radius: 6px;
  padding: 15px;
  margin-bottom: 20px;
  color: #155724;
  font-size: 14px;
  line-height: 1.5;
}

/* =============== ACCESSIBILITÉ =============== */

/* Support pour les lecteurs d'écran */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus visible pour navigation clavier */
.clicknvan-field-error:focus,
.clicknvan-global-error:focus {
  outline: 2px solid #007cba;
  outline-offset: 2px;
}

/* =============== COMPATIBILITÉ AVEC LE THÈME =============== */

/* S'assurer que les styles ne cassent pas le thème existant */
.wcv-form .clicknvan-field-error {
  font-family: inherit;
  line-height: inherit;
}

.wcv-form .required-asterisk {
  font-family: inherit;
}

/* Compatibilité avec Elementor */
.elementor-widget .clicknvan-field-error,
.elementor-widget .required-asterisk {
  font-family: inherit;
}
