/* ============================================
   AGENDA - MISE EN PAGE COMPLÈTE
   ============================================ */

/* Conteneur principal */
#main-content:has(.agenda-container) {
  padding: 1rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Sur mobile, autoriser le scroll dans le conteneur principal */
@media (max-width: 768px) {
  #main-content:has(.agenda-container) {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }
}

.agenda-container {
  display: flex;
  flex-direction: row;
  flex: 1;
  min-height: 0;
  width: 100%;
  background: var(--color-white);
  border-radius: var(--radius);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  animation: fadeIn 0.3s ease-in-out;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Sur mobile, autoriser le scroll dans le conteneur */
@media (max-width: 768px) {
  .agenda-container {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   SIDEBAR GAUCHE
   ============================================ */
.agenda-sidebar {
  width: 300px;
  min-width: 300px;
  background: linear-gradient(to bottom, var(--color-white), var(--color-gray-50));
  border-right: 1px solid var(--color-gray-200);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--color-gray-300) var(--color-gray-50);
}

.agenda-sidebar::-webkit-scrollbar {
  width: 6px;
}

.agenda-sidebar::-webkit-scrollbar-track {
  background: var(--color-gray-50);
}

.agenda-sidebar::-webkit-scrollbar-thumb {
  background: var(--color-gray-300);
  border-radius: 3px;
}

.agenda-sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--color-gray-400);
}

/* Calendrier */
.calendar-widget {
  padding: 1.5rem;
  background: var(--color-white);
  border-bottom: 1px solid var(--color-gray-200);
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.calendar-nav-btn {
  background: none;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  color: var(--color-text);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.calendar-nav-btn:hover {
  background: var(--color-gray-100);
  transform: scale(1.1);
  color: var(--color-primary);
}

.calendar-nav-btn:active {
  transform: scale(0.95);
}

.calendar-nav-btn i {
  width: 1rem;
  height: 1rem;
}

.calendar-month-year {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  margin: 0;
  text-align: center;
  flex: 1;
}

#calendar-grid {
  width: 100%;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.25rem;
  margin-bottom: 0.5rem;
}

.calendar-weekday {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-light);
  padding: 0.5rem 0;
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.25rem;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  color: var(--color-text);
  cursor: pointer;
  border-radius: var(--radius);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  font-weight: 500;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.calendar-day::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: var(--color-primary);
  opacity: 0;
  transition: opacity 0.2s;
}

.calendar-day:hover {
  background: var(--color-gray-100);
  transform: scale(1.05);
}

.calendar-day:hover::before {
  opacity: 0.1;
}

.calendar-day.other-month {
  color: var(--color-text-light);
  opacity: 0.4;
}

.calendar-day.today {
  font-weight: 700;
  color: var(--color-primary);
  position: relative;
}

.calendar-day.today::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: var(--color-primary);
  border-radius: 50%;
}

.calendar-day.selected {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover, var(--color-primary)));
  color: white;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  transform: scale(1.05);
}

.calendar-day.selected::before {
  display: none;
}

.calendar-day.selected::after {
  display: none;
}

.btn-today {
  width: 100%;
  margin-top: 1rem;
  padding: 0.75rem;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover, var(--color-primary)));
  color: white;
  border: none;
  border-radius: var(--radius);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-today:hover {
  background: linear-gradient(135deg, var(--color-primary-hover, var(--color-primary)), var(--color-primary));
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-today:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Sélection caissiers */
.cashiers-selection {
  padding: 1rem;
  background: var(--color-white);
  border-bottom: 1px solid var(--color-gray-200);
}

.cashiers-selection-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 0.75rem 0;
}

.cashiers-selection-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cashier-selection-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: calc(var(--radius) / 2);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.cashier-selection-item:hover {
  background: var(--color-gray-50);
  border-color: var(--color-gray-200);
  transform: translateX(4px);
}

.cashier-selection-item:has(input:checked) {
  background: var(--color-primary-light, rgba(59, 130, 246, 0.1));
  border-color: var(--color-primary);
}

.cashier-selection-checkbox {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
  accent-color: var(--color-primary);
  flex-shrink: 0;
}

.cashier-selection-name {
  font-size: 0.875rem;
  color: var(--color-text);
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  flex: 1;
}

.cashier-selection-avatar {
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
}

.cashier-selection-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.cashier-selection-avatar i {
  width: 1rem;
  height: 1rem;
  color: var(--color-primary);
}


/* ============================================
   ZONE PRINCIPALE
   ============================================ */
.agenda-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
  width: 100%;
  box-sizing: border-box;
}

/* Sur mobile, autoriser le scroll dans la zone principale */
@media (max-width: 768px) {
  .agenda-main {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
  }
}

/* En-tête */
.agenda-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--color-gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-shrink: 0;
  background: var(--color-white);
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.agenda-header-left {
  flex: 1;
  min-width: 0;
}

.agenda-date-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-text);
  margin: 0;
}

.agenda-header-center {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.view-mode-buttons {
  display: flex;
  gap: 0.5rem;
  background: var(--color-gray-100);
  padding: 0.25rem;
  border-radius: var(--radius);
}

.view-mode-btn {
  padding: 0.5rem 1rem;
  background: transparent;
  border: none;
  border-radius: calc(var(--radius) - 0.125rem);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.view-mode-btn:hover {
  color: var(--color-primary);
}

.view-mode-btn.active {
  background: var(--color-white);
  color: var(--color-primary);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  font-weight: 600;
}

.agenda-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.agenda-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.action-btn {
  padding: 0.5rem;
  background: var(--color-white);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--color-text);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 2.5rem;
  height: 2.5rem;
}

.action-btn:hover {
  background: var(--color-gray-50);
  border-color: var(--color-primary);
  transform: scale(1.05);
  color: var(--color-primary);
}

.action-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

.action-btn.active:hover {
  background: var(--color-primary-hover, var(--color-primary));
}

.action-btn i {
  width: 1.25rem;
  height: 1.25rem;
}

.agenda-navigation {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.nav-btn {
  padding: 0.5rem;
  background: var(--color-white);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--color-text);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.nav-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--color-primary);
  opacity: 0;
  transition: opacity 0.2s;
}

.nav-btn:hover {
  background: var(--color-gray-50);
  border-color: var(--color-primary);
  transform: scale(1.05);
  color: var(--color-primary);
}

.nav-btn:hover::before {
  opacity: 0.05;
}

.nav-btn:active {
  transform: scale(0.95);
}

.nav-btn i {
  width: 1rem;
  height: 1rem;
}

/* ============================================
   SCHEDULE UNIFIÉ (HEADER + GRILLE)
   ============================================ */
