/* ============================================================
   Emploi du temps — styles spécifiques au module.
   Réutilise les tokens de couleur/typo, le système de modales et les
   boutons/badges déjà définis dans cahier-journal.css (chargé avant ce
   fichier) : on n'y redéfinit ni .modal-overlay/.modal-box, ni les
   couleurs de marque, seulement la mise en page propre à ce module
   (liste des grilles, axe horaire, blocs de créneau, drag/resize).
   ============================================================ */

.appel-empty-state {
  padding: 40px;
  text-align: center;
  color: var(--secondaire);
  font-family: var(--font-corps);
  font-size: 16px;
}

.edt-annee-select-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}

.edt-annee-select-wrap label {
  font-size: 13px;
  font-weight: 600;
  color: #000000;
}

.edt-annee-select-wrap select {
  padding: 6px 10px;
  border: 1px solid #DDE5E4;
  border-radius: 8px;
  font-family: var(--font-corps);
  font-size: 14px;
}

.appel-empty-state a {
  color: var(--principale);
  font-weight: 600;
}

/* ---------- Vue liste ---------- */

.edt-liste-controls {
  margin-left: auto;
}

.edt-add-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: #F0774F;
  color: #FFFFFF;
  font-family: var(--font-corps);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}

.edt-add-btn:hover {
  background: #C27669;
}

.edt-add-btn .ph {
  font-size: 17px;
}

.edt-liste {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 720px;
  min-width: 70%;
  margin: 0 auto;
}

.edt-liste-empty {
  color: var(--secondaire);
  font-family: var(--font-corps);
  font-size: 15px;
  padding: 20px 0;
}

.edt-carte {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #FAFDFC;
  border: 1px solid #E5EFEE;
  border-radius: 10px;
  padding: 4px 4px 4px 18px;
}

.edt-carte:hover {
  border-color: #C9DEDC;
}

.edt-carte-lien {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 0;
  text-decoration: none;
  min-width: 0;
}

.edt-carte-titre {
  font-family: var(--font-titre);
  font-weight: 600;
  font-size: 17px;
  color: rgb(0, 15, 68);
}

.edt-carte-periode {
  font-family: var(--font-corps);
  font-size: 13px;
  color: var(--secondaire);
  opacity: 0.85;
}

.edt-carte-menu {
  position: relative;
  flex-shrink: 0;
}

.edt-carte-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: var(--secondaire);
  cursor: pointer;
}

.edt-carte-menu-btn:hover {
  background: #F0F7F6;
}

.edt-carte-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 20;
  margin-top: 4px;
  min-width: 170px;
  background: #FFFFFF;
  border: 1px solid #DDE5E4;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 40, 39, 0.16);
  overflow: hidden;
}

.edt-carte-dropdown.edt-carte-dropdown-open {
  display: block;
}

.edt-carte-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-corps);
  font-size: 14px;
  color: var(--texte);
}

.edt-carte-option:hover {
  background: #F0F7F6;
}

.edt-carte-option .ph {
  font-size: 15px;
}

.edt-carte-option-danger {
  color: var(--alerte);
}

.edt-carte-option-danger.confirm-delete {
  background: var(--alerte);
  color: #FFFFFF;
}

/* ---------- Vue grille : en-tête ---------- */

.edt-grille-header {
  gap: 6px;
}

.edt-grille-titre-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.edt-titre-inline {
  font-family: var(--font-titre);
  font-weight: 900;
  font-size: 32px;
  color: rgb(0, 15, 68);
  margin: 0;
  border: none;
  background: transparent;
  text-align: center;
}

input.edt-titre-inline {
  border-bottom: 2px solid var(--principale);
  outline: none;
  min-width: 200px;
}

.edt-titre-edit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: var(--secondaire);
  cursor: pointer;
}

.edt-titre-edit-btn:hover {
  background: #F0F7F6;
}

#edt-undo-btn:disabled,
#edt-redo-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* ---------- Vue grille : axe horaire + colonnes ---------- */

.edt-grid-wrapper {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
  background: #FFFFFF;
}

.edt-grid {
  position: relative;
  display: grid;
  flex: 1;
  min-height: 600px;
  background: #FFFFFF;
}

.edt-grid-header-row {
  display: grid;
  position: sticky;
  top: 0;
  background: #FFFFFF;
  z-index: 6;
}

.edt-grid-header-spacer {
  flex-shrink: 0;
}

.edt-jour-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 15px 4px;
  text-align: center;
}

.edt-jour-header-titre {
  font-family: var(--font-corps);
  font-weight: 400;
  font-size: 24px;
  color: rgb(0, 15, 68);
}

.edt-jour-header-soustitre {
  font-family: var(--font-corps);
  font-weight: 400;
  font-size: 14px;
  color: var(--secondaire);
  opacity: 0.75;
}

