/* modules/family-calendar/family-calendar.css */

/* --- 1. VARIABLES --- */
:root {
  --primary: #3b82f6;
  --bg-page: #f8fafc;
  --bg-header: #f1f5f9;
  --border-color: #cbd5e1;
  --text-main: #1e293b;
  --text-muted: #64748b;

  /* Couleurs Sémantiques */
  --c-school-holiday: #e5d9f2;
  --c-public-holiday: #e0e0e0;
  --c-off-carole: #ffedd5;
  --c-extra-off: #fee2e2;
  --c-selected: #bfdbfe;

  /* NOUVELLES COULEURS (Neutres) */
  --bg-alex: #f0fdfa; /* Teal très pâle */
  --text-alex: #0f766e; /* Teal foncé */

  --bg-laia: #fffbeb; /* Jaune/Ambre très pâle */
  --text-laia: #b45309; /* Ambre foncé */
}

.pf-family-calendar {
  background-color: var(--bg-page);
  font-family: "Inter", system-ui, sans-serif;
  color: var(--text-main);
  font-size: 13px;
}

/* --- 2. LÉGENDE --- */
.pf-legend-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.pf-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
}
.pf-legend-color {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.fc-legend-school-holiday {
  background: var(--c-school-holiday);
}
.fc-legend-public-holiday {
  background: var(--c-public-holiday);
}
.fc-legend-off-carole {
  background: var(--c-off-carole);
}
.fc-legend-extra-off-carole {
  background: var(--c-extra-off);
}
.fc-legend-centre {
  background-color: white;
}
.fc-legend-centre::before {
  content: "🏫";
  font-size: 14px;
}
.fc-legend-pep-sick {
  background-color: white;
}
.fc-legend-pep-sick::before {
  content: "🤒";
  font-size: 14px;
}
.fc-legend-avis {
  width: 24px;
  height: 16px;
  background: repeating-linear-gradient(
    to bottom,
    #fcd116,
    #fcd116 2px,
    #ce1126 2px,
    #ce1126 4px
  );
  border: 1px solid #ce1126;
}

/* --- 3. PLANNING HEBDO --- */

/* --- HEADER PLANNING HEBDO (Harmonisé avec Calendrier Mensuel) --- */

.fc-week-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px; /* Même marge que le calendrier mensuel */
  padding-bottom: 0;
  gap: 16px;
  flex-wrap: wrap;
}

/* Le titre "Planning hebdo" */
.fc-week-header h2 {
  margin: 0;
  font-size: 1.25rem; /* Même taille que le titre du mois */
  font-weight: 800;
  color: var(--text-main);
  text-transform: none; /* On garde la casse normale ou uppercase selon préférence */
  border: none;
  padding: 0;
}

/* Conteneur des flèches et de la date */
.fc-week-nav-controls {
  display: flex;
  align-items: center;
  gap: 16px; /* Espace identique au header mensuel */
  background: white;
  padding: 4px 12px;
  border-radius: 50px; /* Petit conteneur pilule optionnel pour lier le tout */
  border: 1px solid transparent; /* ou var(--border-color) si tu veux un cadre */
}

/* LE TEXTE DE L'ANNÉE (Cible de ta demande) */
#fc-current-school-year-label {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
  text-align: center;
  letter-spacing: -0.02em;
  min-width: 120px; /* Empêche le saut quand les chiffres changent */

  /* Pour l'alignement vertical parfait avec les boutons */
  display: inline-block;
  line-height: 1;
  padding-top: 2px;
}

/* Ajustement spécifique pour les boutons de navigation dans ce header */
.fc-week-nav-controls .fc-nav-button {
  /* On s'assure qu'ils ont bien la taille définie globalement */
  width: 32px;
  height: 32px;
  font-size: 16px;
  background: white; /* Fond blanc */
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.fc-week-nav-controls .fc-nav-button:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
#planningTable-wrapper {
  max-height: 80vh;
  overflow: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: white;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  position: relative;
}

#planningTable {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

/* Sticky Header */
#planningTable thead {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg-header);
}
#planningTable thead th {
  position: sticky;
  top: 0;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  padding: 6px;
  font-size: 0.75rem;
  color: var(--text-main);
  z-index: 20;
  box-shadow: 0 1px 0 var(--border-color);
}

/* Gestion hauteurs Sticky */
#planningTable thead tr:nth-child(1) th {
  top: 0;
  height: 32px;
}
#planningTable thead tr:nth-child(2) th {
  top: 32px;
  height: 28px;
  z-index: 19;
}
#planningTable thead tr:nth-child(3) th {
  top: 60px;
  height: 24px;
  z-index: 19;
  border-bottom: 2px solid var(--border-color);
}

/* En-têtes Alex / Laia (Couleurs mises à jour) */
.col-alex.header-group {
  background: var(--bg-alex) !important;
  color: var(--text-alex);
}
.col-laia.header-group {
  background: var(--bg-laia) !important;
  color: var(--text-laia);
}

/* Cellules */
#planningTable tbody td {
  border-right: 1px solid #f1f5f9;
  border-bottom: 1px solid #f1f5f9;
  height: 36px;
  padding: 0 4px;
  text-align: center;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

