/* =====================================================
   Admin PC – Banner de consentement cookies personnalisée
   Compatible Google Consent Mode v2 (GTM, Clarity, Bing UET)
   Style aligné avec --brand-color #1fa84f et police Outfit
   ===================================================== */

/* Empêche le scroll quand la modale de préférences est ouverte */
body.adminpc-cc-modal-open {
  overflow: hidden;
}

/* ---------- Banner principal (bas de page) ---------- */
.adminpc-cc-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 999999;
  max-width: 1100px;
  margin: 0 auto;
  padding: 22px 26px;
  background: #ffffff;
  color: #404742;
  font-family: "Outfit", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  border: 1px solid rgba(31, 168, 79, 0.18);
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(20, 40, 30, 0.18),
              0 4px 14px rgba(20, 40, 30, 0.08);
  transform: translateY(140%);
  opacity: 0;
  transition: transform .55s cubic-bezier(.2,.7,.2,1), opacity .35s ease;
  pointer-events: none;
}

.adminpc-cc-banner.is-visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.adminpc-cc-banner__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px 24px;
}

.adminpc-cc-banner__icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(31, 168, 79, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #1fa84f;
}

.adminpc-cc-banner__text {
  flex: 1 1 320px;
  min-width: 280px;
  font-size: 15px;
  line-height: 1.5;
}

.adminpc-cc-banner__title {
  font-weight: 700;
  font-size: 17px;
  color: #202020;
  margin: 0 0 4px;
}

.adminpc-cc-banner__text p {
  margin: 0;
}

.adminpc-cc-banner__text a {
  color: #1fa84f;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.adminpc-cc-banner__text a:hover { color: #16823c; }

.adminpc-cc-banner__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  flex-shrink: 0;
}

/* ---------- Boutons ---------- */
.adminpc-cc-btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  line-height: 1;
  padding: 12px 20px;
  border-radius: 999px;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
  letter-spacing: .2px;
}

.adminpc-cc-btn:focus-visible {
  outline: 3px solid rgba(31, 168, 79, 0.45);
  outline-offset: 2px;
}

