/* Couleur d'accent : entièrement piloté par --cookie-banner-accent, défini une fois par
   chaque site dans son propre CSS (voir assets/css/composent.css). Volontairement jamais
   déclaré ici (ni sur :root ni ailleurs) : si ce fichier définissait lui-même la variable,
   il gagnerait la cascade sur certains sites où cookie-banner.css charge après le CSS du
   site, et écraserait la couleur de marque. Repli #5050c8 (générique) si le site ne la
   définit pas. */

/* Autonomie du composant : plusieurs éléments (banner, modale, bouton de réouverture)
   posent leur propre display:flex/block plus bas — sans cette garde, l'attribut `hidden`
   ne suffit pas à les masquer (un display en feuille de style bat la règle UA de [hidden]).
   Le CSS par-site (assets/css/composent.css) applique déjà `[hidden]{display:none!important}`,
   mais il n'est PAS chargé sur toutes les pages (constat 2026-08-31 : la page 404, servie
   sans les assets déclarés dans site.json, affichait donc la modale — vide de surcroît). Ce
   composant doit masquer ses propres éléments `hidden` sans dépendre d'un autre fichier. */
.cookie-banner[hidden],
.cookie-banner-modal[hidden],
.cookie-banner-reopen[hidden] {
  display: none !important;
}

.cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
  padding: 16px;
}
.cookie-banner__content {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.cookie-banner__text {
  flex: 1 1 320px;
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: #1f2933;
}
.cookie-banner__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.cookie-banner__btn {
  border-radius: 4px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  white-space: nowrap;
}
.cookie-banner__btn--primary {
  background: var(--cookie-banner-accent, #5050c8);
  border-color: var(--cookie-banner-accent, #5050c8);
  color: #fff;
}
.cookie-banner__btn--primary:hover {
  filter: brightness(0.88);
}
.cookie-banner__btn--ghost {
  background: #fff;
  border-color: #d1d5db;
  color: #1f2933;
}
.cookie-banner__btn--ghost:hover {
  border-color: #9ca3af;
}
.cookie-banner__btn--link {
  background: none;
  border-color: transparent;
  color: var(--cookie-banner-accent, #5050c8);
  text-decoration: underline;
}
.cookie-banner__btn--link:hover {
  filter: brightness(0.88);
}

/* Bascule (utilisée dans la modale de personnalisation) */
.cookie-banner__toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.cookie-banner__toggle input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.cookie-banner__toggle-track {
  position: absolute;
  inset: 0;
  background: #d1d5db;
  border-radius: 999px;
  transition: background 0.15s ease;
  pointer-events: none; /* purement décoratif : le clic doit toujours atteindre l'input */
}
.cookie-banner__toggle-track::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s ease;
}
.cookie-banner__toggle input:checked + .cookie-banner__toggle-track {
  background: var(--cookie-banner-accent, #5050c8);
}
.cookie-banner__toggle input:checked + .cookie-banner__toggle-track::before {
  transform: translateX(18px);
}
.cookie-banner__toggle input:focus-visible + .cookie-banner__toggle-track {
  outline: 2px solid var(--cookie-banner-accent, #5050c8);
  outline-offset: 2px;
}

/* Modale "Personnaliser" */
.cookie-banner-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.cookie-banner-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.5);
}
.cookie-banner-modal__panel {
  position: relative;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  padding: 24px;
  max-width: 480px;
  width: 100%;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.cookie-banner-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  font-size: 22px;
  line-height: 1;
  color: #6b7280;
  cursor: pointer;
  border-radius: 4px;
}
.cookie-banner-modal__close:hover {
  background: #f3f4f6;
  color: #1f2933;
}
.cookie-banner-modal__title {
  margin: 0;
  padding-right: 32px;
  font-size: 18px;
  font-weight: 700;
  color: #1f2933;
}
.cookie-banner-modal__intro {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: #4b5563;
}
.cookie-banner-modal__intro a {
  color: var(--cookie-banner-accent, #5050c8);
  text-decoration: underline;
}
.cookie-banner-modal__intro a:hover {
  filter: brightness(0.88);
}
.cookie-banner-modal__detail {
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cookie-banner-modal__detail-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #1f2933;
}
.cookie-banner-modal__detail-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: #4b5563;
}
.cookie-banner-modal__detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.cookie-banner-modal__save {
  align-self: flex-start;
}

/* Icône de réouverture — discrète mais visible, affichée une fois un choix enregistré (le
   bandeau se cache) comme point d'accès permanent, en plus du lien "Gérer mes cookies" du
   footer de chaque site. */
.cookie-banner-reopen {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 99;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  background: #fff;
  border: 1.5px solid #d1d5db;
  color: var(--cookie-banner-accent, #5050c8);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  opacity: 0.85;
  transition:
    opacity 0.15s ease,
    box-shadow 0.15s ease;
}
.cookie-banner-reopen:hover,
.cookie-banner-reopen:focus-visible {
  opacity: 1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}
.cookie-banner-reopen:focus-visible {
  outline: 2px solid var(--cookie-banner-accent, #5050c8);
  outline-offset: 2px;
}
.cookie-banner-reopen svg {
  width: 22px;
  height: 22px;
}
