/* =============================================================================
   CONSENT BANNER + MODALE — 3A Financement
   ========================================================================== */

/* Utilitaire accessibilité : texte masqué visuellement mais lu par les SR */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* -- Bannière ---------------------------------------------------------------- */
.consent-banner {
  display: none;
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  z-index: 9999;
  width: min(960px, calc(100vw - 2rem));
  background: var(--c-paper, #fff);
  color: var(--c-ink, #0f172a);
  border: 1px solid var(--c-line, #e5e7eb);
  border-left: 4px solid var(--c-brand, #0047BB);
  border-radius: var(--r-md, 10px);
  box-shadow: 0 20px 40px -10px rgba(15, 23, 42, 0.18),
              0 6px 12px -4px rgba(15, 23, 42, 0.10);
  padding: 1.25rem 1.5rem;
  font-size: 0.9375rem;
  line-height: 1.55;
}

.consent-banner[data-open="true"] {
  display: block;
  animation: consent-slide-up 320ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes consent-slide-up {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

.consent-banner__title {
  margin: 0 0 0.4rem;
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--c-ink, #0f172a);
}

.consent-banner__text {
  margin: 0 0 1rem;
  color: var(--c-ink-muted, #475569);
}

.consent-banner__text a {
  color: var(--c-brand, #0047BB);
  text-decoration: underline;
}

.consent-banner__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  align-items: center;
}

.consent-btn {
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  padding: 0.625rem 1.125rem;
  border-radius: var(--r-sm, 6px);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
  line-height: 1.2;
}

.consent-btn--accept {
  background: var(--c-brand, #0047BB);
  color: #fff;
}
.consent-btn--accept:hover { background: var(--c-brand-dark, #00368C); }

.consent-btn--reject {
  background: #fff;
  color: var(--c-ink, #0f172a);
  border-color: var(--c-line-strong, #cbd5e1);
}
.consent-btn--reject:hover { background: var(--c-bg-soft, #f8fafc); }

.consent-btn--link {
  background: transparent;
  color: var(--c-brand, #0047BB);
  text-decoration: underline;
  padding: 0.625rem 0.5rem;
}
.consent-btn--link:hover { color: var(--c-brand-dark, #00368C); }

@media (max-width: 560px) {
  .consent-banner {
    bottom: 0;
    width: 100vw;
    border-radius: var(--r-md, 10px) var(--r-md, 10px) 0 0;
    border-left: none;
    border-top: 4px solid var(--c-brand, #0047BB);
    padding: 1rem 1.25rem 1.25rem;
  }
  .consent-banner__actions {
    flex-direction: column;
    align-items: stretch;
  }
  .consent-btn { width: 100%; text-align: center; }
}

/* -- Modale ------------------------------------------------------------------ */
.consent-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(15, 23, 42, 0.55);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.consent-modal[data-open="true"] {
  display: flex;
  animation: consent-fade-in 200ms ease;
}

@keyframes consent-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.consent-modal__box {
  background: #fff;
  color: var(--c-ink, #0f172a);
  border-radius: var(--r-md, 10px);
  width: min(640px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 48px -12px rgba(15, 23, 42, 0.30);
  padding: 1.75rem 1.75rem 1.5rem;
}

.consent-modal__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.consent-modal__title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.consent-modal__close {
  background: transparent;
  border: 0;
  color: var(--c-ink-muted, #475569);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}
.consent-modal__close:hover { color: var(--c-ink, #0f172a); }

.consent-modal__intro {
  margin: 0 0 1.25rem;
  color: var(--c-ink-muted, #475569);
  font-size: 0.9375rem;
  line-height: 1.55;
}

/* -- Catégories -------------------------------------------------------------- */
.consent-cat {
  border: 1px solid var(--c-line, #e5e7eb);
  border-radius: var(--r-sm, 6px);
  padding: 1rem 1.125rem;
  margin-bottom: 0.75rem;
}

.consent-cat__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.35rem;
}

.consent-cat__name {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.consent-cat__desc {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--c-ink-muted, #475569);
  line-height: 1.5;
}

.consent-cat__required {
  font-size: 0.75rem;
  color: var(--c-ink-muted, #64748b);
  background: var(--c-bg-soft, #f1f5f9);
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  white-space: nowrap;
}

/* -- Switch toggle ----------------------------------------------------------- */
.consent-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.consent-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.consent-switch__slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #cbd5e1;
  border-radius: 999px;
  transition: background 160ms ease;
}

.consent-switch__slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 160ms ease;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.2);
}

.consent-switch input:checked + .consent-switch__slider {
  background: var(--c-brand, #0047BB);
}

.consent-switch input:checked + .consent-switch__slider::before {
  transform: translateX(18px);
}

.consent-switch input:focus-visible + .consent-switch__slider {
  outline: 2px solid var(--c-brand, #0047BB);
  outline-offset: 2px;
}

.consent-switch input:disabled + .consent-switch__slider {
  cursor: not-allowed;
  opacity: 0.65;
}

/* -- Pied de modale ---------------------------------------------------------- */
.consent-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  margin-top: 1.25rem;
  justify-content: flex-end;
}

@media (max-width: 560px) {
  .consent-modal__box { padding: 1.25rem; }
  .consent-modal__actions { flex-direction: column-reverse; }
  .consent-modal__actions .consent-btn { width: 100%; }
}