.schedule-wrapper {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  background: var(--color-white);
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 0;
  max-height: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

/* Sur mobile, améliorer le scroll */
@media (max-width: 768px) {
  .schedule-wrapper {
    -webkit-overflow-scrolling: touch;
  }
  
  .schedule-unified {
    min-height: min-content;
  }
}

.schedule-unified {
  display: grid;
  grid-template-columns: 1fr repeat(var(--cashier-count-day, 1), 3fr);
  grid-template-rows: auto 1fr;
  position: relative;
  width: 100%;
  min-width: 100%;
  box-sizing: border-box;
}

/* Vue semaine */
.schedule-unified:has(.week-day-header-container) {
  grid-template-columns: 1fr repeat(7, 3fr);
  grid-template-rows: auto 1fr;
}

/* Header */
.time-column-header {
  grid-column: 1;
  grid-row: 1;
  padding: 0.5rem;
  border-right: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  width: auto;
  min-width: 0;
  max-width: none;
  flex-shrink: 0;
  box-sizing: border-box;
  background: var(--color-white);
  position: sticky;
  top: 0;
  z-index: 10;
}

.cashier-column-header {
  grid-row: 1;
  padding: 0.5rem;
  border-right: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  min-width: 0;
  box-sizing: border-box;
  width: 100%;
  background: var(--color-white);
  position: sticky;
  top: 0;
  z-index: 10;
}

.cashier-column-header:not(.week-day-header) {
  align-items: center;
}

.week-day-header-container {
  display: grid;
  grid-template-columns: repeat(var(--cashier-count, 1), 1fr);
  grid-template-rows: auto 1fr;
  border-right: 2px solid #cbd5e1; /* Barre fine gris clair entre chaque jour */
  min-width: 0;
  box-sizing: border-box;
  width: 100%;
  position: relative;
}

/* Dernier jour sans bordure droite */
.week-day-header-container:last-child {
  border-right: none;
}

/* Date au-dessus de chaque groupe de caissiers */
.week-day-date-header {
  grid-column: 1 / -1;
  grid-row: 1;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.125rem;
  background: inherit;
  position: sticky;
  top: 0;
  z-index: 11;
  box-sizing: border-box;
}

.week-day-date-header .week-day-name {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text);
  text-transform: none;
  line-height: 1.2;
}

.week-day-date-header .week-day-date {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text);
  line-height: 1.2;
}

/* Même couleur pour tous les jours */
.week-day-header-container {
  background: var(--color-white);
}

.week-day-header-container .week-day-date-header {
  background: var(--color-white);
}

.week-day-header {
  grid-row: 2;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.week-day-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text);
  text-transform: uppercase;
  line-height: 1.2;
}

.cashier-name {
  font-weight: 500;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  font-size: 0.85rem;
  line-height: 1.2;
  text-align: center;
}

.cashier-indicator {
  display: none; /* Masqué dans le layout horizontal */
}

.cashier-header-avatar {
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-white);
  border-radius: 0.375rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.cashier-header-avatar i {
  width: 1.5rem;
  height: 1.5rem;
  color: var(--color-primary);
}

.cashier-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.cashier-column-header {
  flex-direction: row;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  min-height: 3.5rem;
}

.cashier-column-header:not(.week-day-header) {
  flex-direction: row;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.5rem;
}

.week-day-header {
  flex-direction: row;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.35rem;
  padding: 0.35rem;
  min-height: 2rem;
}

/* En vue semaine, masquer le nom du caissier - afficher seulement la photo */
.week-day-header .cashier-name {
  display: none;
}

/* Grille */
.time-column {
  grid-column: 1;
  grid-row: 2;
  width: auto;
  min-width: 0;
  max-width: none;
  border-right: 1px solid var(--color-gray-200);
  background: var(--color-white);
  position: sticky;
  left: 0;
  z-index: 5;
  box-sizing: border-box;
  flex-shrink: 0;
}

.time-slot {
  min-height: 20px;
  height: 20px;
  padding: 0.125rem 0.25rem;
  border-bottom: 1px solid var(--color-gray-100);
  display: flex;
  align-items: center;
  gap: 0.125rem;
  font-size: 0.7rem;
  color: var(--color-text);
  box-sizing: border-box;
  overflow: hidden;
}

.time-slot.hour-marker {
  font-weight: 600;
  border-bottom: 1px solid var(--color-gray-200);
}

.time-hour {
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1;
}

.time-minutes {
  font-size: 0.65rem;
  color: var(--color-text-light);
  line-height: 1;
}

/* ============================================
   CRÉNEAUX HORAIRES COMPACTS (colonne de gauche)
   ============================================ */

/* Mode compact (hauteur <= 25px) */
.time-slot.time-slot-compact .time-hour {
  font-size: 0.7rem;
}

.time-slot.time-slot-compact .time-minutes {
  font-size: 0.55rem;
}

/* Mode très compact (hauteur <= 20px) */
.time-slot.time-slot-very-compact {
  padding: 0 0.125rem;
}

.time-slot.time-slot-very-compact .time-hour {
  font-size: 0.6rem;
}

.time-slot.time-slot-very-compact .time-minutes {
  font-size: 0.5rem;
}

/* Mode ultra-compact (hauteur <= 15px) */
.time-slot.time-slot-ultra-compact {
  padding: 0 0.0625rem;
}

.time-slot.time-slot-ultra-compact .time-hour {
  font-size: 0.5rem;
}

.time-slot.time-slot-ultra-compact .time-minutes {
  display: none;
}

.cashier-column {
  grid-row: 2;
  border-right: 1px solid var(--color-gray-200);
  background: var(--color-gray-50);
  position: relative;
  min-width: 0;
  box-sizing: border-box;
  width: 100%;
}

/* Dans la vue semaine, les colonnes de caissiers héritent du background du jour */
.week-day-container .cashier-column {
  background: inherit;
}

/* Ne pas appliquer de background à toute la colonne - seulement aux cellules individuelles */
/* Les cellules avec disabled.closed-hours seront grisées individuellement */

.week-day-container {
  display: grid;
  grid-template-columns: repeat(var(--cashier-count, 1), 1fr);
  border-right: 2px solid #cbd5e1; /* Barre fine gris clair entre chaque jour */
  min-width: 0;
  box-sizing: border-box;
  width: 100%;
  position: relative;
}

/* Dernier jour sans bordure droite */
.week-day-container:last-child {
  border-right: none;
}

/* Même couleur pour tous les jours dans la grille */
.week-day-container {
  background: var(--color-white);
}

