/* CG Legal — Datepicker (Linear Minimal, Design B + vues empilées).
   Source unique réutilisée site-wide.
   v2 — chiffres en Inter avec features tnum + ss01 (cf spec §2.2).
   Ne plus modifier les sélecteurs publics (`data-cgl-datepicker`) sans
   bumper le cache buster (`?v=N`) sur dashboard.php et les pages outils.
*/

.cgl-dp-native {
  /* Cache l'<input type="date"> natif sans casser la sémantique form. */
  position: absolute !important;
  width: 1px !important; height: 1px !important;
  padding: 0 !important; margin: 0 !important;
  overflow: hidden !important; clip: rect(0,0,0,0) !important;
  white-space: nowrap !important; border: 0 !important;
  opacity: 0 !important; pointer-events: none !important;
}

.cgl-dp-wrap { position: relative; display: inline-block; }
.cgl-dp-wrap-block { display: block; width: 100%; }

.cgl-dp-display {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(28, 28, 28, 0.18);
  background: #ffffff;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-feature-settings: 'tnum' 1, 'ss01' 1;
  font-size: 14px;
  color: #1c1c1c;
  outline: none;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;
}
.cgl-dp-display::placeholder { color: rgba(28,28,28,0.35); }
.cgl-dp-display:hover { border-color: rgba(28, 28, 28, 0.35); }
.cgl-dp-display:focus { border-color: #7A1309; box-shadow: 0 0 0 1px #7A1309; }
.cgl-dp-display:disabled { background: #f5f3ee; color: rgba(28,28,28,0.4); cursor: not-allowed; }

.cgl-dp-popup {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 100;
  background: #ffffff;
  border: 1px solid rgba(28, 28, 28, 0.15);
  width: 320px;
  box-shadow: 0 12px 32px -12px rgba(0, 0, 0, 0.18);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  user-select: none;
}
.cgl-dp-popup[hidden] { display: none; }

.cgl-dp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(28, 28, 28, 0.08);
}

/* Header label devient un bouton qui cycle days → months → years.
   Indicateur visuel : petit chevron CSS qui pivote selon l'état. */
.cgl-dp-headlabel {
  background: transparent;
  border: 0;
  padding: 4px 8px 4px 0;
  margin: -4px 0 -4px -8px;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  border-radius: 4px;
  transition: background 0.1s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cgl-dp-headlabel:hover { background: rgba(28, 28, 28, 0.05); }
.cgl-dp-headlabel:focus { outline: 1px solid #7A1309; outline-offset: 2px; }
.cgl-dp-headlabel::after {
  content: '';
  width: 5px; height: 5px;
  border-right: 1.2px solid rgba(28, 28, 28, 0.4);
  border-bottom: 1.2px solid rgba(28, 28, 28, 0.4);
  transform: rotate(45deg);
  margin-left: 2px;
  margin-bottom: 2px;
  transition: transform 0.15s;
}
.cgl-dp-headlabel.is-up::after {
  transform: rotate(-135deg);
  margin-bottom: -2px;
}

.cgl-dp-month {
  font-size: 13px;
  font-weight: 600;
  color: #1c1c1c;
  text-transform: capitalize;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.cgl-dp-year {
  font-size: 11px;
  color: rgba(28, 28, 28, 0.5);
  margin-left: 6px;
  font-family: 'Inter', system-ui, sans-serif;
  font-feature-settings: 'tnum' 1, 'ss01' 1;
}
.cgl-dp-yearblock {
  font-size: 13px;
  font-weight: 600;
  color: #1c1c1c;
  font-family: 'Inter', system-ui, sans-serif;
  font-feature-settings: 'tnum' 1, 'ss01' 1;
}

.cgl-dp-nav { display: flex; gap: 2px; }
.cgl-dp-nav button {
  width: 28px; height: 28px;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: rgba(28, 28, 28, 0.55);
  font-size: 16px;
  line-height: 1;
  border-radius: 4px;
  font-family: inherit;
  padding: 0;
  transition: color 0.1s, background 0.1s;
}
.cgl-dp-nav button:hover { color: #1c1c1c; background: rgba(28, 28, 28, 0.05); }
.cgl-dp-nav button:focus { outline: 1px solid #7A1309; outline-offset: 1px; }

/* ─── Vue jours (existante) ─────────────────────────── */
.cgl-dp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 10px 14px 14px;
}
.cgl-dp-dow {
  font-family: 'Inter', system-ui, sans-serif;
  font-feature-settings: 'tnum' 1, 'ss01' 1;
  font-size: 10px;
  font-weight: 500;
  color: rgba(28, 28, 28, 0.4);
  padding: 6px 0;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cgl-dp-day {
  padding: 8px 0;
  text-align: center;
  font-family: 'Inter', system-ui, sans-serif;
  font-feature-settings: 'tnum' 1, 'ss01' 1;
  font-size: 12px;
  cursor: pointer;
  color: #1c1c1c;
  border: 0;
  background: transparent;
  border-radius: 4px;
  transition: background 0.1s, color 0.1s;
}
.cgl-dp-day:hover { background: #f5f3ee; }
.cgl-dp-day:focus { outline: 1px solid #7A1309; outline-offset: -1px; }
.cgl-dp-muted { color: rgba(28, 28, 28, 0.25); }
.cgl-dp-today { box-shadow: inset 0 0 0 1px #7A1309; color: #7A1309; font-weight: 600; }
.cgl-dp-selected { background: #1c1c1c; color: #ffffff; font-weight: 600; }
.cgl-dp-selected:hover { background: #1c1c1c; color: #ffffff; }
.cgl-dp-selected.cgl-dp-today { box-shadow: none; }

/* ─── Vue mois (nouveau) ────────────────────────────── */
.cgl-dp-mgrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 14px;
}
.cgl-dp-mcell {
  padding: 14px 0;
  text-align: center;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: #1c1c1c;
  border: 0;
  background: transparent;
  border-radius: 4px;
  transition: background 0.1s, color 0.1s;
}
.cgl-dp-mcell:hover { background: #f5f3ee; }
.cgl-dp-mcell:focus { outline: 1px solid #7A1309; outline-offset: -1px; }
.cgl-dp-mcell.cgl-dp-current { box-shadow: inset 0 0 0 1px #7A1309; color: #7A1309; font-weight: 600; }
.cgl-dp-mcell.cgl-dp-active { background: #1c1c1c; color: #fff; font-weight: 600; }
.cgl-dp-mcell.cgl-dp-active.cgl-dp-current { box-shadow: none; }

/* ─── Vue années (nouveau) ──────────────────────────── */
.cgl-dp-ygrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 14px;
}
.cgl-dp-ycell {
  padding: 14px 0;
  text-align: center;
  font-family: 'Inter', system-ui, sans-serif;
  font-feature-settings: 'tnum' 1, 'ss01' 1;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: #1c1c1c;
  border: 0;
  background: transparent;
  border-radius: 4px;
  transition: background 0.1s, color 0.1s;
}
.cgl-dp-ycell:hover { background: #f5f3ee; }
.cgl-dp-ycell:focus { outline: 1px solid #7A1309; outline-offset: -1px; }
.cgl-dp-ycell.cgl-dp-current { box-shadow: inset 0 0 0 1px #7A1309; color: #7A1309; font-weight: 600; }
.cgl-dp-ycell.cgl-dp-active { background: #1c1c1c; color: #fff; font-weight: 600; }
.cgl-dp-ycell.cgl-dp-active.cgl-dp-current { box-shadow: none; }

@media (max-width: 480px) {
  .cgl-dp-popup { width: 100%; max-width: calc(100vw - 32px); }
  .cgl-dp-display { font-size: 16px; /* Empêche le zoom iOS au focus */ }
}
