/*
  planning.css — Tableau de planning, récapitulatif hebdomadaire,
  cellules, chips employés, et styles de conteneurs associés.
*/

.planning-wrap,
.summary-wrap {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
  margin-bottom: 16px;
  /* Scroll horizontal interne quand le tableau est plus large que l'écran */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  border-collapse: collapse;
  width: 100%;
}

.planning-table {
  table-layout: fixed;
  min-width: 1080px; /* garantit une lisibilité minimum, sinon scroll horizontal */
  font-size: 12px;
}

.planning-table th,
.planning-table td {
  border: 1px solid var(--border);
  vertical-align: top;
}

.planning-table thead th {
  background: var(--header);
  color: var(--accent-dark);
  padding: 8px 4px;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 2;
}

.day-label {
  display: block;
  font-size: 13px;
}

.day-date {
  display: block;
  font-weight: 400;
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.day-hours {
  display: block;
  color: var(--muted);
  font-weight: 400;
  font-size: 11px;
  margin-top: 1px;
}

.time-col {
  width: 100px;
  background: #fbf8f4;
  color: var(--accent-dark);
  font-weight: 700;
  text-align: center;
  padding: 6px 4px;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.time-col .time-start { display: block; }
.time-col .time-end {
  display: block;
  font-weight: 400;
  color: var(--muted);
  font-size: 0.82em;
  margin-top: 1px;
}

/* Cellule horaire d'un jour : 30 min × 7 jours. Pas de display:flex
   sur le <td> directement (casse le rendu table). On ajoute un wrapper
   .slot-tags absolument positionné qui se partage la place entre
   employés. */
.slot-cell {
  min-height: 76px;
  height: 76px;
  padding: 0;
  background: #fff;
  cursor: pointer;
  position: relative;
}

.slot-cell:hover {
  outline: 2px solid rgba(111, 78, 55, 0.25);
  outline-offset: -2px;
}

.slot-cell.closed {
  background: repeating-linear-gradient(
    45deg,
    var(--closed),
    var(--closed) 6px,
    #f7f3ee 6px,
    #f7f3ee 12px
  );
  cursor: not-allowed;
}

.slot-cell.closed:hover { outline: none; }

/* Mode lecture seule : pas de pointer ni hover */
.read-only .slot-cell { cursor: default; }
.read-only .slot-cell:hover { outline: none; }

/*
  Étiquettes des employés positionnés sur ce créneau.
  Plusieurs employés peuvent partager la même demi-heure.
*/
/* Wrapper des employés présents sur ce créneau. Remplit la cellule
   et distribue équitablement la largeur entre les chips :
   1 employé → toute la case, 2 → 1/2, 3 → 1/3, 4 → 1/4, etc. */
.slot-tags {
  position: absolute;
  inset: 3px;
  display: flex;
  gap: 3px;
}

.slot-tag {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  padding: 4px 4px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.15;
  border: 1px solid rgba(0, 0, 0, 0.12);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-align: center;
}

/*
  ─────────────────────────────────────────────────────────────
  Récapitulatif hebdomadaire (totaux par employé).
  ─────────────────────────────────────────────────────────────
*/
.summary-wrap h2 {
  margin: 0 0 12px;
  color: var(--accent-dark);
  font-size: 17px;
}

.summary-table {
  font-size: 14px;
}

.summary-table th,
.summary-table td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
}

.summary-table th {
  background: var(--header);
  color: var(--accent-dark);
  font-weight: 700;
}

.summary-table td:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.summary-table .dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.total-row td {
  font-weight: 700;
  background: #fbf8f4;
}

.empty-state {
  color: var(--muted);
  font-style: italic;
  padding: 8px 0;
}

/*
  ─────────────────────────────────────────────────────────────
  Responsive — petits écrans : conserve le scroll horizontal du
  planning et empile la table récap si nécessaire.
  ─────────────────────────────────────────────────────────────
*/
@media (max-width: 600px) {
  .planning-wrap,
  .summary-wrap {
    padding: 8px;
    border-radius: 12px;
  }

  .planning-table { font-size: 11px; min-width: 760px; }

  .time-col { width: 70px; font-size: 11px; }

  .slot-cell { min-height: 64px; height: 64px; }

  .slot-tag { font-size: 11px; padding: 3px 4px; }

  .summary-table { font-size: 13px; }
  .summary-table th, .summary-table td { padding: 8px; }
}