.time-slot-cell {
  min-height: 20px;
  height: 20px;
  border-bottom: 1px solid var(--color-gray-100);
  position: relative;
  box-sizing: border-box;
  background: var(--color-white);
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: pan-y;
}

/* Créneaux ouverts/réservables - TOUJOURS blanc */
.time-slot-cell.open-hours {
  background: var(--color-white) !important;
}

/* Créneaux fermés/non réservables - GRIS UNIFIÉ #f0f0f2 pour jours de fermeture, congés, horaires hors ouverture */
.time-slot-cell.closed-hours {
  background: #f0f0f2 !important;
}

.time-slot-cell.disabled.closed-hours {
  background: #f0f0f2 !important;
}

/* Vue jour - mêmes couleurs */
.cashier-column .time-slot-cell.closed-hours {
  background: #f0f0f2 !important;
}

.cashier-column .time-slot-cell.disabled.closed-hours {
  background: #f0f0f2 !important;
}

/* Vue semaine - mêmes couleurs */
.week-day-container .time-slot-cell.closed-hours {
  background: #f0f0f2 !important;
}

.week-day-container .time-slot-cell.disabled.closed-hours {
  background: #f0f0f2 !important;
}

/* États hover et active - cohérents avec les couleurs de base */
.time-slot-cell.closed-hours:hover {
  background: #e0e0e2 !important;
}

.time-slot-cell.open-hours:hover {
  background: var(--color-gray-100) !important;
  transition: background 0.15s ease;
  cursor: pointer;
}

.time-slot-cell.open-hours:active {
  background: var(--color-gray-100) !important;
}

.time-slot-cell.open-hours {
  cursor: pointer;
}

.time-slot-cell.closed-hours:active {
  background: #e0e0e2 !important;
}

/* Créneaux désactivés (jours de congé, fermeture) - GRIS UNIFIÉ #f0f0f2 */
.time-slot-cell.disabled {
  opacity: 1;
  pointer-events: none;
  background: #f0f0f2 !important;
}

.time-slot-cell.disabled.closed-hours {
  background: #f0f0f2 !important;
}

/* ============================================
   BLOCS RENDEZ-VOUS
   ============================================ */
.appointment-block {
  position: absolute;
  left: 0.25rem;
  right: 0.25rem;
  background: var(--color-primary);
  color: white;
  border-radius: var(--radius);
  padding: 0;
  cursor: move;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  z-index: 20;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border-left: 3px solid rgba(255, 255, 255, 0.5);
  min-width: 0; /* Permet aux rendez-vous de se rétrécir quand ils sont côte à côte */
}

.appointment-block:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
  border-left-width: 4px;
}

.appointment-block:active {
  cursor: grabbing;
  transform: scale(0.98);
}

.appointment-content {
  padding: 0.5rem;
  flex: 0 0 auto;
  min-height: 0;
  overflow: hidden;
  margin-top: 4px;
  margin-bottom: 4px;
  z-index: 1;
  display: flex;
  flex-direction: column;
}

.appointment-resize-handle {
  position: absolute;
  left: 0;
  right: 0;
  height: 8px;
  cursor: ns-resize;
  z-index: 12;
  background: transparent;
  pointer-events: auto;
}

.appointment-resize-handle:hover {
  background: rgba(255, 255, 255, 0.5);
  border-top: 2px solid rgba(255, 255, 255, 0.8);
  border-bottom: 2px solid rgba(255, 255, 255, 0.8);
}

.appointment-resize-top {
  top: 0;
}

.appointment-resize-bottom {
  bottom: 0;
}

