/**
  Tableau de bord gestionnaire
 */

/* Alignement du toggle dans le nœud jsTree */
.form-check.form-switch {
  min-height: unset;
  margin-bottom: 0;
  vertical-align: middle;
}

.toggle-statut {
  cursor: pointer;
  vertical-align: middle;
}

.groupe-detail-link {
  color: #adb5bd;
  font-size: .75rem;
  vertical-align: middle;
  text-decoration: none;
  transition: color .2s ease;
}

.groupe-detail-link:hover {
  color: #0d6efd;
}

.groupe-choisi > .jstree-anchor {
  background-color: rgba(34, 197, 94, .1);
  border-radius: 4px;
}

.groupe-choisi > .jstree-anchor .badge {
  box-shadow: 0 0 0 2px #22c55e;
}

li.groupe-erreur > .jstree-anchor {
  background-color: rgba(234, 179, 8, 0.1);
  border-radius: 4px;
}

li.groupe-erreur > .jstree-anchor .badge {
  box-shadow: 0 0 0 2px #eab308;
}

/* Si les deux en même temps — erreur prend le dessus */
li.groupe-choisi.groupe-erreur > .jstree-anchor {
  background-color: rgba(234, 179, 8, 0.15);
}

li.groupe-choisi.groupe-erreur > .jstree-anchor .badge {
  box-shadow: 0 0 0 2px #eab308;
}

/** Container FlashMessenger */
#card-message-container {
  position: fixed;
  top: 3.9rem;
  right: 3rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

#card-message-container .card {
  opacity: 0;
  transform: translateX(40px);
  transition: opacity .3s ease, transform .3s ease;
}

#save-statut-container {
  position: fixed;
  bottom: 4.5rem;
  right: 2rem;
  z-index: 9999;
}

#save-statut-btn {
  border-radius: 50px;
  letter-spacing: .05em;
  font-size: 1rem;
  padding: 1rem 3rem;
  border: 3px solid #fff;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  animation: pulse-save 1s infinite, wiggle 5s ease-in-out infinite;
  text-shadow: 0 1px 3px rgba(0,0,0,.7);
}

#save-statut-btn:hover {
  transform: scale(1.08);
  transition: transform .15s ease;
  background: linear-gradient(135deg, #ef4444, #f59e0b);
}

/*@keyframes pulse-save {*/
/*    0%   { box-shadow: 0 0 0 0 rgba(239, 68, 68, .8), 0 8px 32px rgba(239,68,68,.4); }*/
/*    70%  { box-shadow: 0 0 0 18px rgba(239, 68, 68, 0), 0 8px 32px rgba(239,68,68,.4); }*/
/*    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0), 0 8px 32px rgba(239,68,68,.4); }*/
/*}*/

@keyframes wiggle {
  0%, 90%, 100% {
    transform: rotate(0deg);
  }
  92% {
    transform: rotate(-2deg);
  }
  96% {
    transform: rotate(2deg);
  }
}

/* Indique visuellement que les enfants ont des états mixtes */
.toggle-global:indeterminate {
  background-color: #f59e0b;
  border-color: #f59e0b;
  opacity: .8;
}

.expand-tree {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  background: rgba(253, 27, 27, 0.2);
  color: #fff;
  font-size: .7rem;
  vertical-align: middle;
  transition: background .2s ease, transform .2s ease;
}

.expand-tree:hover {
  background: rgba(243, 115, 115, 0.4);
  transform: scale(1.1);
}

/* Rotation de l'icône à l'ouverture */
.expand-tree .fa-chevron-up {
  transform: rotate(0deg);
  transition: transform .2s ease;
}

.expand-tree .fa-chevron-down {
  transform: rotate(0deg);
  transition: transform .2s ease;
}

.btn-skip {
  padding:     0.15rem 0.4rem;
  font-size:   0.75rem;
  line-height: 1;
  border-width: 1px;
  transition:  all .2s ease;
}

.node-skip-wrapper.node-skipped {
  opacity:         0.6;
  text-decoration: line-through;
  color:           #6c757d;
}

.node-skip-wrapper.node-skipped .elp-code {
  background-color: #dee2e6 !important;
  color:            #6c757d !important;
  text-decoration:  line-through;
}

.node-skip-wrapper.node-skipped::before {
  content:      '\f05e';
  font-family: 'Font Awesome 5 Free';
  font-weight:  900;
  color:        #dc3545;
  margin-right: 6px;
  font-size:    0.75rem;
}

/* Fond hachuré sur le li parent */
.node-skip-wrapper.node-skipped {
  background:    repeating-linear-gradient(
          -45deg,
          transparent,
          transparent 6px,
          rgba(255, 193, 7, 0.08) 6px,
          rgba(255, 193, 7, 0.08) 12px
  );
  border-left:   3px solid #ffc107;
  border-radius: 4px;
  padding-left:  4px;
}

.node-skip-wrapper.node-skipped .btn-skip {
  opacity:   1 !important;
  transform: none;
  filter:    none;
}

.node-skipped-auto > .jstree-anchor {
  opacity: 0.5;
  font-style: italic;
}

.node-skipped-auto > .jstree-anchor::after {
  content: ' (tous désactivés)';
  font-size: 0.75rem;
  color: #6c757d;
}

/**
 Tableau de bord étudiant
 */

