/* Cookie consent banner — CNIL-compliant
   Bandeau bas de page : 3 boutons équipoids (Tout refuser / Personnaliser / Tout accepter)
   Modal avec toggles par catégorie + bouton flottant gestion */

.cookie-banner,
.cookie-modal,
.cookie-fab {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  box-sizing: border-box;
}
.cookie-banner *,
.cookie-modal *,
.cookie-fab * { box-sizing: border-box; }

/* === Bandeau === */
.cookie-banner {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 9999;
  display: none;
  background: #ffffff;
  border-top: 4px solid #e63946;
  box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.12);
  padding: 18px 20px;
}
.cookie-banner.is-visible { display: block; }
.cookie-banner__inner {
  max-width: 1180px; margin: 0 auto;
  display: flex; gap: 20px; align-items: center; flex-wrap: wrap;
}
.cookie-banner__text {
  flex: 1 1 360px;
  font-size: 14px; line-height: 1.5; color: #1f2937;
}
.cookie-banner__text strong {
  display: block;
  font-size: 15px; font-weight: 700; color: #111827;
  margin-bottom: 4px;
}
.cookie-banner__text a { color: #1d4ed8; text-decoration: underline; }
.cookie-banner__buttons { display: flex; gap: 8px; flex-wrap: wrap; }

/* === Boutons partagés === */
.cookie-btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.cookie-btn--primary { background: #e63946; color: #ffffff; }
.cookie-btn--primary:hover { background: #c1121f; }
.cookie-btn--secondary { background: #ffffff; color: #1f2937; border-color: #d1d5db; }
.cookie-btn--secondary:hover { background: #f9fafb; border-color: #9ca3af; }
.cookie-btn--ghost { background: transparent; color: #1f2937; border-color: #d1d5db; }
.cookie-btn--ghost:hover { background: #f9fafb; border-color: #9ca3af; }

/* === Modal === */
.cookie-modal {
  position: fixed; inset: 0;
  z-index: 10000;
  display: none;
  align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.55);
}
.cookie-modal.is-visible { display: flex; }
.cookie-modal__dialog {
  background: #ffffff;
  border-radius: 10px;
  width: 100%; max-width: 560px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}
.cookie-modal__title { font-size: 20px; font-weight: 800; color: #111827; margin: 0 0 8px; }
.cookie-modal__lead { font-size: 14px; color: #4b5563; line-height: 1.55; margin: 0 0 18px; }
.cookie-modal__cat {
  border: 1px solid #e5e7eb; border-radius: 8px;
  padding: 14px 16px; margin-bottom: 12px;
}
.cookie-modal__cat-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.cookie-modal__cat-name { font-size: 15px; font-weight: 700; color: #111827; }
.cookie-modal__cat-desc {
  font-size: 13px; color: #4b5563; line-height: 1.5; margin: 6px 0 0;
}
.cookie-modal__actions {
  display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap;
  margin-top: 20px;
}

/* === Toggle switch === */
.cookie-toggle {
  position: relative; display: inline-block;
  width: 44px; height: 24px; flex-shrink: 0;
}
.cookie-toggle input { opacity: 0; width: 0; height: 0; }
.cookie-toggle__slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #d1d5db; border-radius: 24px;
  transition: background-color .2s ease;
}
.cookie-toggle__slider::before {
  content: ""; position: absolute;
  height: 18px; width: 18px; top: 3px; left: 3px;
  background: #ffffff; border-radius: 50%;
  transition: transform .2s ease;
}
.cookie-toggle input:checked + .cookie-toggle__slider { background: #16a34a; }
.cookie-toggle input:checked + .cookie-toggle__slider::before { transform: translateX(20px); }
.cookie-toggle input:disabled + .cookie-toggle__slider {
  background: #9ca3af; cursor: not-allowed; opacity: .7;
}

/* === Floating manage button (post-consentement) === */
.cookie-fab {
  position: fixed; left: 16px; bottom: 16px;
  z-index: 9998;
  display: none; align-items: center; gap: 6px;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12px; font-weight: 600; color: #1f2937;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  font-family: inherit;
}
.cookie-fab.is-visible { display: inline-flex; }
.cookie-fab:hover { border-color: #9ca3af; background: #f9fafb; }

/* === Mobile === */
@media (max-width: 640px) {
  .cookie-banner { padding: 14px 16px; }
  .cookie-banner__buttons { width: 100%; }
  .cookie-banner__buttons .cookie-btn { flex: 1 1 auto; }
  .cookie-modal__dialog { padding: 22px; }
  .cookie-fab { left: 12px; bottom: 12px; }
}
