/* ═══════════════════════════════════════════════════════════════
   Kynteo — Cookie banner & modal (CNIL compliant)
   ═══════════════════════════════════════════════════════════════ */

/* Tokens réutilisés depuis la charte si non injectés */
.kc-scope{
  --kc-navy:#0f172a;
  --kc-navy-800:#1e293b;
  --kc-slate-700:#334155;
  --kc-slate-600:#475569;
  --kc-slate-500:#64748b;
  --kc-slate-400:#94a3b8;
  --kc-slate-300:#cbd5e1;
  --kc-slate-200:#e2e8f0;
  --kc-slate-100:#f1f5f9;
  --kc-slate-50:#f8fafc;
  --kc-blue:#2563eb;
  --kc-blue-700:#1d4ed8;
  --kc-blue-50:#eff6ff;
  --kc-amber:#f59e0b;
  --kc-amber-600:#d97706;
  --kc-amber-50:#fffbeb;
  --kc-green:#16a34a;
  --kc-green-100:#dcfce7;
  --kc-red:#dc2626;
  --kc-font:Inter,'Helvetica Neue',Arial,sans-serif;
  font-family:var(--kc-font);
}

/* ─── BANNER (première visite) ─── */
.kc-banner{
  position:fixed;
  bottom:20px;
  left:20px;
  right:20px;
  max-width:480px;
  background:#fff;
  border:1px solid var(--kc-slate-200);
  border-radius:18px;
  padding:24px 26px;
  box-shadow:0 30px 80px -20px rgba(15,23,42,.35), 0 0 0 1px rgba(15,23,42,.05);
  z-index:9998;
  font-size:14px;
  color:var(--kc-slate-700);
  line-height:1.6;
  animation:kc-slide-up .35s cubic-bezier(.2,.7,.2,1);
}
@keyframes kc-slide-up{
  from{opacity:0;transform:translateY(40px)}
  to{opacity:1;transform:translateY(0)}
}

.kc-banner-title{
  display:flex;
  align-items:center;
  gap:10px;
  margin-bottom:10px;
  font-size:15px;
  font-weight:700;
  color:var(--kc-navy);
}
.kc-banner-title .kc-icon{
  width:28px;height:28px;
  border-radius:8px;
  background:var(--kc-amber-50);
  color:var(--kc-amber-600);
  display:grid;place-items:center;
  flex-shrink:0;
}

.kc-banner p{margin:0 0 14px 0;color:var(--kc-slate-600);font-size:13.5px;line-height:1.55}
.kc-banner a{color:var(--kc-blue);text-decoration:underline}
.kc-banner a:hover{color:var(--kc-blue-700)}