.appointment-name {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.125rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.appointment-service-type {
  font-size: 0.7rem;
  opacity: 0.75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.125rem;
}

.appointment-time {
  font-size: 0.7rem;
  opacity: 0.75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================
   MODE COMPACT POUR PETITS CRÉNEAUX
   Affichage horizontal quand la hauteur est petite
   ============================================ */

/* Utiliser container queries pour adapter l'affichage */
.appointment-block {
  container-type: size;
  container-name: appointment;
}

/* Mode compact : quand la hauteur est <= 60px */
@container appointment (max-height: 60px) {
  .appointment-content {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem !important;
    margin: 0 !important;
    overflow: hidden;
  }
  
  .appointment-name {
    flex: 0 0 auto;
    margin-bottom: 0 !important;
    font-size: 0.8rem;
    line-height: 1.2;
  }
  
  .appointment-service-type {
    flex: 1 1 auto;
    min-width: 0;
    margin-bottom: 0 !important;
    font-size: 0.65rem;
    opacity: 0.85;
    text-align: center;
  }
  
  .appointment-time {
    flex: 0 0 auto;
    font-size: 0.7rem;
    margin-left: auto;
  }
}

/* Mode très compact : quand la hauteur est <= 45px */
@container appointment (max-height: 45px) {
  .appointment-content {
    padding: 0.125rem 0.375rem !important;
    gap: 0.375rem;
  }
  
  .appointment-name {
    font-size: 0.7rem;
  }
  
  .appointment-service-type {
    font-size: 0.55rem;
    opacity: 0.8;
  }
  
  .appointment-time {
    font-size: 0.6rem;
    opacity: 0.9;
  }
}

/* Mode ultra-compact : quand la hauteur est <= 30px */
@container appointment (max-height: 30px) {
  .appointment-content {
    padding: 0 0.25rem !important;
    gap: 0.25rem;
  }
  
  .appointment-name {
    font-size: 0.65rem;
    font-weight: 600;
    line-height: 1.1;
  }
  
  .appointment-service-type {
    font-size: 0.5rem;
    opacity: 0.75;
  }
  
  .appointment-time {
    font-size: 0.55rem;
  }
  
  .appointment-resize-handle {
    height: 3px;
  }
}

/* ============================================
   CONTAINER QUERIES POUR LA LARGEUR
   Forcer le layout vertical quand la colonne est étroite
   ============================================ */

/* Narrow : largeur <= 120px - layout vertical */
@container appointment (max-width: 120px) {
  .appointment-content {
    flex: 0 0 auto !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    gap: 0 !important;
    text-align: left;
  }
  
  .appointment-name {
    font-size: 0.7rem;
    line-height: 1.15;
    margin-bottom: 0 !important;
  }
  
  .appointment-service-type {
    font-size: 0.55rem;
    text-align: left;
    margin-bottom: 0 !important;
  }
  
  .appointment-time {
    font-size: 0.55rem;
    margin-left: 0 !important;
    margin-bottom: 0 !important;
  }
}

/* Very narrow : largeur <= 90px */
@container appointment (max-width: 90px) {
  .appointment-content {
    padding: 0.125rem 0.25rem !important;
    gap: 0 !important;
  }
  
  .appointment-name {
    font-size: 0.6rem;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  
  .appointment-service-type {
    font-size: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  
  .appointment-time {
    font-size: 0.5rem;
  }
}

/* Ultra narrow : largeur <= 60px - masquer le type de service */
@container appointment (max-width: 60px) {
  .appointment-content {
    padding: 0 0.125rem !important;
  }
  
  .appointment-name {
    font-size: 0.55rem;
    line-height: 1.05;
  }
  
  .appointment-service-type {
    display: none !important;
  }
  
  .appointment-time {
    font-size: 0.45rem;
  }
}

/* ============================================
   FALLBACK POUR NAVIGATEURS SANS CONTAINER QUERIES
   Classes appliquées via JavaScript
   ============================================ */

/* Mode compact (hauteur <= 60px) */
.appointment-block.compact .appointment-content {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem !important;
  margin: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  overflow: hidden;
  flex: 1;
}

.appointment-block.compact .appointment-name {
  flex: 0 0 auto;
  margin-bottom: 0;
  font-size: 0.8rem;
  line-height: 1.2;
}

.appointment-block.compact .appointment-service-type {
  flex: 1 1 auto;
  min-width: 0;
  margin-bottom: 0;
  font-size: 0.65rem;
  opacity: 0.85;
  text-align: center;
}

.appointment-block.compact .appointment-time {
  flex: 0 0 auto;
  font-size: 0.7rem;
  margin-left: auto;
  margin-bottom: 0;
}

/* Mode très compact (hauteur <= 45px) */
.appointment-block.very-compact .appointment-content {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start;
  gap: 0.375rem;
  padding: 0.125rem 0.375rem !important;
  margin: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  overflow: hidden;
  flex: 1;
}

.appointment-block.very-compact .appointment-name {
  flex: 0 0 auto;
  margin-bottom: 0;
  font-size: 0.7rem;
  line-height: 1.2;
}

.appointment-block.very-compact .appointment-service-type {
  flex: 1 1 auto;
  min-width: 0;
  margin-bottom: 0;
  font-size: 0.55rem;
  opacity: 0.8;
  text-align: center;
}

.appointment-block.very-compact .appointment-time {
  flex: 0 0 auto;
  font-size: 0.6rem;
  opacity: 0.9;
  margin-left: auto;
  margin-bottom: 0;
}

/* Mode ultra-compact (hauteur <= 30px) */
.appointment-block.ultra-compact .appointment-content {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start;
  gap: 0.25rem;
  padding: 0 0.25rem !important;
  margin: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  overflow: hidden;
  flex: 1;
}

.appointment-block.ultra-compact .appointment-name {
  flex: 0 0 auto;
  margin-bottom: 0;
  font-size: 0.65rem;
  font-weight: 600;
  line-height: 1.1;
}

.appointment-block.ultra-compact .appointment-service-type {
  flex: 1 1 auto;
  min-width: 0;
  margin-bottom: 0;
  font-size: 0.5rem;
  opacity: 0.75;
  text-align: center;
}

.appointment-block.ultra-compact .appointment-time {
  flex: 0 0 auto;
  font-size: 0.55rem;
  margin-left: auto;
  margin-bottom: 0;
}

.appointment-block.ultra-compact .appointment-resize-handle {
  height: 3px;
}

/* ============================================
   CLASSES DE LARGEUR - Layout vertical pour colonnes étroites
   ============================================ */

/* Quand le bloc est étroit, forcer le layout vertical même si compact en hauteur */
.appointment-block.narrow .appointment-content,
.appointment-block.very-narrow .appointment-content,
.appointment-block.ultra-narrow .appointment-content {
  flex: 0 0 auto !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  text-align: left;
  gap: 0 !important;
}

/* Narrow (largeur <= 120px) */
.appointment-block.narrow .appointment-name {
  font-size: 0.7rem;
  line-height: 1.15;
  margin-bottom: 0;
}

.appointment-block.narrow .appointment-service-type {
  font-size: 0.55rem;
  text-align: left;
  margin-bottom: 0;
}

.appointment-block.narrow .appointment-time {
  font-size: 0.55rem;
  margin-left: 0;
  margin-bottom: 0;
}

/* Very narrow (largeur <= 90px) */
.appointment-block.very-narrow .appointment-name {
  font-size: 0.6rem;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.appointment-block.very-narrow .appointment-service-type {
  font-size: 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.appointment-block.very-narrow .appointment-time {
  font-size: 0.5rem;
}

/* Ultra narrow (largeur <= 60px) - masquer le type de service */
.appointment-block.ultra-narrow .appointment-content {
  padding: 0.125rem !important;
}

.appointment-block.ultra-narrow .appointment-name {
  font-size: 0.55rem;
  line-height: 1.05;
}

.appointment-block.ultra-narrow .appointment-service-type {
  display: none !important;
}

.appointment-block.ultra-narrow .appointment-time {
  font-size: 0.45rem;
}

/* Combinaisons compact + narrow : priorité au layout vertical */
.appointment-block.compact.narrow .appointment-content,
.appointment-block.compact.very-narrow .appointment-content,
.appointment-block.compact.ultra-narrow .appointment-content,
.appointment-block.very-compact.narrow .appointment-content,
.appointment-block.very-compact.very-narrow .appointment-content,
.appointment-block.very-compact.ultra-narrow .appointment-content,
.appointment-block.ultra-compact.narrow .appointment-content,
.appointment-block.ultra-compact.very-narrow .appointment-content,
.appointment-block.ultra-compact.ultra-narrow .appointment-content {
  flex: 0 0 auto !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  gap: 0 !important;
  padding: 0.125rem 0.25rem !important;
}

/* Ultra-compact + ultra-narrow : affichage minimal */
.appointment-block.ultra-compact.ultra-narrow .appointment-content {
  padding: 0 0.125rem !important;
}

.appointment-block.ultra-compact.ultra-narrow .appointment-name {
  font-size: 0.5rem;
}

.appointment-block.ultra-compact.ultra-narrow .appointment-time {
  font-size: 0.4rem;
}

/* Bloc d'heures de travail ajustable - complètement discret */
.working-hours-block {
  position: absolute;
  left: 0;
  right: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  cursor: ns-resize;
  box-shadow: none;
  z-index: 6;
  overflow: visible;
  display: flex;
  flex-direction: column;
  user-select: none;
  box-sizing: border-box;
  transition: none;
  pointer-events: none; /* Ne pas bloquer les clics sur les cellules */
  margin: 0;
  padding: 0;
}

.working-hours-block:hover {
  background: transparent;
  border: none;
  box-shadow: none;
}

.working-hours-content {
  padding: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1;
}

.working-hours-label {
  display: none;
}

.working-hours-time {
  display: none;
}

.working-hours-resize-handle {
  position: absolute;
  left: 0;
  right: 0;
  height: 12px;
  cursor: ns-resize;
  z-index: 12;
  background: rgba(59, 130, 246, 0.1);
  pointer-events: auto; /* Seuls les handles peuvent recevoir les clics */
  display: flex;
  align-items: center;
  justify-content: center;
}

.working-hours-resize-handle:hover {
  background: rgba(59, 130, 246, 0.2);
  border-top: 2px solid rgba(59, 130, 246, 0.6);
  border-bottom: 2px solid rgba(59, 130, 246, 0.6);
}

.working-hours-resize-handle::after {
  content: '⋮';
  color: rgba(59, 130, 246, 0.6);
  font-size: 0.75rem;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.2s;
}

.working-hours-resize-handle:hover::after {
  opacity: 1;
}

.working-hours-resize-top {
  top: 0;
}

.working-hours-resize-bottom {
  bottom: 0;
}

/* Ligne temps actuel */
.current-time-line {
  position: absolute;
  left: 60px;
  width: calc(100% - 60px);
  height: 2px;
  background: var(--color-danger);
  z-index: 100;
  pointer-events: none;
}

.current-time-label {
  position: absolute;
  left: 0;
  top: -12px;
  background: var(--color-danger);
  color: white;
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ============================================
   BOUTON TOGGLE HEURES FERMÉES
   ============================================ */
.toggle-closed-hours {
  flex-shrink: 0;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-closed-hours i {
  width: 1.25rem;
  height: 1.25rem;
  transition: transform 0.2s;
}

.toggle-closed-hours:not(.active) {
  opacity: 0.6;
}

.toggle-closed-hours:hover {
  opacity: 1;
}

.toggle-closed-hours.active {
  background: var(--color-primary-light, rgba(59, 130, 246, 0.1));
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* ============================================
   FOOTER
   ============================================ */
.agenda-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--color-gray-200);
  background: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-shrink: 0;
  z-index: 50;
  position: relative;
}

/* Masquer la sélection dans le footer sur desktop (par défaut) */
.cashiers-selection-footer {
  display: none;
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-gray-100);
  padding: 0.25rem;
  border-radius: var(--radius);
}

.zoom-btn {
  width: 2rem;
  height: 2rem;
  background: transparent;
  border: none;
  border-radius: calc(var(--radius) - 0.125rem);
  color: var(--color-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.zoom-btn:hover {
  background: var(--color-white);
  color: var(--color-primary);
  transform: scale(1.1);
}

.zoom-btn:active {
  transform: scale(0.95);
}

.zoom-btn i {
  width: 1rem;
  height: 1rem;
}

.zoom-level {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
  min-width: 3rem;
  text-align: center;
}

.btn-add-appointment {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover, var(--color-primary)));
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.btn-add-appointment::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}

.btn-add-appointment:hover {
  transform: scale(1.1) rotate(90deg);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  background: linear-gradient(135deg, var(--color-primary-hover, var(--color-primary)), var(--color-primary));
}

.btn-add-appointment:hover::before {
  opacity: 1;
}

.btn-add-appointment:active {
  transform: scale(1.05) rotate(90deg);
}

.btn-add-appointment i {
  width: 1.5rem;
  height: 1.5rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1400px) {
  #main-content:has(.agenda-container) {
    padding: 0.5rem;
  }

  .agenda-container {
    flex-direction: column;
    border-radius: calc(var(--radius) * 0.75);
  }
  
  /* Masquer complètement la sidebar sur tablette/mobile */
  .agenda-sidebar {
    display: none !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    overflow: hidden !important;
  }
  
  .calendar-widget {
    display: none !important;
  }
  
  /* Masquer la sélection dans la sidebar sur mobile/tablette */
  .agenda-sidebar .cashiers-selection {
    display: none !important;
  }
  
  /* Afficher la sélection dans le footer */
  .cashiers-selection-footer {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    flex: 0 0 auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding: 0 0.125rem;
    max-width: fit-content;
  }
  
  .cashiers-selection-footer .cashiers-selection-list {
    display: flex;
    flex-direction: row;
    gap: 0.375rem;
    align-items: center;
  }
  
  .cashiers-selection-footer .cashier-selection-item {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0;
    min-width: 40px;
    min-height: 40px;
    max-width: 40px;
    max-height: 40px;
    border-radius: 50%;
    position: relative;
    display: flex;
    background: var(--color-white) !important;
    border: 2px solid var(--color-gray-300) !important;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  }
  
  /* S'assurer que les items non sélectionnés restent blancs */
  .cashiers-selection-footer .cashier-selection-item:not(:has(input:checked)) {
    background: var(--color-white) !important;
    border-color: var(--color-gray-300) !important;
  }
  
  .cashiers-selection-footer .cashier-selection-item:hover {
    border-color: var(--color-primary);
    transform: scale(1.05);
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.2);
  }
  
  .cashiers-selection-footer .cashier-selection-name {
    display: none; /* Masquer les noms sur mobile/tablette */
  }
  
  .cashiers-selection-footer .cashier-selection-avatar {
    width: calc(100% - 0.5rem);
    height: calc(100% - 0.5rem);
    margin: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    border-radius: 50%;
    position: relative;
    background: var(--color-gray-100);
  }
  
  /* Avatar pour items non sélectionnés */
  .cashiers-selection-footer .cashier-selection-item:not(:has(input:checked)) .cashier-selection-avatar {
    background: var(--color-gray-100);
  }
  
  /* Avatar pour items sélectionnés */
  .cashiers-selection-footer .cashier-selection-item:has(input:checked) .cashier-selection-avatar {
    background: rgba(255, 255, 255, 0.2);
  }
  
  .cashiers-selection-footer .cashier-selection-avatar i {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    color: var(--color-primary);
  }
  
  .cashiers-selection-footer .cashier-selection-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: 50%;
    display: block;
  }
  
  .cashiers-selection-footer .cashier-selection-checkbox {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
    z-index: 10;
    top: 0;
    left: 0;
  }
  
  /* État checked avec icône de check visible */
  .cashiers-selection-footer .cashier-selection-item:has(input:checked) {
    background: var(--color-primary);
    border-color: var(--color-primary);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
  }
  
  .cashiers-selection-footer .cashier-selection-item:has(input:checked) .cashier-selection-avatar {
    opacity: 0.9;
    background: rgba(255, 255, 255, 0.2);
  }
  
  .cashiers-selection-footer .cashier-selection-item:has(input:checked) .cashier-selection-avatar i {
    color: white;
  }
  
  .cashiers-selection-footer .cashier-selection-item:has(input:checked) .cashier-selection-avatar img {
    opacity: 0.9;
  }
  
  /* Icône de check overlay - badge blanc avec check de couleur primaire */
  .cashiers-selection-footer .cashier-selection-item:has(input:checked)::after {
    content: '';
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 16px;
    height: 16px;
    background: white;
    border: 2px solid var(--color-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  }
  
  .cashiers-selection-footer .cashier-selection-item:has(input:checked)::before {
    content: '✓';
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 16px;
    height: 16px;
    color: var(--color-primary);
    font-size: 11px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 6;
    line-height: 1;
  }
  
  /* Ajuster le footer pour avoir les 3 sections */
  .agenda-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
  }
  
  .zoom-controls {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    height: 40px;
  }
  
  .btn-add-appointment {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
  }
  
  .cashiers-selection-footer {
    display: flex;
    align-items: center;
    height: 40px;
  }
  
  .agenda-header {
    padding: 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .agenda-date-title {
    font-size: 1.25rem;
  }

  .agenda-navigation {
    flex-wrap: wrap;
  }
  
  .schedule-unified {
    grid-template-columns: 1fr repeat(var(--cashier-count-day, 1), 3fr);
  }
  
  .schedule-unified:has(.week-day-header-container) {
    grid-template-columns: 1fr repeat(7, 3fr);
  }
  
  .time-column,
  .time-column-header {
    width: auto;
    min-width: 0;
    max-width: none;
  }
  
  .cashier-column-header {
    padding: 0.375rem;
  }
  
  .cashier-header-avatar {
    width: 2rem;
    height: 2rem;
  }
  
  .cashier-header-avatar i {
    width: 1.125rem;
    height: 1.125rem;
  }
  
  .cashier-name {
    font-size: 0.75rem;
  }
  
  .cashier-column-header {
    gap: 0.35rem;
    padding: 0.35rem;
    min-height: 2.75rem;
  }

  .time-slot {
    font-size: 0.65rem;
  }
  
  /* Amélioration lisibilité des rendez-vous sur tablette */
  .appointment-block {
    border-left-width: 4px;
  }
  
  .appointment-content {
    padding: 0.375rem;
  }
  
  .appointment-name {
    font-size: 0.8rem;
  }
  
  .appointment-service-type,
  .appointment-time {
    font-size: 0.65rem;
  }
  
  /* Forcer l'affichage horizontal sur les petits créneaux - fallback si container queries non supporté */
  .appointment-block[style*="height: 2"] .appointment-content,
  .appointment-block[style*="height: 3"] .appointment-content,
  .appointment-block[style*="height: 4"] .appointment-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.375rem;
    margin: 0;
  }
  
  .appointment-block[style*="height: 2"] .appointment-name,
  .appointment-block[style*="height: 3"] .appointment-name,
  .appointment-block[style*="height: 4"] .appointment-name {
    margin-bottom: 0;
    flex-shrink: 0;
  }
  
  .appointment-block[style*="height: 2"] .appointment-service-type,
  .appointment-block[style*="height: 3"] .appointment-service-type {
    display: none;
  }
  
  .appointment-block[style*="height: 2"] .appointment-time,
  .appointment-block[style*="height: 3"] .appointment-time,
  .appointment-block[style*="height: 4"] .appointment-time {
    margin-bottom: 0;
    margin-left: auto;
    flex-shrink: 0;
  }
}

/* ============================================
   TABLETTE / IPAD (768px - 1024px)
   Améliorations spécifiques pour iPad
   ============================================ */
@media (min-width: 768px) and (max-width: 1024px) {
  /* Grille plus flexible pour iPad */
  .schedule-unified {
    grid-template-columns: minmax(50px, 80px) repeat(var(--cashier-count-day, 1), minmax(100px, 1fr));
  }
  
  /* Créneaux plus hauts pour meilleure lisibilité */
  .time-slot,
  .time-slot-cell {
    min-height: 24px;
  }
  
  /* Rendez-vous plus lisibles */
  .appointment-block {
    border-left-width: 4px;
    min-height: 24px;
  }
  
  .appointment-content {
    padding: 0.375rem 0.5rem;
  }
  
  .appointment-name {
    font-size: 0.85rem;
    font-weight: 600;
  }
  
  .appointment-service-type {
    font-size: 0.7rem;
  }
  
  .appointment-time {
    font-size: 0.7rem;
    font-weight: 500;
  }
  
  /* Améliorer la colonne des heures */
  .time-column {
    min-width: 50px;
  }
  
  .time-slot {
    font-size: 0.7rem;
    padding: 0.25rem 0.375rem;
  }
  
  .time-hour {
    font-size: 0.85rem;
  }
  
  /* Footer plus compact */
  .agenda-footer {
    padding: 0.75rem 1rem;
    gap: 0.75rem;
  }
  
  /* Bouton toggle visible */
  .toggle-closed-hours {
    width: 2.25rem;
    height: 2.25rem;
  }
}

@media (max-width: 768px) {
  #main-content:has(.agenda-container) {
    padding: 0.25rem;
  }

  .agenda-container {
    border-radius: calc(var(--radius) * 0.5);
  }

  /* Masquer complètement la sidebar sur mobile */
  .agenda-sidebar {
    display: none !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    overflow: hidden !important;
  }

  .calendar-widget {
    display: none !important;
  }
  
  .cashiers-selection-footer {
    gap: 0.5rem;
    padding: 0.5rem;
    min-width: 0;
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  
  .cashiers-selection-footer .cashiers-selection-list {
    gap: 0.5rem;
    min-width: max-content;
  }
  
  /* Design simplifié sur mobile : juste une case avec photo */
  .cashiers-selection-footer .cashier-selection-item {
    min-width: 48px;
    min-height: 48px;
    max-width: 48px;
    max-height: 48px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--color-white);
    border: 2px solid var(--color-gray-300);
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
  }
  
  .cashiers-selection-footer .cashier-selection-item:has(input:checked) {
    border-color: var(--color-primary);
    border-width: 3px;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
  }
  
  .cashiers-selection-footer .cashier-selection-avatar {
    width: 100%;
    height: 100%;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 50%;
    background: var(--color-gray-100);
  }
  
  .cashiers-selection-footer .cashier-selection-avatar i {
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
    color: var(--color-primary);
  }
  
  .cashiers-selection-footer .cashier-selection-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: 50%;
    display: block;
  }
  
  /* Masquer le badge de check sur mobile */
  .cashiers-selection-footer .cashier-selection-item:has(input:checked)::after,
  .cashiers-selection-footer .cashier-selection-item:has(input:checked)::before {
    display: none;
  }
  
  /* Checkbox invisible mais fonctionnelle */
  .cashiers-selection-footer .cashier-selection-checkbox {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
    z-index: 10;
    top: 0;
    left: 0;
  }
  
  .cashiers-selection-footer .cashier-selection-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  
  .cashiers-selection-footer .cashier-selection-item {
    min-width: 32px;
    min-height: 32px;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .agenda-footer {
    padding: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
  }

  .zoom-controls {
    order: 1;
    width: 100%;
    justify-content: center;
    align-items: center;
    margin-bottom: 0.5rem;
  }
  
  .cashiers-selection-footer {
    order: 2;
    width: 100%;
    justify-content: center;
    align-items: center;
    margin-bottom: 0.5rem;
  }
  
  .btn-add-appointment {
    order: 3;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .calendar-day {
    font-size: 0.75rem;
  }

  .agenda-header {
    flex-direction: column;
    align-items: stretch;
    padding: 0.75rem;
    gap: 0.5rem;
  }

  .agenda-header-left,
  .agenda-header-center,
  .agenda-header-right {
    width: 100%;
  }

  .agenda-date-title {
    font-size: 1.125rem;
  }

  .view-mode-buttons {
    width: 100%;
    justify-content: center;
  }
  
  /* Masquer le bouton "Semaine" sur mobile */
  .view-mode-btn[data-view="week"] {
    display: none !important;
  }

  .agenda-navigation {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .nav-btn {
    flex: 1;
    min-width: 0;
    padding: 0.5rem 0.25rem;
    font-size: 0.75rem;
  }
  
  .schedule-unified {
    grid-template-columns: 1fr repeat(var(--cashier-count-day, 1), 3fr);
  }
  
  .schedule-unified:has(.week-day-header-container) {
    grid-template-columns: 1fr repeat(7, 3fr);
  }
  
  .time-column,
  .time-column-header {
    width: auto;
    min-width: 0;
    max-width: none;
    padding: 0.25rem;
  }
  
  .cashier-column-header {
    padding: 0.25rem;
  }
  
  .cashier-header-avatar {
    width: 1.5rem;
    height: 1.5rem;
  }
  
  .cashier-header-avatar i {
    width: 0.875rem;
    height: 0.875rem;
  }
  
  .cashier-name {
    font-size: 0.65rem;
  }
  
  .cashier-column-header {
    gap: 0.25rem;
    padding: 0.25rem;
    min-height: 2.25rem;
  }

  .time-slot {
    font-size: 0.55rem;
    padding: 0.125rem 0.125rem;
    min-height: 28px;
    height: 28px;
  }

  .time-slot i {
    width: 0.75rem;
    height: 0.75rem;
  }
  
  /* Réduire la taille des heures affichées sur mobile */
  .time-hour {
    font-size: 0.7rem;
  }
  
  .time-minutes {
    font-size: 0.55rem;
  }
  
  /* Augmenter la hauteur des cellules de créneaux horaires sur mobile */
  .time-slot-cell {
    min-height: 28px;
    height: 28px;
  }

  .cashier-name {
    font-size: 0.75rem;
  }

  .agenda-footer {
    padding: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
  }

  .zoom-controls {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 36px;
  }

  .btn-add-appointment {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .cashiers-selection-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    height: auto;
    min-height: 56px;
    padding: 0.5rem;
    gap: 0.5rem;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  
  .cashiers-selection-footer .cashiers-selection-list {
    gap: 0.5rem;
    min-width: max-content;
  }

  .appointment-block {
    left: 0.125rem;
    right: 0.125rem;
    padding: 0.25rem;
  }

  .appointment-name {
    font-size: 0.7rem;
  }

  .appointment-service-type {
    font-size: 0.6rem;
  }

  .appointment-time {
    font-size: 0.6rem;
  }
  
  /* Réduire le padding des rendez-vous sur mobile pour plus d'espace */
  .appointment-content {
    padding: 0.375rem;
  }
}

/* ============================================
   MODALE RENDEZ-VOUS
   ============================================ */
.appointment-modal-new {
  max-width: 800px;
  width: 100%;
}

.appointment-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  border-bottom: 1px solid var(--color-gray-200);
  background: var(--color-white);
}

.appointment-modal-tabs {
  display: flex;
  gap: 0;
  flex: 1;
}

.appointment-tab {
  padding: 1rem 1.5rem;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-light);
  transition: all 0.2s;
}

.appointment-tab:hover {
  color: var(--color-text);
  background: var(--color-gray-50);
}

.appointment-tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  font-weight: 600;
}

.appointment-modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-height: calc(90vh - 200px);
  overflow-y: auto;
  overflow-x: visible;
}

.appointment-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: relative;
  overflow: visible;
}

