/* ===== STYLES DE BASE ===== */
.container.contenu-principal {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
}

.contenu-principal .region-content-bottom {
    width: 100%;
}

/* ===== SWITCHER ===== */
.agenda-switcher {
  text-align: right;
  margin-bottom: 20px;
  display: flex; 
  justify-content: flex-end; 
  gap: 5px;
}

.agenda-switch {
  margin-left: 5px;
}

.agenda-switch.active {
  background: #0074d9;
  color: #fff;
}

.agenda-switch-list { order: 2; }
.agenda-switch-grid { order: 1; }

/* ===== CONTENEUR PRINCIPAL ===== */
.agenda-page {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-content: flex-start;
    align-items: stretch;
    justify-content: flex-start;
}

/* ===== ÉLÉMENTS AGENDA ===== */
.agenda-item { 
  background: #fff; 
  border-radius: 6px; 
  box-shadow: 0 2px 8px rgba(0,0,0,0.07); 
  padding: 10px; 
  transition: box-shadow 0.2s; 
  width: 100%; 
  margin-bottom: 10px;
}

.agenda-item:hover { 
  box-shadow: 0 4px 16px rgba(0,0,0,0.13); 
  background: #f5f5f5;
}

/* ===== IMAGES ===== */
.agenda-img .img-wrapper { 
  width: 100%; 
  height: 120px; 
  overflow: hidden; 
  border-radius: 6px; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
}

.agenda-img img { 
  max-width: 100%; 
  max-height: 120px; 
  object-fit: cover; 
}

/* ===== CONTENU ===== */
.agenda-content { 
  padding-left: 10px; 
}

.agenda-header { 
  font-size: 0.95em; 
  color: #888; 
  margin-bottom: 5px; 
}

.agenda-title { 
  font-size: 1.2em; 
  font-weight: bold; 
  margin-bottom: 8px; 
  color: #222; 
}

.agenda-meta { 
  margin-bottom: 5px; 
}

.agenda-categorie, .agenda-profil { 
  margin-right: 8px; 
  font-size: 0.95em; 
}

.agenda-categorie.badge-info { 
  background: #17a2b8; 
  color: #fff; 
}

.agenda-profil.badge-secondary { 
  background: #6c757d; 
  color: #fff; 
}

/* ===== VUE GRILLE ===== */
.agenda-view-grid .agenda-item {
  width: calc(50% - 5px);
  display: flex;
  margin-right: 0;
  margin-bottom: 10px;
}

/* ===== VUE LISTE ===== */
.agenda-view-list .agenda-item {
  width: 100%;
  display: flex;
  flex-direction: column;
  margin-right: 0;
  margin-bottom: 10px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 991px) {
  .agenda-view-grid .agenda-item,
  .agenda-view-list .agenda-item {
    width: 100%;
    margin-right: 0;
  }
}

/* ===== SIDEBAR ===== */
.agenda-sidebar-form {
    background: #f7f7f7;
    box-shadow: 0px 0px 8px #55555559;
    border-radius: 10px;
    padding: 28px 18px 24px 18px;
    margin-bottom: 30px;
    min-width: 260px;
    max-width: 340px;
    position: sticky;
    top: 30px;
    z-index: 10;
}

body .agenda-page, body .agenda-switcher { 
    margin-left: 0; 
}

.agenda-sidebar-form.is-sticky {
    position: fixed;
    top: 80px;
}

.agenda-sidebar-form .form-group {
  margin-bottom: 8px;
}

.agenda-sidebar-form .label {
    color: #3E3E3E;
    font-weight: 600;
    font-size: 14px !important;
    margin-bottom: 4px;
}

.agenda-sidebar-form input[type="text"],
.agenda-sidebar-form input[type="date"],
.agenda-sidebar-form select {
  width: 100%;
  border-radius: 6px;
  border: 1px solid #cce4f6;
  padding: 7px 10px;
  font-size: 1em;
  margin-bottom: 0;
  transition: border 0.2s;
}

.agenda-sidebar-form input[type="text"]:focus,
.agenda-sidebar-form input[type="date"]:focus,
.agenda-sidebar-form select:focus {
  border: 1.5px solid #009EE3;
}

