/* ===============================
   VARIABLES & WRAPPER GÉNÉRAL
   =============================== */
.agenda-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0 0.125rem 1rem;
}

/* ===============================
   BLOC 1 : CALENDRIER PLEINE LARGEUR
   =============================== */
.agenda-calendar {
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
}

.agenda-header {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  margin-bottom: 0.25rem;
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--cgt-white);
  padding: 0.4rem 0;
}

.agenda-header-left {
  display: flex;
  justify-content: flex-start;
}

.agenda-nav {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.agenda-nav button {
  background: var(--carbone);
  color: var(--cgt-white);
  border: none;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 400;
}

.agenda-header-center {
  display: flex;
  justify-content: center;
}

.agenda-month-year {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  justify-content: center;
}

.agenda-month-year select {
  padding: 0.45rem 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--carbone-80);
  background: var(--carbone);
  color: var(--cgt-white);
  box-shadow: var(--shadow-default);
  font-weight: 400;
}

.agenda-wk-toggle {
  padding: 0.45rem 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--carbone-50);
  background: var(--cgt-white);
  color: var(--carbone);
  font-weight: 400;
  box-shadow: var(--shadow-default);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.1s ease;
  appearance: none;
  -webkit-appearance: none;
}

.agenda-wk-toggle.is-active {
  background: var(--carbone);
  color: var(--cgt-white);
}

.agenda-wk-toggle:active {
  transform: translateY(1px);
}

.agenda-header-right {
  display: flex;
  justify-content: flex-end;
}
.agenda-toggle-we {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.9rem;
}

.agenda-toggle-we input {
  accent-color: var(--carbone);
}
.agenda-header h2 {
  margin: 0;
  color: var(--carbone);
}

.agenda-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(34px, 1fr));
  gap: 6px;
  position: sticky;
  top: 42px; /* hauteur du header */
  z-index: 2;
  background: var(--cgt-white);
  padding-bottom: 4px;
}
.agenda-days.weekdays-only {
  grid-template-columns: repeat(5, minmax(34px, 1fr));
}

/* ===============================
   GRILLE CALENDRIER
   =============================== */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(34px, 1fr));
  grid-auto-rows: 74px;
  gap: 6px;
  align-items: start;
  padding: 0 1px 10px 1px; /* marges gauche/droite + espace bas */
}
.calendar-grid.weekdays-only {
  grid-template-columns: repeat(5, minmax(34px, 1fr));
}

.calendar-day-name {
  font-weight: 600;
  font-size: 0.85rem;
  text-align: center;
  padding: 4px 0;
  color: var(--text-dark);
  border-bottom: 1px solid #ccc;
}

.calendar-grid .day {
  min-height: 74px;
  height: 74px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 22px 8px 6px 8px; /* espace pour le numéro du jour, contenus en haut à gauche */
  position: relative;
  font-size: 0.85rem;
  background-color: var(--cgt-white);
  border-left: 4px solid var(--carbone);
  border-radius: 8px;
  box-shadow: var(--shadow-default);
  overflow: hidden;
  width: 100%;
  cursor: pointer;
  transition: background-color 0.2s ease;
  line-height: 1.1em; /* Réduit l'espace entre lignes */
  box-sizing: border-box;
}

.day:hover {
  background-color: var(--carbone-50);
}
.day.has-event {
  background-color: #eef1f3; /* Gris très clair */
  color: #2f3b44;            /* Gris foncé pour le texte */
  border-radius: 8px;
  font-weight: bold;
  box-shadow: 0 2px 8px rgba(56, 79, 89, 0.1);
  font-weight: 400;
}

/* ===============================
  STYLE DES JOURS DU MOIS
   =============================== */
.day-number {
  position: absolute;
  top: 6px;
  left: 6px;
  font-weight: bold;
  font-size: 0.85rem;
  color: var(--text-dark);
}

.day-number::after {
  content: '';
  display: block;
  margin-top: 1px;
  border-bottom: 1px solid var(--carbone);
  width: 100%;
}