.appointment-section-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
}

/* Options SMS */
.sms-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--color-gray-50);
  border-radius: var(--radius);
  border: 1px solid var(--color-gray-200);
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: calc(var(--radius) * 0.5);
  transition: background-color 0.2s ease;
}

.checkbox-group:hover {
  background: var(--color-gray-100);
}

.checkbox-group input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  cursor: pointer;
  accent-color: var(--color-primary, #3b82f6);
  flex-shrink: 0;
}

.checkbox-group span {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--color-text);
  flex: 1;
}

.checkbox-group span i {
  width: 1rem;
  height: 1rem;
  color: var(--color-primary, #3b82f6);
}

.client-search-group {
  position: relative;
  z-index: 10001;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.client-search-input {
  flex: 1;
  padding: 0.625rem 1rem;
  border: 1px solid var(--color-gray-300);
  border-radius: var(--radius);
  font-size: 0.875rem;
}

.btn-create-client {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  background: var(--color-white);
  border: 1px solid var(--color-gray-300);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--color-text);
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-create-client:hover {
  background: var(--color-gray-50);
  border-color: var(--color-primary);
}

.btn-create-client i {
  width: 1rem;
  height: 1rem;
}

.client-search-results {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  width: 100%;
  min-width: 200px;
  background: var(--color-white);
  border: 1px solid var(--color-gray-300);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  max-height: 300px;
  overflow-y: auto;
  z-index: 10002;
  margin-top: 0;
}

.client-search-result-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.client-search-result-item:hover {
  background: var(--color-gray-50);
}

.client-result-name {
  font-weight: 500;
  color: var(--color-text);
}

.client-result-phone {
  font-size: 0.75rem;
  color: var(--color-text-light);
}

/* Vue mobile - simplifier l'affichage */
@media (max-width: 768px) {
  .client-search-result-item {
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    min-height: auto;
    line-height: 1.4;
    display: block !important;
    flex-direction: column;
    gap: 0;
  }

  .client-result-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block !important;
    line-height: 1.4;
  }

  .client-result-phone {
    display: none !important;
  }
  
  /* S'assurer qu'il n'y a qu'une seule ligne en mobile */
  .client-search-result-item > *:not(.client-result-name) {
    display: none !important;
  }
}

.reservation-info {
  display: flex;
  gap: 2rem;
  align-items: center;
  flex-wrap: wrap;
}

/* Notes du client */
.client-notes-container {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius);
  padding: 1rem;
  background: var(--color-gray-50);
}

