/* ==========================================================================
   1. CONTENEUR PRINCIPAL & INIT (DARK MODE)
   ========================================================================== */

.regie-calendar-wrapper {
  background-color: #1e1e1e; /* Fond principal sombre */
  border: 1px solid #333;
  border-radius: 4px;
  padding: 20px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
  color: #e0e0e0; /* Texte clair global */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  position: relative; /* Pour le loader */
  min-height: 400px; /* Hauteur min pour éviter le saut au chargement */
}

/* Lien global */
.regie-calendar-wrapper a {
  color: #72aee6;
  text-decoration: none;
}

/* ==========================================================================
   2. LE LOADER (CHARGEMENT)
   ========================================================================== */

.regie-loader {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(30, 30, 30, 0.85);
  z-index: 50; /* Au-dessus du calendrier */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
  border-radius: 4px;
  transition: opacity 0.3s ease;
  opacity: 0; /* Caché par défaut via JS */
  pointer-events: none; /* Ne pas bloquer si bug d'affichage */
}

.regie-loader .spinner {
  border: 3px solid rgba(255,255,255,0.1);
  border-radius: 50%;
  border-top: 3px solid #0073aa;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin-bottom: 15px;
}

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

/* ==========================================================================
   3. FULLCALENDAR - BARRE D'OUTILS & BOUTONS
   ========================================================================== */

#calendar-regie .fc-toolbar-title {
  color: #fff;
  font-size: 1.5rem;
  font-weight: 600;
}

#calendar-regie .fc-button-primary {
  background-color: #2c3338;
  border-color: #444;
  color: #fff;
  font-weight: 500;
  transition: all 0.2s ease;
  text-transform: capitalize;
}

#calendar-regie .fc-button-primary:hover,
#calendar-regie .fc-button-primary.fc-button-active {
  background-color: #0073aa; /* Bleu WP */
  border-color: #0073aa;
  color: #fff;
}

#calendar-regie .fc-button-primary:disabled {
  background-color: #1a1a1a;
  border-color: #333;
  color: #555;
}

/* ==========================================================================
   4. FULLCALENDAR - VUE GRILLE (DESKTOP)
   ========================================================================== */

/* Lignes de la grille */
#calendar-regie .fc-theme-standard td,
#calendar-regie .fc-theme-standard th,
#calendar-regie .fc-theme-standard .fc-scrollgrid {
  border-color: #444;
}

/* En-têtes (Lundi, Mardi...) */
#calendar-regie .fc-col-header-cell-cushion {
  color: #bbb;
  text-transform: capitalize;
  text-decoration: none;
  padding: 8px 0;
}

/* Numéros des jours */
#calendar-regie .fc-daygrid-day-number {
  color: #999;
  text-decoration: none;
}

/* Case "Aujourd'hui" */
#calendar-regie .fc-day-today {
  background-color: rgba(255, 255, 255, 0.04) !important;
}

/* Les événements (Tuiles) */
#calendar-regie .fc-daygrid-event {
  background-color: #3a4b55;
  border: 1px solid #4a5b65;
  color: #fff;
  border-radius: 3px;
  padding: 2px 4px;
  margin-top: 2px;
  cursor: pointer;
  transition: transform 0.1s;
}

#calendar-regie .fc-daygrid-event:hover {
  transform: scale(1.02);
  background-color: #0073aa;
  border-color: #0073aa;
  z-index: 5;
}

/* ==========================================================================
   5. FULLCALENDAR - VUE LISTE (MOBILE & TABLETTE)
   ========================================================================== */

/* Fond global de la table liste */
#calendar-regie .fc-list {
  border-color: #444;
}

/* En-tête des jours (La barre "Lundi 12 Janvier") */
#calendar-regie .fc-list-day-cushion {
  background-color: #2c3338 !important;
  color: #fff !important;
}

/* La ligne d'événement */
#calendar-regie .fc-list-event:hover td {
  background-color: #333 !important;
  cursor: pointer;
}

/* Titre et Heure */
#calendar-regie .fc-list-event-title,
#calendar-regie .fc-list-event-time {
  color: #e0e0e0;
}

/* Point de couleur */
#calendar-regie .fc-list-event-dot {
  border-color: #0073aa;
}

/* "Aucun événement" */
#calendar-regie .fc-list-empty {
  background-color: #1e1e1e;
  color: #999;
}

/* ==========================================================================
   6. LA MODALE (DARK MODE)
   ========================================================================== */

.regie-modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s;
}

.regie-modal.is-visible {
  opacity: 1;
  visibility: visible;
}

.regie-modal-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.85); /* Fond très noir */
  backdrop-filter: blur(3px);
}