.day.today {
  background: linear-gradient(180deg, rgba(226, 7, 20, 0.18) 0%, rgba(226, 7, 20, 0.28) 100%);
  color: var(--text-dark);
  font-weight: bold;
  border: 2px solid var(--cgt-red);
  border-left: 4px solid var(--cgt-red);
  box-shadow: 0 0 0 2px rgba(226, 7, 20, 0.08), 0 6px 14px rgba(0, 0, 0, 0.12);
}
.day.today .day-number {
  position: absolute;
  top: 6px;
  left: 6px;
  color: var(--cgt-red);
  font-weight: 800;
}
.day.today .day-number::after {
  border-bottom-color: var(--cgt-red);
}

.day.selected {
  outline: 2px solid var(--carbone);
  outline-offset: -2px;
}

/* ===============================
   TITRES DES RÉUNIONS
   =============================== */
.day-title {
  margin-top: 0;
  font-size: 0.75rem;
  text-align: left;
  word-break: break-word;
  font-weight: 400;
  line-height: 1.2em;
  margin-bottom: 0;
}

.day-events {
  flex: 1;
  overflow-y: auto;
  padding-top: 2px;
  padding-right: 2px;
}

.day-title.type-cse {
  color: var(--carbone);
  font-weight: 700;
}
.day-title.type-commission {
  color: var(--carbone);
  font-weight: 700;
}
.day-title.type-cssct {
  color: #4c5a62;
}
.day-title.type-nao {
  color: #2f3b44;
}
.day-title.type-info {
  color: #6c7a84;
}

/* ===============================
   LIGNE DE SÉPARATION
   =============================== */
.agenda-separator {
  height: 4px;
  background-color: var(--carbone);
  width: 100%;
  border-radius: 2px;
  margin: 1rem 0;
}

/* ===============================
   DÉTAILS & DÉLÉGATION
   =============================== */
.agenda-bottom-row {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  margin-top: 2rem;
}

.agenda-day-details {
  flex: 1 1 100%;
  background-color: var(--cgt-white);
  padding: 1rem;
  border-radius: 10px;
  border-left: 4px solid var(--carbone);
  box-shadow: var(--shadow-default);
  min-height: 100px;
}

body.modal-open {
  overflow: hidden;
}

#selected-date-title {
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1rem;
  color: var(--carbone);
  border-bottom: 1px solid var(--carbone-50);
  padding: 0.4rem;
  margin-bottom: 0.8rem;
  text-align: center;
  background: var(--carbone-15);
  border-radius: 6px;
  width: 100%;
}

#selected-date-title .date-rouge {
  color: var(--cgt-red);
  font-weight: 700;
}
#selected-date-title .titre-noir {
  color: var(--carbone);
  font-weight: 700;
}

body.modal-open {
  overflow: hidden;
}

.agenda-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}

.agenda-modal.is-open {
  display: flex;
}

.agenda-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.agenda-modal-card {
  position: relative;
  background: var(--cgt-white);
  color: var(--carbone);
  width: min(95vw, 520px);
  max-width: 95vw;
  max-height: 90vh;
  border-radius: 12px;
  padding: 1.1rem 1.2rem 1.2rem 1.2rem;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.35);
  overflow: auto;
  z-index: 1;
  border-left: 4px solid var(--carbone);
}

@media (max-width: 640px) {
  .agenda-modal {
    align-items: center;
    justify-content: center;
  }
  .agenda-modal-card {
    width: 95vw;
    max-width: 95vw;
    max-height: 88vh;
    margin: 0;
    padding: 0.95rem;
  }
}

.agenda-modal-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: rgba(226, 7, 20, 0.12);
  border: 1px solid rgba(226, 7, 20, 0.35);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--cgt-red);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.18);
  transition: transform 0.1s ease, box-shadow 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.agenda-modal-close:hover {
  background: rgba(226, 7, 20, 0.18);
  border-color: rgba(226, 7, 20, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 8px 14px rgba(0, 0, 0, 0.22);
}

.agenda-modal-close:active {
  transform: translateY(0);
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.16);
}

.agenda-add-wrapper {
  margin: 0.5rem 0 0.8rem 0;
  display: flex;
  justify-content: flex-start;
}

