/* ============================================================
   PrediPlan — Bandeau & modale de consentement cookies
   ============================================================ */

/* --------- Bandeau bas d'écran --------- */
.cookie-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 9998;
  background: #ffffff;
  border: 1px solid var(--c-border, #e5e7eb);
  border-radius: var(--r-lg, 14px);
  box-shadow: var(--shadow-xl, 0 24px 56px rgba(0,0,0,.12), 0 8px 24px rgba(0,0,0,.06));
  font-family: var(--ff-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Arial, sans-serif);
  color: var(--c-text, #111827);
  animation: cookieSlideUp .35s ease-out;
}
.cookie-banner[hidden] { display: none !important; }

@keyframes cookieSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.cookie-banner-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.cookie-banner-text { flex: 1 1 420px; min-width: 0; }
.cookie-banner-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--c-text, #111827);
}
.cookie-banner-desc {
  font-size: .9rem;
  line-height: 1.55;
  color: var(--c-text-muted, #4b5563);
  margin: 0;
}
.cookie-banner-desc a {
  color: var(--c-primary, #12938e);
  text-decoration: underline;
}

.cookie-banner-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* --------- Boutons --------- */
.cookie-btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--r-md, 10px);
  padding: 10px 18px;
  font-size: .9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
  white-space: nowrap;
}
.cookie-btn:focus-visible {
  outline: 2px solid var(--c-primary, #12938e);
  outline-offset: 2px;
}
.cookie-btn-primary {
  background: var(--c-primary, #12938e);
  color: #fff;
}
.cookie-btn-primary:hover { background: var(--c-primary-dark, #0f766e); }
.cookie-btn-ghost {
  background: #fff;
  color: var(--c-text, #111827);
  border-color: var(--c-border-strong, #d1d5db);
}
.cookie-btn-ghost:hover {
  background: var(--c-bg-alt, #f7f8fa);
  border-color: var(--c-primary, #12938e);
  color: var(--c-primary-dark, #0f766e);
}

/* --------- Modale --------- */
.cookie-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.cookie-modal[hidden] { display: none !important; }

.cookie-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(2px);
  animation: cookieFadeIn .2s ease-out;
}
@keyframes cookieFadeIn { from { opacity: 0; } to { opacity: 1; } }

.cookie-modal-card {
  position: relative;
  background: #fff;
  border-radius: var(--r-lg, 14px);
  box-shadow: var(--shadow-xl, 0 24px 56px rgba(0,0,0,.12));
  max-width: 560px;
  width: 100%;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: cookieScaleIn .25s ease-out;
  font-family: var(--ff-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Arial, sans-serif);
}
@keyframes cookieScaleIn {
  from { opacity: 0; transform: scale(.96); }
  to   { opacity: 1; transform: scale(1); }
}

.cookie-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--c-border, #e5e7eb);
}
.cookie-modal-head h2 {
  font-size: 1.1rem;
  margin: 0;
  color: var(--c-text, #111827);
}
.cookie-modal-close {
  background: none;
  border: 0;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--c-text-subtle, #6b7280);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background .15s ease, color .15s ease;
}
.cookie-modal-close:hover {
  background: var(--c-bg-alt, #f7f8fa);
  color: var(--c-text, #111827);
}

.cookie-modal-body {
  padding: 18px 22px 8px;
  overflow-y: auto;
}
.cookie-modal-intro {
  font-size: .9rem;
  color: var(--c-text-muted, #4b5563);
  margin: 0 0 18px;
  line-height: 1.55;
}

/* --------- Préférence (par catégorie) --------- */
.cookie-pref {
  border: 1px solid var(--c-border, #e5e7eb);
  border-radius: var(--r-md, 10px);
  padding: 14px 16px;
  margin-bottom: 12px;
  background: var(--c-bg-alt, #f7f8fa);
}
.cookie-pref-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.cookie-pref-head h3 {
  font-size: .95rem;
  font-weight: 700;
  margin: 0;
  color: var(--c-text, #111827);
}
.cookie-pref p {
  font-size: .85rem;
  color: var(--c-text-muted, #4b5563);
  line-height: 1.5;
  margin: 0;
}
.cookie-pref-badge {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  background: var(--c-primary, #12938e);
  color: #fff;
  padding: 4px 10px;
  border-radius: 999px;
}

/* --------- Switch on/off --------- */
.cookie-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.cookie-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.cookie-switch-slider {
  width: 38px;
  height: 22px;
  background: #cbd5e1;
  border-radius: 999px;
  position: relative;
  transition: background .2s ease;
  flex-shrink: 0;
}
.cookie-switch-slider::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform .2s ease;
}
.cookie-switch input:checked + .cookie-switch-slider {
  background: var(--c-primary, #12938e);
}
.cookie-switch input:checked + .cookie-switch-slider::after {
  transform: translateX(16px);
}
.cookie-switch input:focus-visible + .cookie-switch-slider {
  outline: 2px solid var(--c-primary, #12938e);
  outline-offset: 2px;
}
.cookie-switch-label {
  font-size: .8rem;
  color: var(--c-text-muted, #4b5563);
  font-weight: 600;
}

/* --------- Footer modale --------- */
.cookie-modal-foot {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  padding: 16px 22px;
  border-top: 1px solid var(--c-border, #e5e7eb);
  background: #fff;
}

/* Empêche le scroll de l'arrière-plan quand la modale est ouverte */
body.cookie-modal-open { overflow: hidden; }

/* --------- Sous-titre dans les pages légales (article 7.1, 7.2…) --------- */
.legal-subhead {
  font-size: 1rem;
  font-weight: 700;
  color: var(--c-text, #111827);
  margin: 18px 0 8px;
}

/* --------- Responsive --------- */
@media (max-width: 720px) {
  .cookie-banner { left: 8px; right: 8px; bottom: 8px; }
  .cookie-banner-inner { padding: 16px; gap: 14px; }
  .cookie-banner-actions { width: 100%; justify-content: stretch; }
  .cookie-banner-actions .cookie-btn { flex: 1 1 auto; }
  .cookie-modal-foot { flex-direction: column-reverse; }
  .cookie-modal-foot .cookie-btn { width: 100%; }
}