.client-notes-loading,
.client-notes-empty,
.client-notes-error {
  padding: 1rem;
  text-align: center;
  color: var(--color-text-light);
  font-size: 0.875rem;
}

.client-note-item {
  background: var(--color-white);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin-bottom: 0.75rem;
}

.client-note-item:last-child {
  margin-bottom: 0;
}

.client-note-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-gray-100);
}

.client-note-author {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--color-text);
}

.client-note-date {
  font-size: 0.75rem;
  color: var(--color-text-light);
}

.client-note-content {
  font-size: 0.875rem;
  color: var(--color-text);
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.client-note-images {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.client-note-image {
  max-width: 100px;
  max-height: 100px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--color-gray-200);
  cursor: pointer;
}

.client-note-image:hover {
  transform: scale(1.05);
  transition: transform 0.2s;
}

/* Traçabilité */
.appointment-traceability {
  background: var(--color-gray-50);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius);
  padding: 1rem;
}

.traceability-empty {
  padding: 0.5rem;
  text-align: center;
  color: var(--color-text-light);
  font-size: 0.875rem;
}

.traceability-item {
  margin-bottom: 1rem;
}

.traceability-item:last-child {
  margin-bottom: 0;
}

.traceability-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

.traceability-label i {
  width: 1rem;
  height: 1rem;
  color: var(--color-primary);
}