.agenda-sidebar-form input[type="text"]:focus,
.agenda-sidebar-form input[type="date"]:focus,
.agenda-sidebar-form select:focus, 
#toggle-order-btn, 
button.agenda-switch,
.agenda-sidebar-form .btn {
  outline: none!important;
}

.agenda-sidebar-form .btn,
.agenda-sidebar-form .submit-button input[type="submit"] {
  width: 100%;
  background: #009EE3;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  font-size: 1.1em;
  margin-top: 10px;
  margin-bottom: 0;
  padding: 10px 0;
  transition: background 0.2s;
}

.agenda-sidebar-form .btn:hover,
.agenda-sidebar-form .submit-button input[type="submit"]:hover {
  background: #0074d9;
}

#toggle-order-btn {
  margin-top: 0;
  margin-bottom: 0;
  background: #eaf6fb;
  color: #009EE3;
  border: 1px solid #cce4f6;
  border-radius: 6px;
  font-weight: bold;
  font-size: 1em;
  transition: background 0.2s, color 0.2s;
}

#toggle-order-btn:hover {
  background: #009EE3;
  color: #fff;
}

.agenda-main-content {
  flex: 1;
  min-width: 0;
}

/* ===== LAYOUT RESPONSIVE ===== */
@media (max-width: 991px) {
  .agenda-layout { display: block; }
  .agenda-sidebar-form, .agenda-main-content { width: 100%; margin-right: 0; }
}

/* ===== MASQUAGE ÉLÉMENTS INUTILES ===== */
.formulaire-recherche-agenda .entete,
.pagination-wrap + .more-link {
    display: none!important;
}

.formulaire-recherche-agenda .widgets {
    padding: 10px !important;
    margin: 0 !important;
    background: transparent !important;
}

.formulaire-recherche-agenda .widgets .submit-button #edit-submit-recherche-agenda {
    bottom: initial!important;
}

/* ===== MOBILE ===== */
@media (max-width: 1190px) {
  .agenda-layout {
    display: block;
  }
  .agenda-sidebar-wrapper {
    position: static;
    z-index: auto;
  }
  .agenda-sidebar-form {
    display: none !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    z-index: 99999 !important;
    background: rgba(255,255,255,0.98) !important;
    box-shadow: 0 0 40px rgba(0,0,0,0.18) !important;
    overflow-y: auto !important;
    padding: 32px 18px 24px 18px !important;
    transition: transform 0.3s, opacity 0.3s !important;
    transform: translateX(-100vw) !important;
    opacity: 0 !important;
    visibility: hidden !important;
  }
  body.sidebar-mobile-open .agenda-sidebar-form {
    display: block !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    z-index: 99999 !important;
    background: rgba(255,255,255,0.98) !important;
    box-shadow: 0 0 40px rgba(0,0,0,0.18) !important;
    overflow-y: auto !important;
    padding: 32px 18px 24px 18px !important;
    transition: transform 0.3s, opacity 0.3s !important;
    transform: translateX(0) !important;
    opacity: 1 !important;
    visibility: visible !important;
  }
  .agenda-main-content,
  .contenu-principal > .row {
    width: 100%;
    max-width: 100vw;
    margin: auto;
  }
  .agenda-filters-toggle {
    display: inline-block !important;
    margin-right: 10px;
    font-weight: bold;
    background: #009EE3;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 1em;
    box-shadow: 0 2px 8px rgba(0,158,227,0.10);
    z-index: 2100;
    position: relative;
  }
  .agenda-sidebar-close {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 2em;
    background: none;
    border: none;
    color: #009EE3;
    z-index: 2200;
    cursor: pointer;
    transition: color 0.2s;
  }
  .agenda-sidebar-close:hover {
    color: #0074d9;
  }
  body.sidebar-mobile-open {
    overflow: hidden !important;
  }
}

@media (max-width: 767px) {
  .agenda-sidebar-form {
    width: 100vw !important;
    max-width: 100vw !important;
    left: 0 !important;
    right: 0 !important;
    border-radius: 0 !important;
    padding: 18px 6px 18px 6px !important;
  }
}