.edt-grid-body {
  position: relative;
  display: grid;
  flex: 1;
  padding-top: 8px;
}

.edt-heure-axe {
  position: relative;
  width: 56px;
  flex-shrink: 0;
}

.edt-heure-label {
  position: absolute;
  right: 8px;
  transform: translateY(-50%);
  font-family: var(--font-corps);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  font-weight: 900;
  color: rgb(0, 15, 68);
  opacity: 0.75;
  white-space: nowrap;
}


.edt-jour-colonne {
  position: relative;
  border-left: 1px solid #EDF3F2;
  background-image: repeating-linear-gradient(
    to bottom,
    #F3F7F6 0,
    #F3F7F6 1px,
    transparent 1px,
    transparent var(--edt-graduation-px, 20px)
  );
}

.edt-jour-colonne.edt-jour-colonne-heure-pleine {
  /* réservé pour un futur renfort visuel des heures pleines si besoin */
}

.edt-jour-colonne.is-drop-target {
  background-color: #F0F7F6;
}

.edt-cellule-vide-cliquable {
  position: absolute;
  left: 0;
  right: 0;
  cursor: pointer;
}

/* ---------- Blocs créneau ---------- */

.edt-creneau {
  position: absolute;
  border-radius: 8px;
  overflow: hidden;
  cursor: grab;
  display: flex;
  flex-direction: column;
  border: 2px solid #FFFFFF;
  box-sizing: border-box;
}

.edt-creneau.is-dragging {
  opacity: 0.4;
}

.edt-creneau-bandeau {
  flex: 1;
  padding: 4px 8px;
  font-family: var(--font-corps);
  overflow: hidden;
}

.edt-creneau-titre {
  display: block;
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.edt-creneau-heure {
  display: block;
  font-size: 11px;
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
}

.edt-creneau-exclu-badge {
  position: absolute;
  top: 3px;
  right: 3px;
  font-size: 10px;
  opacity: 0.7;
}

.edt-creneau-resize-handle {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 6px;
  cursor: ns-resize;
}

.edt-creneau-resize-handle::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 2px;
  transform: translateX(-50%);
  width: 24px;
  height: 2px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.25);
}

.edt-creneau-pause {
  background: #FFFFFF !important;
  opacity: 0.9;
  border-color: #DDE5E4;
}

/* ---------- Popover clic-bloc (éditer / dupliquer / supprimer) ---------- */

.edt-popover {
  position: fixed;
  z-index: 200;
  min-width: 200px;
  background: #FFFFFF;
  border: 1px solid #DDE5E4;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 40, 39, 0.18);
  overflow: hidden;
}

.edt-popover-header {
  padding: 10px 12px;
  border-bottom: 1px solid #EDF3F2;
  font-family: var(--font-corps);
  font-weight: 700;
  font-size: 14px;
  color: var(--texte);
}

.edt-popover-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-corps);
  font-size: 14px;
  color: var(--texte);
}

.edt-popover-option:hover {
  background: #F0F7F6;
}

.edt-popover-option .ph {
  font-size: 15px;
}

.edt-popover-option-danger {
  color: var(--alerte);
}

.edt-popover-option-danger.confirm-delete {
  background: var(--alerte);
  color: #FFFFFF;
}

.edt-popover-duplicate-jours {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 12px 12px;
}

.edt-popover-jour-btn {
  padding: 4px 8px;
  border: 1px solid #DDE5E4;
  border-radius: 6px;
  background: #FFFFFF;
  font-family: var(--font-corps);
  font-size: 12px;
  font-weight: 600;
  color: #000000;
  cursor: pointer;
}

.edt-popover-jour-btn:hover {
  background: #F0F7F6;
}

/* ---------- Modal : "Ajouter" une grille ---------- */

.edt-modal-mode-select {
  margin-top: 6px;
  width: 100%;
}

.edt-mode-radio-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.edt-mode-radio-row[hidden] {
  display: none;
}