.traceability-value {
  font-size: 0.875rem;
  color: var(--color-text);
  padding-left: 1.5rem;
}

.traceability-modifications {
  padding-left: 1.5rem;
}

.traceability-modification {
  background: var(--color-white);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin-bottom: 0.5rem;
}

.traceability-modification:last-child {
  margin-bottom: 0;
}

.modification-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-gray-100);
}

.modification-date {
  font-size: 0.75rem;
  color: var(--color-text-light);
  font-weight: 500;
}

.modification-author {
  font-size: 0.75rem;
  color: var(--color-primary);
  font-weight: 600;
}

.modification-changes {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.modification-change {
  font-size: 0.875rem;
  color: var(--color-text);
  padding-left: 0.5rem;
}

.reservation-info-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.reservation-label {
  font-size: 0.875rem;
  color: var(--color-text-light);
}

.reservation-value {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
}

.reservation-time-input {
  padding: 0.5rem;
  border: 1px solid var(--color-gray-300);
  border-radius: var(--radius);
  font-size: 0.875rem;
  width: 80px;
}

.appointment-date-input {
  display: none;
}

.services-table {
  width: 100%;
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  box-sizing: border-box;
}

.services-table-header {
  display: grid;
  grid-template-columns: minmax(150px, 200px) 1fr minmax(100px, 120px);
  background: var(--color-gray-50);
  border-bottom: 1px solid var(--color-gray-200);
  padding: 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-light);
  text-transform: uppercase;
  gap: 0.5rem;
}