.regie-modal-container {
  background: #23282d; /* Gris Admin WP */
  color: #f0f0f0;
  width: 90%;
  max-width: 700px;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 15px 40px rgba(0,0,0,0.8);
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #444;
  animation: regieSlideUp 0.3s ease-out;
}

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

/* Header Modale */
.regie-modal-header {
  background: #191e23;
  padding: 15px 20px;
  border-bottom: 1px solid #333;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0; /* Ne s'écrase pas */
}

.regie-modal-header h2 {
  margin: 0;
  font-size: 1.3rem;
  color: #fff;
  line-height: 1.2;
}

.regie-modal-close {
  background: transparent;
  border: none;
  font-size: 2rem;
  line-height: 1;
  color: #888;
  cursor: pointer;
  padding: 0 10px;
}

.regie-modal-close:hover { color: #ff5f5f; }

/* Body Modale */
.regie-modal-body {
  padding: 25px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* Scroll fluide sur iOS */
}

/* Sections */
.regie-section {
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 1px solid #333;
}

.regie-section:last-child { border-bottom: none; }

.regie-section h3 {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #8faec4;
  margin: 0 0 15px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.regie-section h3 .dashicons { color: #72aee6; }

/* Grille Infos (Date/Lieu) */
.regie-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  background: #2c3338;
  padding: 15px;
  border-radius: 6px;
  border-left: 4px solid #72aee6;
  margin-bottom: 25px;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  color: #fff;
}

/* Liste Staff */
.regie-list-infos {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.regie-list-infos li {
  background: #2c3338;
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 0.9rem;
  border: 1px solid #333;
}

.regie-list-infos li span {
  display: block;
  font-size: 0.75rem;
  color: #aaa;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.regie-list-infos li strong { color: #fff; }

/* ==========================================================================
   7. CORRECTIF WYSIWYG & LISTES
   ========================================================================== */

.regie-wysiwyg-content { color: #e0e0e0; }
.regie-wysiwyg-content p { margin-bottom: 1em; }

/* Force l'affichage des puces */
.regie-wysiwyg-content ul,
.regie-wysiwyg-content ol {
  margin: 0 0 1.5em 2em !important;
  padding: 0 !important;
  list-style-position: outside !important;
}

.regie-wysiwyg-content ul { list-style-type: disc !important; }
.regie-wysiwyg-content ol { list-style-type: decimal !important; }
.regie-wysiwyg-content li {
  display: list-item !important;
  margin-bottom: 0.5em !important;
  padding-left: 0.5em !important;
  color: #e0e0e0;
}
.regie-wysiwyg-content strong { color: #fff; font-weight: 700; }
.regie-wysiwyg-content a { color: #72aee6; text-decoration: underline; }

/* ==========================================================================
   8. RESPONSIVE (MOBILE & TABLETTE)
   ========================================================================== */

@media (max-width: 768px) {

  /* Conteneur moins large sur mobile */
  .regie-calendar-wrapper {
    padding: 10px;
  }

  /* BARRE D'OUTILS FULLCALENDAR */
  #calendar-regie .fc-toolbar {
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 1em !important;
  }

  #calendar-regie .fc-toolbar-title {
    font-size: 1.2rem !important; /* Titre plus petit */
    width: 100%; /* Titre sur sa propre ligne si besoin */
    text-align: center;
  }

  /* Boutons navigation plus gros pour le tactile */
  #calendar-regie .fc-button {
    padding: 0.5em 0.8em !important;
    font-size: 0.9em !important;
  }

  /* VUE LISTE (MOBILE) */
  /* Plus d'espace vertical pour cliquer facilement sur un event */
  #calendar-regie .fc-list-event-title {
    font-size: 1rem;
    padding: 12px 0;
  }

  #calendar-regie .fc-list-event-time {
    white-space: nowrap; /* Empêche l'heure de casse/* ==========================================================================
   1. CONTENEUR PRINCIPAL & INIT (DARK MODE)
   ========================================================================== */

    .regie-calendar-wrapper {
      background-color: #1e1e1e; /* Fond principal sombre */
      border: 1px solid #333;
      border-radius: 4px;
      padding: 20px;
      box-shadow: 0 4px 10px rgba(0,0,0,0.5);
      color: #e0e0e0; /* Texte clair global */
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
      position: relative; /* Pour le loader */
      min-height: 400px; /* Hauteur min pour éviter le saut au chargement */
    }

    /* Lien global */
    .regie-calendar-wrapper a {
      color: #72aee6;
      text-decoration: none;
    }

    /* ==========================================================================
       2. LE LOADER (CHARGEMENT)
       ========================================================================== */

    .regie-loader {
      position: absolute;
      top: 0; left: 0; right: 0; bottom: 0;
      background: rgba(30, 30, 30, 0.85);
      z-index: 50; /* Au-dessus du calendrier */
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      color: #fff;
      font-size: 1rem;
      border-radius: 4px;
      transition: opacity 0.3s ease;
      opacity: 0; /* Caché par défaut via JS */
      pointer-events: none; /* Ne pas bloquer si bug d'affichage */
    }

    .regie-loader .spinner {
      border: 3px solid rgba(255,255,255,0.1);
      border-radius: 50%;
      border-top: 3px solid #0073aa;
      width: 40px;
      height: 40px;
      animation: spin 1s linear infinite;
      margin-bottom: 15px;
    }

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

    /* ==========================================================================
       3. FULLCALENDAR - BARRE D'OUTILS & BOUTONS
       ========================================================================== */

    #calendar-regie .fc-toolbar-title {
      color: #fff;
      font-size: 1.5rem;
      font-weight: 600;
    }

    #calendar-regie .fc-button-primary {
      background-color: #2c3338;
      border-color: #444;
      color: #fff;
      font-weight: 500;
      transition: all 0.2s ease;
      text-transform: capitalize;
    }

    #calendar-regie .fc-button-primary:hover,
    #calendar-regie .fc-button-primary.fc-button-active {
      background-color: #0073aa; /* Bleu WP */
      border-color: #0073aa;
      color: #fff;
    }

    #calendar-regie .fc-button-primary:disabled {
      background-color: #1a1a1a;
      border-color: #333;
      color: #555;
    }

    /* ==========================================================================
       4. FULLCALENDAR - VUE GRILLE (DESKTOP)
       ========================================================================== */

    /* Lignes de la grille */
    #calendar-regie .fc-theme-standard td,
    #calendar-regie .fc-theme-standard th,
    #calendar-regie .fc-theme-standard .fc-scrollgrid {
      border-color: #444;
    }

    /* En-têtes (Lundi, Mardi...) */
    #calendar-regie .fc-col-header-cell-cushion {
      color: #bbb;
      text-transform: capitalize;
      text-decoration: none;
      padding: 8px 0;
    }

    /* Numéros des jours */
    #calendar-regie .fc-daygrid-day-number {
      color: #999;
      text-decoration: none;
    }

    /* Case "Aujourd'hui" */
    #calendar-regie .fc-day-today {
      background-color: rgba(255, 255, 255, 0.04) !important;
    }

    /* Les événements (Tuiles) */
    #calendar-regie .fc-daygrid-event {
      background-color: #3a4b55;
      border: 1px solid #4a5b65;
      color: #fff;
      border-radius: 3px;
      padding: 2px 4px;
      margin-top: 2px;
      cursor: pointer;
      transition: transform 0.1s;
    }

    #calendar-regie .fc-daygrid-event:hover {
      transform: scale(1.02);
      background-color: #0073aa;
      border-color: #0073aa;
      z-index: 5;
    }

    /* ==========================================================================
       5. FULLCALENDAR - VUE LISTE (MOBILE & TABLETTE)
       ========================================================================== */

    #calendar-regie .fc-list {
      border-color: #444;
    }

    #calendar-regie .fc-list-day-cushion {
      background-color: #2c3338 !important;
      color: #fff !important;
    }

    #calendar-regie .fc-list-event:hover td {
      background-color: #333 !important;
      cursor: pointer;
    }

    #calendar-regie .fc-list-event-title,
    #calendar-regie .fc-list-event-time {
      color: #e0e0e0;
    }

    #calendar-regie .fc-list-event-dot {
      border-color: #0073aa;
    }

    #calendar-regie .fc-list-empty {
      background-color: #1e1e1e;
      color: #999;
    }

    /* ==========================================================================
       6. LA MODALE (DARK MODE)
       ========================================================================== */

    .regie-modal {
      position: fixed;
      top: 0; left: 0;
      width: 100%; height: 100%;
      z-index: 99999;
      display: flex;
      align-items: center;
      justify-content: center;
      opacity: 0;
      visibility: hidden;
      transition: opacity 0.2s ease, visibility 0.2s;
    }

    .regie-modal.is-visible {
      opacity: 1;
      visibility: visible;
    }

    .regie-modal-overlay {
      position: absolute;
      top: 0; left: 0;
      width: 100%; height: 100%;
      background: rgba(0, 0, 0, 0.85); 
      backdrop-filter: blur(3px);
    }

    .regie-modal-container {
      background: #23282d;
      color: #f0f0f0;
      width: 90%;
      max-width: 700px;
      max-height: 90vh;
      border-radius: 8px;
      box-shadow: 0 15px 40px rgba(0,0,0,0.8);
      position: relative;
      z-index: 10;
      display: flex;
      flex-direction: column;
      overflow: hidden;
      border: 1px solid #444;
      animation: regieSlideUp 0.3s ease-out;
    }

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

    .regie-modal-header {
      background: #191e23;
      padding: 15px 20px;
      border-bottom: 1px solid #333;
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-shrink: 0; 
    }

    .regie-modal-header h2 {
      margin: 0;
      font-size: 1.3rem;
      color: #fff;
      line-height: 1.2;
    }

    .regie-modal-close {
      background: transparent;
      border: none;
      font-size: 2rem;
      line-height: 1;
      color: #888;
      cursor: pointer;
      padding: 0 10px;
    }

    .regie-modal-close:hover { color: #ff5f5f; }

    .regie-modal-body {
      padding: 25px;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
    }

    /* Sections */
    .regie-section {
      margin-bottom: 25px;
      padding-bottom: 20px;
      border-bottom: 1px solid #333;
    }

    .regie-section:last-child { border-bottom: none; }

    .regie-section h3 {
      font-size: 0.95rem;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: #8faec4;
      margin: 0 0 15px 0;
      display: flex;
      align-items: center;
      gap: 8px;
      font-weight: 600;
    }

    .regie-section h3 .dashicons { color: #72aee6; }

    .regie-meta-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 15px;
      background: #2c3338;
      padding: 15px;
      border-radius: 6px;
      border-left: 4px solid #72aee6;
      margin-bottom: 25px;
    }

    .meta-item {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 0.95rem;
      color: #fff;
    }

    /* Liste Staff */
    .regie-list-infos {
      list-style: none;
      padding: 0;
      margin: 0;
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
      gap: 10px;
    }

    .regie-list-infos li {
      background: #2c3338;
      padding: 10px 12px;
      border-radius: 4px;
      font-size: 0.9rem;
      border: 1px solid #333;
    }

    .regie-list-infos li span {
      display: block;
      font-size: 0.75rem;
      color: #aaa;
      text-transform: uppercase;
      margin-bottom: 3px;
    }

    .regie-list-infos li strong { color: #fff; }

    /* ==========================================================================
       7. CORRECTIF WYSIWYG & LISTES
       ========================================================================== */

    .regie-wysiwyg-content { color: #e0e0e0; }
    .regie-wysiwyg-content p { margin-bottom: 1em; }

    .regie-wysiwyg-content ul,
    .regie-wysiwyg-content ol {
      margin: 0 0 1.5em 2em !important;
      padding: 0 !important;
      list-style-position: outside !important;
    }

    .regie-wysiwyg-content ul { list-style-type: disc !important; }
    .regie-wysiwyg-content ol { list-style-type: decimal !important; }
    .regie-wysiwyg-content li {
      display: list-item !important;
      margin-bottom: 0.5em !important;
      padding-left: 0.5em !important;
      color: #e0e0e0;
    }
    .regie-wysiwyg-content strong { color: #fff; font-weight: 700; }
    .regie-wysiwyg-content a { color: #72aee6; text-decoration: underline; }

    /* ==========================================================================
       8. RESPONSIVE (MOBILE & TABLETTE)
       ========================================================================== */

    @media (max-width: 768px) {

      .regie-calendar-wrapper {
        padding: 10px;
      }

      #calendar-regie .fc-toolbar {
        flex-wrap: wrap;
        gap: 10px;
        margin-bottom: 1em !important;
      }

      #calendar-regie .fc-toolbar-title {
        font-size: 1.2rem !important;
        width: 100%; 
        text-align: center;
      }

      #calendar-regie .fc-button {
        padding: 0.5em 0.8em !important;
        font-size: 0.9em !important;
      }

      #calendar-regie .fc-list-event-title {
        font-size: 1rem;
        padding: 12px 0;
      }

      #calendar-regie .fc-list-event-time {
        white-space: nowrap; 
      }

      .regie-modal-container {
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        border: none;
      }

      .regie-modal-header {
        padding: 15px; 
      }

      .regie-modal-header h2 {
        font-size: 1.1rem;
        padding-right: 15px;
      }

      .regie-meta-grid {
        grid-template-columns: 1fr;
        gap: 10px;
      }

      .regie-list-infos {
        grid-template-columns: 1fr;
      }
    }
  }

  .regie-modal-container {
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    border: none;
  }

  .regie-modal-header {
    padding: 15px;
  }

  .regie-modal-header h2 {
    font-size: 1.1rem;
    padding-right: 15px;
  }

  .regie-meta-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .regie-list-infos {
    grid-template-columns: 1fr;
  }
}