/* ============================================================
   Cookie consent banner + preferences panel (loaded on every page)
   CNIL-compliant layout: "Refuse all" as prominent as "Accept all".
   ============================================================ */

.cookie { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 1000;
  max-width: 560px; margin: 0 auto;
  background: #fff; border: 1px solid var(--hairline); border-radius: 18px;
  box-shadow: 0 24px 70px -24px rgba(0,0,0,.4); padding: 24px;
  animation: cookie-in .55s cubic-bezier(.16,1,.3,1) both;
  transition: opacity .35s ease, transform .45s cubic-bezier(.16,1,.3,1);
}
.cookie[hidden] { display: none; }
.cookie.is-hiding { opacity: 0; transform: translateY(26px); pointer-events: none; }
@keyframes cookie-in { from { opacity: 0; transform: translateY(34px); } to { opacity: 1; transform: none; } }
.cookie__title { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.cookie__body { font-size: 14px; color: var(--text-soft); line-height: 1.55; margin-bottom: 18px; }
.cookie__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.cookie__btn {
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  border-radius: 10px; padding: 11px 18px; border: 1px solid var(--hairline);
  background: #fff; color: var(--text); transition: background .15s, border-color .15s;
}
.cookie__btn:hover { background: var(--bg-alt); }
.cookie__btn--primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.cookie__btn--primary:hover { filter: brightness(1.06); }
.cookie__btn--flex { flex: 1 1 auto; text-align: center; }

/* Preferences panel (modal) */
.cookie-modal { position: fixed; inset: 0; z-index: 1001; display: none; align-items: center; justify-content: center; padding: 20px; }
.cookie-modal.is-open { display: flex; }
.cookie-modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.4); backdrop-filter: blur(2px); opacity: 0; }
.cookie-modal.is-open .cookie-modal__backdrop { animation: cm-fade-in .3s ease forwards; }
.cookie-modal.is-closing .cookie-modal__backdrop { animation: cm-fade-out .25s ease forwards; }
.cookie-modal__card { position: relative; background: #fff; border-radius: 20px; max-width: 560px; width: 100%;
  max-height: 86vh; overflow-y: auto; padding: 28px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.5); opacity: 0; }
.cookie-modal.is-open .cookie-modal__card { animation: cm-card-in .42s cubic-bezier(.16,1,.3,1) forwards; }
.cookie-modal.is-closing .cookie-modal__card { animation: cm-card-out .25s ease forwards; }
@keyframes cm-fade-in { to { opacity: 1; } }
@keyframes cm-fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes cm-card-in { from { opacity: 0; transform: translateY(20px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes cm-card-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(12px) scale(.98); } }
@media (prefers-reduced-motion: reduce) {
  .cookie, .cookie-modal__backdrop, .cookie-modal__card { animation: none !important; transition: none !important; opacity: 1 !important; transform: none !important; }
}
.cookie-modal__title { font-size: 22px; font-weight: 700; margin-bottom: 16px; }
.cookie-group { border-top: 1px solid var(--hairline); padding: 18px 0; }
.cookie-group__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.cookie-group__name { font-size: 15px; font-weight: 600; color: var(--text); }
.cookie-group__desc { font-size: 13px; color: var(--text-soft); line-height: 1.5; margin-top: 8px; }
.cookie-group__desc small { display: block; margin-top: 6px; opacity: .8; }

/* Toggle switch */
.switch { position: relative; width: 42px; height: 24px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch__track { position: absolute; inset: 0; background: #c7c7cc; border-radius: 980px; transition: background .2s; }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }
.switch input:disabled + .switch__track { background: var(--accent); opacity: .5; }

.cookie-modal__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

@media (max-width: 520px) {
  .cookie__btn--flex { flex-basis: 100%; }
}