/* Couleurs Cellules */
.fc-day--school-holiday {
  background: var(--c-school-holiday);
}
.fc-day--public-holiday {
  background: var(--c-public-holiday);
  font-weight: 700;
}
.fc-day--off-carole {
  background: var(--c-off-carole);
}
.fc-day--extra-off-carole {
  background: var(--c-extra-off);
}
.fc-day--selected {
  background: var(--c-selected) !important;
  outline: 2px solid var(--primary);
  z-index: 5;
}

/* Indicateurs */
.fc-day--centre::after {
  content: "🏫";
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 12px;
  line-height: 1;
  left: auto;
  transform: none;
}
.fc-day--avis::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 14px;
  height: 10px;
  border-radius: 2px;
  background: repeating-linear-gradient(
    to bottom,
    #fcd116,
    #fcd116 2px,
    #ce1126 2px,
    #ce1126 4px
  );
  border: 1px solid #b91c1c;
}
.fc-pep-sick-emoji {
  position: absolute;
  bottom: 2px;
  right: 2px;
  font-size: 12px;
  line-height: 1;
}

/* Colonnes spécifiques */
.col-alex-av,
.col-laia-av {
  background: #f8fafc;
  color: var(--text-muted);
  cursor: default;
}
.col-alex-sub {
  background: var(--bg-alex);
}
.col-laia-sub {
  background: var(--bg-laia);
}

.col-month {
  width: 50px;
  background: white;
  font-weight: 600;
  border-right: 2px solid var(--border-color) !important;
}
.col-day {
  width: 40px;
  border-right: 2px solid var(--border-color) !important;
}
.col-total {
  width: 30px;
}
.col-alex-sub,
.col-laia-sub {
  width: 35px;
}

.rotated-text span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* --- 4. CALENDRIER MENSUEL (Modernisé) --- */
.fc-month-calendar-wrapper {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 16px; /* Plus arrondi */
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.fc-month-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 16px;
}

/* NAVIGATION (Flèches) */
.fc-nav-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  order: 2; /* Pour s'assurer qu'il est bien placé */
}

.fc-nav-button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: white;
  color: var(--text-main);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.fc-nav-button:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(59, 130, 246, 0.15);
}

.fc-nav-button:active {
  transform: translateY(0);
}

/* TITRE DU MOIS */
#fc-current-month-year {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  text-transform: capitalize;
  min-width: 180px;
  text-align: center;
  letter-spacing: -0.02em;
}

/* BOUTONS DE VUE (Segmented Control Style) */
.fc-view-controls {
  display: inline-flex;
  background: #f1f5f9; /* Gris clair de fond */
  padding: 4px;
  border-radius: 12px;
  gap: 0; /* Collés */
  order: 1;
}

.fc-view-button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 8px; /* Un peu moins que le conteneur */
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.fc-view-button:hover {
  color: var(--text-main);
}

.fc-view-button--active {
  background: white;
  color: var(--primary);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  font-weight: 700;
}

/* RESTE DU CALENDRIER (Inchangé mais nécessaire pour le contexte) */
.fc-month-calendar {
  width: 100%;
  display: block;
}
.fc-month-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.fc-month-table th {
  background: #f8fafc;
  padding: 10px;
  border: 1px solid var(--border-color);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.fc-month-table td {
  border: 1px solid var(--border-color);
  height: 80px;
  vertical-align: top;
  padding: 6px;
  position: relative;
  cursor: pointer;
}
.fc-day--other-month {
  background: #fcfcfc;
}

/* Conteneurs Vues */
.fc-two-months-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  width: 100%;
}
.fc-year-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  width: 100%;
}
.fc-month-container,
.fc-year-month {
  background: white;
}
.fc-month-title,
.fc-year-month-title {
  text-align: center;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary);
  text-transform: capitalize;
}

/* --- 5. MENU CONTEXTUEL --- */
.fc-selection-menu {
  position: absolute;
  z-index: 9999;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  padding: 8px;
  min-width: 240px;
  display: none;
}
.fc-menu-section {
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
}
.fc-menu-section:last-child {
  border: none;
}
.fc-menu-section strong {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.fc-menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.fc-menu-btn {
  background: white;
  border: 1px solid var(--border-color);
  padding: 6px;
  border-radius: 4px;
  cursor: pointer;
  width: 100%;
}
.fc-menu-btn:hover {
  background: #eff6ff;
  border-color: var(--primary);
  color: var(--primary);
}
.fc-menu-danger {
  width: 100%;
  margin-top: 4px;
  background: #fff1f2;
  border: 1px solid #fda4af;
  color: #be123c;
  padding: 6px;
  border-radius: 4px;
  cursor: pointer;
}
.fc-menu-danger:hover {
  background: #be123c;
  color: white;
  border-color: #be123c;
}
.fc-menu-leaves-table table {
  width: 100%;
}
.fc-menu-leaves-table th {
  font-size: 0.7rem;
  color: var(--text-muted);
  padding-bottom: 4px;
}
.fc-menu-leaves-table td {
  padding: 2px;
}