body.sidebar-mobile-open::before {
  content: '';
  display: block !important;
  position: fixed !important;
  top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
  background: rgba(0,0,0,0.35) !important;
  z-index: 99998 !important;
  transition: opacity 0.3s !important;
}

body:not(.sidebar-mobile-open)::before {
  display: none !important;
}

body.sidebar-mobile-open .agenda-sidebar-form,
body.sidebar-mobile-open form .agenda-sidebar-form,
body.sidebar-mobile-open .formulaire-recherche-agenda.agenda-sidebar-form {
  display: block !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  z-index: 99999 !important;
  background: rgba(255,255,255,0.98) !important;
  box-shadow: 0 0 40px rgba(0,0,0,0.18) !important;
  overflow-y: auto !important;
  padding: 32px 18px 24px 18px !important;
  transition: transform 0.3s, opacity 0.3s !important;
  transform: translateX(0) !important;
  opacity: 1 !important;
  visibility: visible !important;
}

button.agenda-sidebar-close {
    display: block;
}

button.agenda-switch, 
button.agenda-switch {
    display: none;
}

button.agenda-filters-toggle {
    width: 100%;
    margin: 20px auto 0;
}

/* ===== DESKTOP ===== */
@media (min-width: 1190px) {
    button.agenda-sidebar-close,
    button.agenda-switch, 
    button.agenda-switch {
        display: none;
    }
    button.agenda-switch, 
    button.agenda-switch {
        display: block;
    }
  .agenda-layout {
    display: flex;
    align-items: flex-start;
    max-width: 1400px;
    margin: 0 auto;
    gap: 32px;
  }
  .agenda-sidebar-wrapper {
    min-width: 320px;
    max-width: 340px;
    flex-shrink: 0;
  }
  .agenda-sidebar-form {
    position: sticky;
    top: 30px;
    width: 100%;
    min-width: 260px;
    max-width: 340px;
    margin-bottom: 30px;
    z-index: 10;
    background: #f7f7f7;
    box-shadow: 0px 0px 8px #55555559;
    border-radius: 10px;
    padding: 28px 18px 24px 18px;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    display: block !important;
  }
  .agenda-main-content {
    flex: 1;
    min-width: 0;
    width: auto;
    max-width: calc(100% - 340px - 32px);
  }
}

/* ===== NOUVEAUX STYLES POUR LES AMÉLIORATIONS ===== */
.agenda-sidebar-form select[name="sort_order"] {
  width: 100%;
  background: #eaf6fb;
  color: #009EE3;
  border: 1px solid #cce4f6;
  border-radius: 6px;
  font-weight: bold;
  font-size: 1em;
  padding: 7px 10px;
  transition: background 0.2s, color 0.2s;
}

.agenda-sidebar-form select[name="sort_order"]:hover {
  background: #009EE3;
  color: #fff;
}

.agenda-sidebar-form input[type="checkbox"] {
  margin-right: 8px;
  transform: scale(1.2);
}

.agenda-sidebar-form .checkbox-inline {
  font-weight: 600;
  color: #3E3E3E;
  margin-top: 10px;
  margin-bottom: 10px;
}

/* Badge pour indiquer les événements passés */
.agenda-item.past-event {
  opacity: 0.6;
  background: #f9f9f9;
}

.agenda-item.past-event::after {
  content: "Passé";
  position: absolute;
  top: 10px;
  right: 10px;
  background: #888;
  color: white;
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 0.85em;
  font-weight: bold;
}

/* Animation pour le changement de tri */
.agenda-page {
  transition: opacity 0.3s ease;
}

.agenda-page.sorting {
  opacity: 0.5;
}

/* Indicateur de tri actif */
.agenda-sidebar-form .label.active-sort {
  color: #009EE3;
  position: relative;
}

.agenda-sidebar-form .label.active-sort::after {
  content: " ✓";
  color: #009EE3;
}




.agenda-view-grid .agenda-item .agenda-link .agenda-item-inner {
    background-color: transparent !important;
}