.agenda-add-btn {
  padding: 0.7rem 0.95rem;
  border-radius: 10px;
  border: 1px solid rgba(226, 7, 20, 0.4);
  background: linear-gradient(135deg, var(--cgt-red), #f04a4a);
  color: var(--cgt-white);
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 18px rgba(226, 7, 20, 0.32);
  transition: transform 0.12s ease, box-shadow 0.18s ease;
}

.agenda-add-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 20px rgba(226, 7, 20, 0.42);
}

.offline-banner {
  background: rgba(226, 7, 20, 0.12);
  color: var(--cgt-white);
  border: 1px solid rgba(226, 7, 20, 0.4);
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  margin: 0.35rem 0 0.6rem 0;
  font-weight: 700;
}

.agenda-editor {
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--carbone-50);
}

.agenda-editor h3 {
  margin: 0 0 0.5rem 0;
  color: var(--carbone);
}

.agenda-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.agenda-form-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.agenda-form-row input,
.agenda-form-row textarea {
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--carbone-50);
  background: rgba(0, 0, 0, 0.04);
  color: var(--carbone);
  font-size: 0.95rem;
}

.agenda-submit {
  margin-top: 0.2rem;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, var(--cgt-red), #f04a4a);
  color: var(--cgt-white);
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 18px rgba(226, 7, 20, 0.32);
  transition: transform 0.12s ease, box-shadow 0.18s ease;
}

.agenda-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 20px rgba(226, 7, 20, 0.42);
}

.agenda-editor-feedback {
  min-height: 1.2rem;
  margin: 0.2rem 0 0 0;
  font-weight: 600;
}

.event-title-highlight {
  font-weight: bold;
  color: var(--carbone);
}

.day-events-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
}

.day-events-table td {
  padding: 4px 6px;
  border-bottom: 1px solid var(--carbone-50);
  vertical-align: top;
  font-size: 0.75rem; /* aligné sur la taille des titres dans le calendrier */
}

.day-events-title {
  font-weight: 600;
  width: 10%;
}

.agenda-time {
  font-weight: 800;
  color: var(--carbone);
  margin-right: 4px;
}

.day-events-actions {
  width: 10%;
  text-align: right;
}

.day-events-actions button {
  border: none;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
  margin-left: 0.3rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
  transition: transform 0.12s ease, box-shadow 0.18s ease;
}

.day-events-actions button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.32);
}

.day-events-actions button:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
}

.day-events-actions .agenda-delete {
  background: rgba(226, 7, 20, 0.12);
  color: var(--cgt-red);
  border: 1px solid rgba(226, 7, 20, 0.45);
}

.day-events-actions .agenda-edit {
  background: #0b4f2f; /* vert forêt */
  color: #fff;
}

.day-events-title-cse {
  font-weight: 800;
  color: var(--carbone);
}

.day-events-title-commission {
  font-weight: 700;
  color: var(--carbone);
}

.day-events-desc {
  width: 90%;
}
/* ===============================
   RESPONSIVE
   =============================== */
@media (max-width: 768px) {
  .agenda-bottom-row {
    flex-direction: column;
  }

  .agenda-day-details,
  .agenda-delegation {
    flex: 1 1 100%;
  }
}
/* ===============================
   BOUTONS DE NAVIGATION MOIS
   =============================== */
.agenda-nav button {
  background-color: var(--carbone);
  border: none;
  color: var(--cgt-white);
  font-weight: bold;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: var(--shadow-default);
  transition: background-color 0.2s ease;
}

.agenda-nav button:hover {
  background-color: var(--carbone-70);
}

/* ===============================
   style des jours week-end et fériés
   =============================== */

.calendar-grid .day.weekend {
  background-color: var(--foret-30);
  color: #2f3b44;
  border-left: 4px solid var(--foret);
  opacity: 1;
}
.calendar-grid .day.holiday {
  background-color: rgba(0, 179, 0, 0.12); /* vert adouci */
  border-left: 4px solid var(--jaune-3);
  opacity: 1;
}

.holiday-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.45);
  pointer-events: none;
  font-size: 0.85rem;
}