.services-table-body {
  overflow: visible;
  display: flex;
  flex-direction: column;
}

.service-row {
  display: grid;
  grid-template-columns: minmax(150px, 200px) 1fr minmax(100px, 120px);
  padding: 0.75rem;
  border-bottom: 1px solid var(--color-gray-100);
  transition: background 0.2s;
  gap: 0.5rem;
  box-sizing: border-box;
}

.service-row:hover {
  background: var(--color-gray-50);
}

.service-row:last-child {
  border-bottom: none;
}

.service-col-resource {
  display: flex;
  align-items: center;
  min-width: 0;
  overflow: hidden;
}

.service-col-service {
  min-width: 0;
  overflow: hidden;
}

.service-col-duration {
  min-width: 0;
  overflow: hidden;
}

.service-resource {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.service-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.service-cashier-select {
  padding: 0.5rem;
  border: 1px solid var(--color-gray-300);
  border-radius: var(--radius);
  font-size: 0.875rem;
  width: 100%;
  min-width: 0;
  background: var(--color-white);
  cursor: pointer;
  box-sizing: border-box;
}

.service-duration-input {
  padding: 0.5rem;
  border: 1px solid var(--color-gray-300);
  border-radius: var(--radius);
  font-size: 0.875rem;
  background: var(--color-gray-50);
  cursor: not-allowed;
}

.service-select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--color-gray-300);
  border-radius: var(--radius);
  font-size: 0.875rem;
  background: var(--color-white);
  cursor: pointer;
  min-width: 0;
  box-sizing: border-box;
}

.service-duration-input,
.service-price-input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--color-gray-300);
  border-radius: var(--radius);
  font-size: 0.875rem;
  min-width: 0;
  box-sizing: border-box;
}

.btn-add-service {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--color-gray-100);
  border: 1px solid var(--color-gray-300);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.75rem auto;
  transition: all 0.2s;
}

.btn-add-service:hover {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.btn-add-service i {
  width: 1.25rem;
  height: 1.25rem;
}

.services-total {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  background: var(--color-gray-50);
  border-radius: var(--radius);
  font-size: 0.875rem;
}

.total-label {
  font-weight: 600;
  color: var(--color-text);
}

.total-duration {
  color: var(--color-text-light);
}

.total-price {
  font-weight: 600;
  color: var(--color-primary);
  margin-left: auto;
}

.appointment-note-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--color-text);
  user-select: none;
}

.appointment-note-toggle input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}

.appointment-note-content {
  margin-top: 0.5rem;
}

.appointment-note-textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--color-gray-300);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-family: inherit;
  resize: vertical;
  box-sizing: border-box;
}

.appointment-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--color-gray-200);
  background: var(--color-white);
}

.appointment-footer-left {
  display: flex;
  gap: 0.5rem;
}

.btn-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-gray-300);
  background: var(--color-white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: var(--color-gray-50);
  border-color: var(--color-primary);
}

.btn-icon i {
  width: 1.25rem;
  height: 1.25rem;
}

.btn-refresh {
  color: var(--color-primary);
}

.btn-print {
  color: var(--color-primary);
}

.appointment-footer-right {
  display: flex;
  gap: 0.75rem;
}