.kc-banner-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.kc-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  padding:10px 14px;
  border-radius:10px;
  font-size:13.5px;
  font-weight:600;
  font-family:inherit;
  cursor:pointer;
  border:1px solid transparent;
  transition:all .15s;
  text-decoration:none;
  white-space:nowrap;
}
.kc-btn-primary{background:var(--kc-amber);color:var(--kc-navy);flex:1;min-width:140px}
.kc-btn-primary:hover{background:var(--kc-amber-600);color:#fff;transform:translateY(-1px);box-shadow:0 10px 20px -8px rgba(245,158,11,.4)}
.kc-btn-ghost{background:#fff;color:var(--kc-navy);border-color:var(--kc-slate-300);flex:1;min-width:140px}
.kc-btn-ghost:hover{border-color:var(--kc-navy);background:var(--kc-slate-50)}
.kc-btn-link{background:transparent;color:var(--kc-slate-600);padding:10px 8px;text-decoration:underline}
.kc-btn-link:hover{color:var(--kc-navy)}
.kc-btn-dark{background:var(--kc-navy);color:#fff}
.kc-btn-dark:hover{background:var(--kc-navy-800);transform:translateY(-1px)}

/* ─── MODAL de personnalisation ─── */
.kc-overlay{
  position:fixed;
  inset:0;
  background:rgba(15,23,42,.55);
  backdrop-filter:blur(6px);
  -webkit-backdrop-filter:blur(6px);
  z-index:9999;
  display:grid;
  place-items:center;
  padding:20px;
  animation:kc-fade .25s ease-out;
}
@keyframes kc-fade{from{opacity:0}to{opacity:1}}

.kc-modal{
  background:#fff;
  border-radius:20px;
  max-width:560px;
  width:100%;
  max-height:calc(100vh - 40px);
  max-height:calc(100dvh - 40px);
  display:flex;
  flex-direction:column;
  overflow:hidden;
  box-shadow:0 50px 120px -20px rgba(15,23,42,.5);
  animation:kc-slide-up .3s cubic-bezier(.2,.7,.2,1);
}
.kc-modal-header{
  padding:24px 28px 16px;
  border-bottom:1px solid var(--kc-slate-200);
  position:relative;
}
.kc-modal-header h2{
  font-size:22px;
  font-weight:800;
  letter-spacing:-.02em;
  color:var(--kc-navy);
  margin:0 0 6px 0;
  padding-right:32px;
}
.kc-modal-header p{
  font-size:13.5px;
  color:var(--kc-slate-600);
  line-height:1.55;
  margin:0;
}
.kc-close{
  position:absolute;
  top:20px;
  right:20px;
  width:32px;
  height:32px;
  border-radius:8px;
  background:var(--kc-slate-100);
  color:var(--kc-slate-600);
  display:grid;
  place-items:center;
  border:none;
  cursor:pointer;
  transition:all .15s;
}
.kc-close:hover{background:var(--kc-slate-200);color:var(--kc-navy)}

.kc-modal-body{
  padding:8px 28px;
  overflow-y:auto;
  flex:1;
}
.kc-category{
  padding:18px 0;
  border-bottom:1px solid var(--kc-slate-100);
}
.kc-category:last-child{border-bottom:none}
.kc-category-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  cursor:pointer;
}
.kc-category-info{flex:1;min-width:0}
.kc-category-title{
  display:flex;
  align-items:center;
  gap:8px;
  font-size:15px;
  font-weight:700;
  color:var(--kc-navy);
  margin-bottom:4px;
}
.kc-badge{
  font-size:10.5px;
  font-weight:700;
  padding:2px 8px;
  border-radius:999px;
  letter-spacing:.04em;
  text-transform:uppercase;
}
.kc-badge-required{background:var(--kc-green-100);color:var(--kc-green)}
.kc-badge-optional{background:var(--kc-slate-100);color:var(--kc-slate-600)}
.kc-category-desc{
  font-size:13px;
  color:var(--kc-slate-600);
  line-height:1.5;
}
.kc-category-details{
  margin-top:10px;
  font-size:12.5px;
  color:var(--kc-slate-500);
  background:var(--kc-slate-50);
  border-radius:8px;
  padding:10px 12px;
  display:none;
}
.kc-category-details.open{display:block}
.kc-category-details code{
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  background:#fff;
  padding:1px 5px;
  border-radius:4px;
  border:1px solid var(--kc-slate-200);
  font-size:11.5px;
}
.kc-toggle-details{
  background:none;
  border:none;
  color:var(--kc-blue);
  font-size:12px;
  font-weight:600;
  cursor:pointer;
  padding:6px 0 0;
  font-family:inherit;
}
.kc-toggle-details:hover{text-decoration:underline}

/* Toggle switch */
.kc-switch{
  position:relative;
  flex-shrink:0;
  width:44px;
  height:24px;
  background:var(--kc-slate-300);
  border-radius:999px;
  cursor:pointer;
  transition:background .2s;
  border:none;
  padding:0;
}
.kc-switch.locked{background:var(--kc-green);cursor:not-allowed;opacity:.7}
.kc-switch.on{background:var(--kc-blue)}
.kc-switch::after{
  content:"";
  position:absolute;
  top:2px;
  left:2px;
  width:20px;
  height:20px;
  background:#fff;
  border-radius:50%;
  box-shadow:0 2px 4px rgba(0,0,0,.15);
  transition:transform .2s;
}
.kc-switch.on::after,
.kc-switch.locked::after{transform:translateX(20px)}

.kc-modal-footer{
  padding:20px 28px;
  border-top:1px solid var(--kc-slate-200);
  background:var(--kc-slate-50);
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.kc-modal-footer .kc-btn{min-width:unset}

/* ─── Responsive ─── */
@media(max-width:640px){
  .kc-banner{
    left:12px;right:12px;bottom:12px;
    padding:20px 22px;
    max-width:none;
    border-radius:16px;
  }
  .kc-banner-actions{flex-direction:column;gap:8px}
  .kc-btn-primary,.kc-btn-ghost{flex:none;width:100%}
  .kc-modal{max-height:calc(100vh - 16px);max-height:calc(100dvh - 16px);border-radius:16px}
  .kc-modal-header{padding:20px 20px 14px}
  .kc-modal-body{padding:4px 20px}
  .kc-modal-footer{padding:16px 20px;flex-direction:column}
  .kc-modal-footer .kc-btn{width:100%}
}

/* ─── Mode sombre système (confort, optionnel) ─── */
@media(prefers-color-scheme:dark){
  /* Garde le banner en clair pour la lisibilité et le pro look */
  /* Ajouter un mode sombre si besoin */
}

/* Focus visible pour accessibilité */
.kc-btn:focus-visible,
.kc-switch:focus-visible,
.kc-close:focus-visible,
.kc-toggle-details:focus-visible{
  outline:2px solid var(--kc-blue);
  outline-offset:2px;
}
