/* CSS personnalisé pour les boutons radio des formulaires SU66 */

/* Variables de couleurs SU66 */
:root {
  --su66-red: #C1121F;
  --su66-black: #181818;
  --su66-white: #fff;
  --su66-gray: #6c757d;
  --su66-light-gray: #e9ecef;
  --su66-red-light: rgba(193, 18, 31, 0.1);
}

/* =========================
   BOUTONS RADIO PERSONNALISÉS
   ========================= */

/* Conteneur du bouton radio */
.form-check {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border: 2px solid var(--su66-light-gray);
  border-radius: 8px;
  transition: all 0.3s ease;
  cursor: pointer;
  background: var(--su66-white);
  display: flex !important;
  align-items: center !important;
  flex-direction: row !important;
  position: relative;
}

/* Effet hover sur le conteneur */
.form-check:hover {
  border-color: var(--su66-red);
  background: var(--su66-red-light);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(193, 18, 31, 0.15);
}

/* Bouton radio personnalisé */
.form-check-input[type="radio"] {
  width: 20px !important;
  height: 20px !important;
  margin-right: 12px !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
  position: relative !important;
  appearance: none !important;
  border: 2px solid var(--su66-gray) !important;
  border-radius: 50% !important;
  background: var(--su66-white) !important;
  transition: all 0.3s ease !important;
}

/* État focus du bouton radio */
.form-check-input[type="radio"]:focus {
  border-color: var(--su66-red) !important;
  box-shadow: 0 0 0 0.2rem var(--su66-red-light) !important;
  outline: none !important;
}

/* État sélectionné du bouton radio */
.form-check-input[type="radio"]:checked {
  background: var(--su66-red) !important;
  border-color: var(--su66-red) !important;
}

/* Point central du bouton radio sélectionné */
.form-check-input[type="radio"]:checked::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--su66-black);
  display: block;
}

/* Alternative : Point noir au centre */
.form-check-input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--su66-black);
  display: none; /* Activez en changeant à 'block' */
}

/* Label du bouton radio */
.form-check-label {
  font-weight: 500;
  color: var(--su66-black);
  cursor: pointer;
  transition: all 0.3s ease;
  flex: 1;
  font-size: 1rem;
  line-height: 1.4;
}

/* État hover du label */
.form-check:hover .form-check-label {
  color: var(--su66-red);
  font-weight: 600;
}

/* État sélectionné du label */
.form-check-input:checked + .form-check-label {
  color: var(--su66-red) !important;
  font-weight: 700 !important;
}

/* Conteneur sélectionné avec pseudo-classe :has() */
.form-check:has(.form-check-input:checked) {
  border-color: var(--su66-red) !important;
  background: linear-gradient(135deg, var(--su66-red-light) 0%, rgba(193, 18, 31, 0.05) 100%) !important;
  box-shadow: 0 4px 12px rgba(193, 18, 31, 0.2) !important;
  transform: scale(1.02) !important;
}

/* Fallback pour navigateurs sans :has() */
.form-check.selected {
  border-color: var(--su66-red) !important;
  background: linear-gradient(135deg, var(--su66-red-light) 0%, rgba(193, 18, 31, 0.05) 100%) !important;
  box-shadow: 0 4px 12px rgba(193, 18, 31, 0.2) !important;
  transform: scale(1.02) !important;
}

/* =========================
   STYLES POUR SONDAGES
   ========================= */

/* Spécifique aux formulaires de vote */
#vote-form .form-check {
  animation: radioFadeIn 0.4s ease-out;
  animation-fill-mode: both;
}

/* Animation d'apparition décalée */
#vote-form .form-check:nth-child(1) { animation-delay: 0.1s; }
#vote-form .form-check:nth-child(2) { animation-delay: 0.2s; }
#vote-form .form-check:nth-child(3) { animation-delay: 0.3s; }
#vote-form .form-check:nth-child(4) { animation-delay: 0.4s; }
#vote-form .form-check:nth-child(5) { animation-delay: 0.5s; }

@keyframes radioFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@media (max-width: 768px) {
  .form-check {
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
  }
  
  .form-check-input[type="radio"] {
    width: 18px !important;
    height: 18px !important;
    margin-right: 10px !important;
  }
  
  .form-check-input[type="radio"]:checked::before {
    width: 6px;
    height: 6px;
  }
  
  .form-check-label {
    font-size: 0.9rem;
  }
}

/* =========================
   THÈMES ALTERNATIFS
   ========================= */

/* Thème sombre (si activé) */
body.dark-mode .form-check {
  background: var(--su66-black);
  border-color: var(--su66-gray);
}

body.dark-mode .form-check:hover {
  background: rgba(193, 18, 31, 0.2);
}

body.dark-mode .form-check-label {
  color: var(--su66-white);
}

body.dark-mode .form-check-input[type="radio"] {
  background: var(--su66-black);
  border-color: var(--su66-white);
}

/* =========================
   EFFETS AVANCÉS
   ========================= */

/* Effet de pulsation pour le bouton sélectionné */
.form-check-input[type="radio"]:checked {
  animation: radioPulse 2s infinite;
}

@keyframes radioPulse {
  0%, 100% { 
    box-shadow: 0 0 0 0 rgba(193, 18, 31, 0.7);
  }
  50% { 
    box-shadow: 0 0 0 8px rgba(193, 18, 31, 0);
  }
}

/* Désactiver l'animation après sélection */
.form-check-input[type="radio"]:checked:focus {
  animation: none;
}