/* Cookie banner — uses site CSS variables for light/dark */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: var(--white);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.08);
  padding: 20px 24px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}

.cookie-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: flex-start;
}

.cookie-text {
  flex: 1 1 420px;
}

.cookie-text strong {
  display: block;
  font-size: 15px;
  color: var(--ink);
  margin-bottom: 6px;
}

.cookie-text a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
  margin-left: 4px;
}

.cookie-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* Hide original text + buttons when prefs are open */
.cookie-banner.prefs-open .cookie-text,
.cookie-banner.prefs-open .cookie-actions {
  display: none;
}

.cookie-btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
}

.cookie-btn-primary {
  background: var(--ink);
  color: var(--white);
}
.cookie-btn-primary:hover {
  opacity: 0.9;
}

.cookie-btn-refuse {
  background: transparent;
  color: var(--ink);
  border: 2px solid var(--ink);
}
.cookie-btn-refuse:hover {
  background: var(--sand);
}

.cookie-btn-secondary {
  background: var(--sand);
  color: var(--ink);
  border: 1px solid var(--line);
}
.cookie-btn-secondary:hover {
  background: var(--line);
}

.cookie-btn-link {
  background: transparent;
  color: var(--muted);
  padding: 10px 12px;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.cookie-btn-link:hover {
  color: var(--ink);
}

.cookie-prefs {
  display: none;
  width: 100%;
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.cookie-prefs.open {
  display: block;
}

.pref-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.pref-item:last-of-type {
  border-bottom: none;
}

.pref-label {
  font-size: 14px;
  color: var(--ink);
  font-weight: 600;
}
.pref-desc {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 3px;
}

/* Interrupteurs — l'état se lit sans la couleur : position du rond + coche (✓) quand c'est activé */
.toggle {
  position: relative;
  width: 48px;
  height: 28px;
  background: #8a8a8a;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  border: none;
}
.toggle:focus {
  outline: none;
}
.toggle:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}
.toggle.on {
  background: #1a1a1a;
}
.toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  color: #1a1a1a;
}
.toggle.on::after {
  content: "\2713";
  transform: translateX(20px);
}
.toggle.disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.cookie-prefs-actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .cookie-banner {
    padding: 18px 16px 24px;
  }
  .cookie-actions {
    width: 100%;
  }
  .cookie-btn {
    flex: 1 1 auto;
    text-align: center;
  }
}

/* Dark mode — contraste renforcé
   Désactivé : piste sombre cerclée de gris clair + rond clair à gauche.
   Activé    : piste vert vif + rond sombre avec coche verte à droite. */
@media (prefers-color-scheme: dark) {
  .cookie-banner {
    background: rgba(12,12,12,.97);
    box-shadow: 0 -4px 24px rgba(0,0,0,0.4);
  }

  .toggle {
    background: #2b2b2b;
    box-shadow: inset 0 0 0 2px #a8a8a8;
  }
  .toggle::after {
    background: #d6d6d6;
    box-shadow: none;
    color: #0c0c0c;
  }
  .toggle.on {
    background: #6fe39a;
    box-shadow: none;
  }
  .toggle.on::after {
    background: #0c0c0c;
    color: #6fe39a;
  }
  .toggle:focus-visible {
    outline-color: #ffffff;
  }
}