.adminpc-cc-btn--primary {
  background: #1fa84f;
  color: #fff;
  box-shadow: 0 6px 16px rgba(31, 168, 79, 0.35);
}
.adminpc-cc-btn--primary:hover { background: #19913f; transform: translateY(-1px); }

.adminpc-cc-btn--ghost {
  background: transparent;
  color: #404742;
  border: 1px solid rgba(64, 71, 66, 0.25);
}
.adminpc-cc-btn--ghost:hover {
  background: rgba(31, 168, 79, 0.08);
  border-color: #1fa84f;
  color: #1fa84f;
}

.adminpc-cc-btn--link {
  background: transparent;
  color: #5e5e5e;
  padding: 12px 6px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.adminpc-cc-btn--link:hover { color: #1fa84f; }

/* ---------- Bouton flottant "Gérer mes cookies" (après choix) ---------- */
.adminpc-cc-floater {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 999998;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ffffff;
  color: #1fa84f;
  border: 1px solid rgba(31, 168, 79, 0.25);
  box-shadow: 0 6px 18px rgba(20, 40, 30, 0.18);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  transition: transform .15s ease, box-shadow .2s ease;
}
.adminpc-cc-floater:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(20, 40, 30, 0.22); }
.adminpc-cc-floater.is-visible { display: flex; }

/* Sur les pages avec reCAPTCHA v3 (badge en bas-gauche),
   on remonte le bouton "Gérer mes cookies" au-dessus du badge
   pour éviter le chevauchement. */
body:has(.grecaptcha-badge) .adminpc-cc-floater {
  bottom: 86px;
}

/* ---------- Modale de préférences ---------- */
.adminpc-cc-modal {
  position: fixed;
  inset: 0;
  z-index: 1000000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(20, 30, 25, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity .25s ease;
}
.adminpc-cc-modal.is-visible {
  display: flex;
  opacity: 1;
}

.adminpc-cc-modal__dialog {
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 30px 60px rgba(0,0,0,.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(.98);
  transition: transform .3s cubic-bezier(.2,.7,.2,1);
  font-family: "Outfit", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
.adminpc-cc-modal.is-visible .adminpc-cc-modal__dialog {
  transform: translateY(0) scale(1);
}

.adminpc-cc-modal__header {
  padding: 22px 26px 14px;
  border-bottom: 1px solid #eef0ee;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.adminpc-cc-modal__title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #202020;
}
.adminpc-cc-modal__close {
  background: transparent;
  border: 0;
  font-size: 24px;
  line-height: 1;
  color: #5e5e5e;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.adminpc-cc-modal__close:hover { color: #1fa84f; background: rgba(31, 168, 79, 0.08); }

.adminpc-cc-modal__body {
  padding: 20px 26px;
  overflow-y: auto;
  font-size: 15px;
  color: #404742;
  line-height: 1.55;
}

.adminpc-cc-modal__intro {
  margin: 0 0 18px;
}

.adminpc-cc-category {
  border: 1px solid #e7e9e7;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: #fbfcfb;
  transition: border-color .2s ease, background .2s ease;
}
.adminpc-cc-category:hover { border-color: rgba(31, 168, 79, 0.4); }

.adminpc-cc-category__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.adminpc-cc-category__name {
  font-weight: 600;
  font-size: 15px;
  color: #202020;
  margin: 0;
}
.adminpc-cc-category__desc {
  margin: 6px 0 0;
  font-size: 13.5px;
  color: #5e5e5e;
}
.adminpc-cc-category__locked {
  font-size: 12px;
  font-weight: 600;
  color: #1fa84f;
  background: rgba(31, 168, 79, 0.12);
  padding: 4px 10px;
  border-radius: 999px;
}

/* Switch */
.adminpc-cc-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.adminpc-cc-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.adminpc-cc-switch__slider {
  position: absolute;
  inset: 0;
  background: #cfd2cf;
  border-radius: 999px;
  cursor: pointer;
  transition: background .2s ease;
}
.adminpc-cc-switch__slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .25s cubic-bezier(.2,.7,.2,1);
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
}
.adminpc-cc-switch input:checked + .adminpc-cc-switch__slider {
  background: #1fa84f;
}
.adminpc-cc-switch input:checked + .adminpc-cc-switch__slider::before {
  transform: translateX(20px);
}
.adminpc-cc-switch input:focus-visible + .adminpc-cc-switch__slider {
  outline: 3px solid rgba(31, 168, 79, 0.45);
  outline-offset: 2px;
}

.adminpc-cc-modal__footer {
  padding: 16px 26px 20px;
  border-top: 1px solid #eef0ee;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  background: #fafbfa;
}

/* ---------- Dark mode ---------- */
body.dark-mode .adminpc-cc-banner {
  background: #1e1e1e;
  color: #e4e6e4;
  border-color: rgba(31, 168, 79, 0.35);
}
body.dark-mode .adminpc-cc-banner__title { color: #fff; }
body.dark-mode .adminpc-cc-btn--ghost { color: #e4e6e4; border-color: rgba(228, 230, 228, 0.25); }
body.dark-mode .adminpc-cc-btn--ghost:hover { color: #1fa84f; }
body.dark-mode .adminpc-cc-floater { background: #1e1e1e; color: #1fa84f; }
body.dark-mode .adminpc-cc-modal__dialog { background: #1e1e1e; color: #e4e6e4; }
body.dark-mode .adminpc-cc-modal__title { color: #fff; }
body.dark-mode .adminpc-cc-modal__header,
body.dark-mode .adminpc-cc-modal__footer { border-color: #2a2a2a; }
body.dark-mode .adminpc-cc-modal__footer { background: #181818; }
body.dark-mode .adminpc-cc-category { background: #232323; border-color: #2f2f2f; }
body.dark-mode .adminpc-cc-category__name { color: #fff; }
body.dark-mode .adminpc-cc-category__desc { color: #bcbcbc; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .adminpc-cc-banner {
    left: 8px;
    right: 8px;
    bottom: 8px;
    padding: 18px 18px;
    border-radius: 12px;
  }
  .adminpc-cc-banner__icon { display: none; }
  .adminpc-cc-banner__title { font-size: 16px; }
  .adminpc-cc-banner__text { font-size: 14px; }
  .adminpc-cc-banner__actions { width: 100%; }
  .adminpc-cc-btn { flex: 1 1 auto; text-align: center; padding: 12px 14px; }
  .adminpc-cc-btn--link { flex-basis: 100%; padding: 6px; }
  .adminpc-cc-modal__header,
  .adminpc-cc-modal__body,
  .adminpc-cc-modal__footer { padding-left: 18px; padding-right: 18px; }
  .adminpc-cc-modal__footer .adminpc-cc-btn { flex: 1 1 auto; }
}

/* Respect des préférences utilisateur "reduce-motion" */
@media (prefers-reduced-motion: reduce) {
  .adminpc-cc-banner,
  .adminpc-cc-modal,
  .adminpc-cc-modal__dialog,
  .adminpc-cc-switch__slider,
  .adminpc-cc-switch__slider::before {
    transition: none !important;
  }
}