.edt-modal-actions-right {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* ---------- Modal : préférences de la grille ---------- */

.edt-preferences-jours-label {
  display: block;
  margin-top: 16px;
}

.edt-preferences-jours {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.edt-preferences-jour-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #DDE5E4;
  background: #FFFFFF;
  font-family: var(--font-corps);
  font-size: 14px;
  font-weight: 600;
  color: var(--secondaire);
  cursor: pointer;
}

.edt-preferences-jour-toggle input {
  accent-color: var(--principale);
}

/* ---------- Modal : créneau (création/édition) ---------- */

.edt-creneau-modal {
  width: 640px;
  max-width: 90vw;
  background: #FFFFFF;
}

.edt-creneau-modal-titre-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.edt-creneau-modal-titre {
  flex: 1;
}

.edt-creneau-modal-badge {
  flex-shrink: 0;
  padding: 8px 12px;
  border-radius: 6px;
  font-family: var(--font-corps);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.edt-creneau-modal-body {
  display: flex;
  gap: 24px;
  margin-top: 16px;
}

.edt-creneau-modal-main {
  flex: 1;
  min-width: 0;
}

.edt-creneau-modal-duree {
  margin: 6px 0 0;
  font-family: var(--font-corps);
  font-size: 13px;
  color: var(--secondaire);
  opacity: 0.85;
}

.edt-creneau-modal-options {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.edt-creneau-modal-options-titre {
  margin: 0;
  font-family: var(--font-corps);
  font-size: 13px;
  font-weight: 600;
  color: #000000;
}

.edt-creneau-modal-type {
  width: 180px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.edt-creneau-modal-type-titre {
  margin: 0;
  font-family: var(--font-corps);
  font-size: 13px;
  font-weight: 600;
  color: #000000;
}

.edt-creneau-modal-radio {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-corps);
  font-size: 14px;
  color: var(--texte);
  cursor: pointer;
}

.edt-creneau-modal-radio input {
  accent-color: var(--principale);
}

.edt-creneau-modal-footer {
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.edt-creneau-modal-footer-right {
  display: flex;
  gap: 10px;
}

.edt-creneau-modal-footer-right button {
  width: auto;
}

.edt-creneau-modal-delete-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--alerte);
  cursor: pointer;
}

.edt-creneau-modal-delete-icon:hover {
  background: #FBEAE4;
  border-radius: 8px;
}

.edt-creneau-modal-delete-icon.confirm-delete {
  background: var(--alerte);
  color: #FFFFFF;
  border-radius: 8px;
  width: auto;
  padding: 0 12px;
}

.edt-checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-corps);
  font-size: 14px;
  color: var(--texte);
}

.edt-checkbox-row input {
  accent-color: var(--principale);
}

/* ---------- Répartition horaire (créneau de type Rituel) ---------- */

#creneau-repartition-badges {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

#creneau-repartition-badges::after {
  content: none;
}

.edt-repartition-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.edt-repartition-minutes {
  width: 56px;
  padding: 4px 6px;
  border: 1px solid #DDE5E4;
  border-radius: 6px;
  font-family: var(--font-corps);
  font-size: 13px;
  text-align: right;
}

.edt-repartition-total {
  margin: 8px 0 0;
  font-family: var(--font-corps);
  font-size: 13px;
  color: var(--secondaire);
}

.edt-repartition-total-erreur {
  color: var(--alerte);
  font-weight: 600;
}

.referentiel-popover-flottant {
  position: fixed;
  top: auto;
  left: auto;
  margin-top: 0;
  z-index: 200;
}

/* ---------- Panneau latéral générique (Répartition horaire, Préférences) ---------- */

.edt-panneau-champ {
  margin-bottom: 28px;
}

.edt-panneau-champ label {
  font-weight: 600;
}

.edt-panneau-lateral {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 500px;
  max-width: 90vw;
  background: #FFFFFF;
  box-shadow: -8px 0 24px rgba(15, 40, 39, 0.16);
  z-index: 150;
  display: flex;
  flex-direction: column;
  padding: 24px;
  box-sizing: border-box;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.2s ease;
}

.edt-panneau-lateral.is-open {
  transform: translateX(0);
}

.edt-panneau-lateral-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.edt-panneau-lateral-header h3 {
  margin: 0;
  font-family: var(--font-titre);
  font-weight: 700;
  font-size: 25px;
  color: rgb(0, 15, 68);
}

.edt-panneau-lateral-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: var(--secondaire);
  cursor: pointer;
}

.edt-panneau-lateral-close:hover {
  background: #F0F7F6;
}

.edt-panneau-lateral-actions {
  margin-top: 20px;
}

.edt-panneau-lateral-actions button {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: var(--principale);
  color: #FFFFFF;
  font-family: var(--font-corps);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}

.edt-panneau-lateral-actions button:hover {
  background: var(--secondaire);
}

.edt-repartition-panel-liste {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.edt-repartition-panel-ligne {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.edt-repartition-panel-badge {
  flex: 1;
  padding: 6px 10px;
  border-radius: 6px;
  font-family: var(--font-corps);
  font-weight: 600;
  font-size: 17px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edt-repartition-panel-duree {
  flex-shrink: 0;
  font-family: var(--font-corps);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  color: var(--secondaire);
}

.edt-repartition-panel-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding: 12px 4px 0;
  border-top: 2px solid #DDE5E4;
  font-family: var(--font-corps);
  font-weight: 700;
  font-size: 15px;
  color: var(--principale);
}

.edt-repartition-panel-vide {
  color: var(--secondaire);
  font-family: var(--font-corps);
  font-size: 14px;
  padding: 12px 4px;
}

@media print {
  @page {
    size: landscape;
  }

  .app-sidebar,
  .nav-controls {
    display: none !important;
  }
}