.intro-box {
  max-width: 600px;
  margin: 10px auto;
  padding: 12px 16px;

  background: #f8f9fb;
  border-left: 4px solid #4a90e2;
  border-radius: 6px;

  font-size: 14px;
  line-height: 1.5;
  color: #2c3e50;

  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.intro-box strong {
  color: #4a90e2;
}

.intro-box p {
  margin: 6px 0;
}

.intro-box p:first-child {
  margin-top: 0;
}

.intro-box p:last-child {
  margin-bottom: 0;
}

.validation-choix-btn-container, .choix-groupe-btn-container {
  text-align: center;
  margin: 30px 0;
}

.cta-button {
  display: inline-block;
  padding: 12px 26px;

  font-size: 25px;
  font-weight: 600;
  text-decoration: none;

  color: #fff;
  background: var(--unistrap-color-main);

  border-radius: 0.25rem;
  border: none;

  box-shadow: 0 4px 10px rgba(74, 144, 226, 0.25);
  transition: all 0.2s ease;
  cursor: pointer;
}

.cta-button:hover {
  color: #fff;
  background: #357abd;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(74, 144, 226, 0.35);
}

.cta-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(74, 144, 226, 0.2);
}

.cta-button--valide {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  pointer-events: auto;
  transition:    all .2s ease;
  position:      relative;
}

.cta-button--valide:hover {
  background: linear-gradient(135deg, #16a34a, #15803d);
  transform:   translateY(-1px);
}

.cta-button--valide:hover .fa-check-circle {
  animation: shake .4s ease;
}

.cta-button:disabled {
  opacity: .45;
  cursor: not-allowed;
  filter: grayscale(60%);
  transform: none;
  box-shadow: none;
  pointer-events: auto; /* garder le curseur visible */
}

.cta-button--warning {
  background:    linear-gradient(135deg, #f97316, #ea580c);
  color:         #fff;
  font-weight:   600;
  letter-spacing: .02em;
  padding:       0.6rem 1.8rem;
  transition:    all .2s ease;
  position:      relative;
  overflow:      hidden;
}

.cta-button--warning:hover {
  background:  linear-gradient(135deg, #ea580c, #c2410c);
  transform:   translateY(-1px);
  box-shadow:  0 4px 16px rgba(234, 88, 12, 0.45);
  color:       #fff;
}

.cta-button--warning:active {
  transform:  translateY(0);
  box-shadow: none;
}

.cta-button--warning:hover .fa-exclamation-triangle {
  animation: shake .4s ease;
}

@keyframes shake {
  0%, 100% { transform: rotate(0deg); }
  25%       { transform: rotate(-10deg); }
  75%       { transform: rotate(10deg); }
}

/* Badge pulsant pour attirer l'attention */
.cta-button--warning::before {
  content:       '';
  position:      absolute;
  inset:         0;
  background:    rgba(255, 255, 255, 0.15);
  animation:     pulse-warning 2s ease-in-out infinite;
}

@keyframes pulse-warning {
  0%, 100% { opacity: 0; transform: scale(1); }
  50%       { opacity: 1; transform: scale(1.03); }
}

/* Bouton actif mais avec avertissement */
#btn-valider-choix:not(:disabled).avec-groupes-complets {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-color: #d97706;
}

#refresh-capacites-btn {
  border-width: 2px;
  border-radius: 50px;
  letter-spacing: .02em;
  transition: all .2s ease;
  position: relative;
  overflow: hidden;
}

#refresh-capacites-btn:hover {
  background-color: #fff;
  /*background-color: #0d6efd;*/
  /*color: #fff;*/
  color: #0d6efd;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(13, 110, 253, .3);
}

#refresh-capacites-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

#refresh-capacites-btn:hover .fa-sync-alt {
  animation: spin-once .5s ease;
}

@keyframes spin-once {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

#refresh-capacites-last {
  font-size: .8rem;
  font-style: italic;
}

/* overlay lors de la validation */
#validation-overlay {
  display:          none;
  position:         fixed;
  inset:            0;
  background:       rgba(0, 0, 0, 0.55);
  z-index:          9999;
  flex-direction:   column;
  align-items:      center;
  justify-content:  center;
  gap:              1.5rem;
}

#validation-overlay.actif {
  display: flex;
}

#validation-overlay .overlay-card {
  background:    #fff;
  border-radius: 16px;
  padding:       2.5rem 3rem;
  text-align:    center;
  box-shadow:    0 8px 32px rgba(0, 0, 0, 0.2);
  min-width:     280px;
}

#validation-overlay .spinner {
  width:         56px;
  height:        56px;
  border:        5px solid #e9ecef;
  border-top:    5px solid #0d6efd;
  border-radius: 50%;
  animation:     spin 0.8s linear infinite;
  margin:        0 auto 1.25rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#validation-overlay .overlay-titre {
  font-size:   1.1rem;
  font-weight: 600;
  color:       #212529;
  margin:      0 0 0.5rem;
}

#validation-overlay .overlay-sous-titre {
  font-size: 0.875rem;
  color:     #6c757d;
  margin:    0;
}

/* Animation du texte en cours */
#validation-overlay .overlay-sous-titre::after {
  content:   '';
  animation: ellipsis 1.5s steps(4, end) infinite;
}

@keyframes ellipsis {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
  100% { content: ''; }
}