/* ═══════════════════════════════════════════════════════════════
   RGPD Cookie Consent — Compagnons Pro® Academy
   Conforme CNIL / ePrivacy — v2.0
   ═══════════════════════════════════════════════════════════════ */

/* ── Variables ── */
:root {
  --ck-navy:   #1A3680;
  --ck-navy2:  #0D1E50;
  --ck-gold:   #FFB800;
  --ck-gold2:  #E5A500;
  --ck-white:  #FFFFFF;
  --ck-grey:   #F5F7FA;
  --ck-text:   #2D3748;
  --ck-sub:    #718096;
  --ck-border: #E2E8F0;
  --ck-radius: 14px;
  --ck-shadow: 0 8px 40px rgba(26,54,128,0.18), 0 2px 8px rgba(0,0,0,0.08);
  --ck-z:      99999;
}

/* ── Bannière principale ── */
#cp-cookie-banner {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: min(720px, calc(100vw - 24px));
  background: var(--ck-white);
  border-radius: var(--ck-radius);
  box-shadow: var(--ck-shadow);
  border-top: 3px solid var(--ck-gold);
  z-index: var(--ck-z);
  padding: 16px 20px 16px;
  display: none;
  animation: ckSlideUp 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
}

@keyframes ckSlideUp {
  from { transform: translateX(-50%) translateY(30px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0);    opacity: 1; }
}

.cp-ck-banner__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.cp-ck-banner__logo {
  height: 32px;
  width: auto;
  flex-shrink: 0;
}

.cp-ck-banner__badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #EEF2FF;
  color: var(--ck-navy);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 20px;
  border: 1px solid #C7D3F5;
}

.cp-ck-banner__badge i { font-size: 10px; }

.cp-ck-banner__body {
  font-size: 13px;
  color: var(--ck-text);
  line-height: 1.5;
  margin-bottom: 10px;
}

.cp-ck-banner__body p {
  margin: 0;
}

.cp-ck-banner__body a {
  color: var(--ck-navy);
  text-decoration: underline;
  font-weight: 500;
}

.cp-ck-banner__body a:hover { color: var(--ck-gold2); }

.cp-ck-banner__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* Boutons bannière */
.cp-ck-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  padding: 9px 18px;
  cursor: pointer;
  border: none;
  transition: all 0.18s ease;
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
  line-height: 1;
}

.cp-ck-btn--accept {
  background: var(--ck-gold);
  color: var(--ck-navy2);
}
.cp-ck-btn--accept:hover {
  background: var(--ck-gold2);
  color: var(--ck-navy2);
  transform: translateY(-1px);
}

.cp-ck-btn--reject {
  background: transparent;
  color: var(--ck-navy);
  border: 1.5px solid var(--ck-navy);
}
.cp-ck-btn--reject:hover {
  background: var(--ck-navy);
  color: var(--ck-white);
}

.cp-ck-btn--manage {
  background: transparent;
  color: var(--ck-sub);
  border: 1.5px solid var(--ck-border);
  margin-left: auto;
}
.cp-ck-btn--manage:hover {
  border-color: var(--ck-navy);
  color: var(--ck-navy);
}

/* ── Overlay modal ── */
#cp-cookie-modal {
  position: fixed;
  inset: 0;
  background: rgba(10,20,60,0.55);
  z-index: calc(var(--ck-z) + 1);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(3px);
}

#cp-cookie-modal.cp-ck-modal--open {
  display: flex;
  animation: ckFadeIn 0.25s ease both;
}

@keyframes ckFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.cp-ck-modal__box {
  background: var(--ck-white);
  border-radius: var(--ck-radius);
  box-shadow: var(--ck-shadow);
  width: min(540px, 100%);
  max-height: min(88vh, 680px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: ckScaleIn 0.3s cubic-bezier(0.34,1.2,0.64,1) both;
}

@keyframes ckScaleIn {
  from { transform: scale(0.94); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.cp-ck-modal__header {
  background: var(--ck-navy);
  padding: 20px 24px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.cp-ck-modal__header-logo {
  height: 28px;
  width: auto;
}

.cp-ck-modal__title {
  color: var(--ck-white);
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
}

.cp-ck-modal__subtitle {
  color: rgba(255,255,255,0.65);
  font-size: 11.5px;
  margin: 2px 0 0;
}

.cp-ck-modal__close {
  margin-left: auto;
  background: rgba(255,255,255,0.12);
  border: none;
  color: var(--ck-white);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: background 0.15s;
  flex-shrink: 0;
}
.cp-ck-modal__close:hover { background: rgba(255,255,255,0.25); }

/* Onglets */
.cp-ck-modal__tabs {
  display: flex;
  border-bottom: 1.5px solid var(--ck-border);
  flex-shrink: 0;
  background: var(--ck-grey);
}

.cp-ck-tab {
  flex: 1;
  padding: 10px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ck-sub);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1.5px;
  transition: all 0.15s;
  font-family: inherit;
}

.cp-ck-tab.active {
  color: var(--ck-navy);
  border-bottom-color: var(--ck-gold);
  background: var(--ck-white);
}
.cp-ck-tab:hover:not(.active) { color: var(--ck-navy); }

/* Contenu modal */
.cp-ck-modal__body {
  overflow-y: auto;
  flex: 1;
  padding: 20px 24px;
}

.cp-ck-modal__body::-webkit-scrollbar { width: 4px; }
.cp-ck-modal__body::-webkit-scrollbar-track { background: var(--ck-grey); }
.cp-ck-modal__body::-webkit-scrollbar-thumb { background: var(--ck-border); border-radius: 2px; }

/* Tab panes */
.cp-ck-pane { display: none; }
.cp-ck-pane.active { display: block; }

.cp-ck-pane p {
  font-size: 12.5px;
  color: var(--ck-sub);
  line-height: 1.6;
  margin-bottom: 12px;
}

/* Catégories de cookies */
.cp-ck-category {
  border: 1.5px solid var(--ck-border);
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.cp-ck-category:hover { border-color: #C7D3F5; }

.cp-ck-category__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  background: var(--ck-white);
  user-select: none;
}

.cp-ck-category__icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.cp-ck-category__icon--essential { background: #E8F5E9; color: #2E7D32; }
.cp-ck-category__icon--analytics  { background: #E3F2FD; color: #1565C0; }
.cp-ck-category__icon--prefs      { background: #FFF8E1; color: #F57F17; }
.cp-ck-category__icon--marketing  { background: #FCE4EC; color: #C62828; }

.cp-ck-category__info { flex: 1; min-width: 0; }
.cp-ck-category__name {
  font-size: 13px;
  font-weight: 700;
  color: var(--ck-text);
  margin: 0 0 2px;
}
.cp-ck-category__desc {
  font-size: 11.5px;
  color: var(--ck-sub);
  margin: 0;
  line-height: 1.4;
}

/* Toggle switch */
.cp-ck-toggle {
  position: relative;
  width: 42px;
  height: 23px;
  flex-shrink: 0;
}

.cp-ck-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.cp-ck-toggle__slider {
  position: absolute;
  inset: 0;
  background: var(--ck-border);
  border-radius: 23px;
  cursor: pointer;
  transition: background 0.2s;
}

.cp-ck-toggle__slider::before {
  content: '';
  position: absolute;
  width: 17px;
  height: 17px;
  left: 3px;
  top: 3px;
  background: var(--ck-white);
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.cp-ck-toggle input:checked + .cp-ck-toggle__slider { background: var(--ck-navy); }
.cp-ck-toggle input:checked + .cp-ck-toggle__slider::before { transform: translateX(19px); }
.cp-ck-toggle input:disabled + .cp-ck-toggle__slider { background: #A5D6A7; cursor: not-allowed; opacity: 0.8; }

.cp-ck-toggle__always {
  font-size: 10px;
  color: #2E7D32;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* Détails catégorie (expandable) */
.cp-ck-category__detail {
  display: none;
  padding: 0 16px 14px 62px;
  font-size: 11.5px;
  color: var(--ck-sub);
  line-height: 1.55;
  border-top: 1px solid var(--ck-border);
  background: var(--ck-grey);
}
.cp-ck-category.open .cp-ck-category__detail { display: block; }
.cp-ck-category__detail p { margin: 10px 0 0; }
.cp-ck-category__detail ul { margin: 8px 0 0; padding-left: 16px; }
.cp-ck-category__detail li { margin-bottom: 3px; }

.cp-ck-chevron {
  font-size: 10px;
  color: var(--ck-sub);
  transition: transform 0.2s;
  margin-left: 4px;
}
.cp-ck-category.open .cp-ck-chevron { transform: rotate(180deg); }

/* Footer modal */
.cp-ck-modal__footer {
  padding: 14px 24px 18px;
  border-top: 1.5px solid var(--ck-border);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
  background: var(--ck-grey);
}

.cp-ck-modal__footer .cp-ck-btn { font-size: 12.5px; padding: 9px 16px; }
.cp-ck-modal__footer .cp-ck-btn--accept { flex: 1; min-width: 140px; }
.cp-ck-modal__footer .cp-ck-btn--save {
  background: var(--ck-navy);
  color: var(--ck-white);
}
.cp-ck-modal__footer .cp-ck-btn--save:hover { background: var(--ck-navy2); }

/* ── Bouton flottant "Gérer les cookies" ── */
#cp-cookie-manage-btn {
  position: fixed;
  bottom: 18px;
  left: 18px;
  z-index: calc(var(--ck-z) - 1);
  display: none;
  background: var(--ck-white);
  border: 1.5px solid var(--ck-border);
  border-radius: 30px;
  padding: 7px 13px 7px 10px;
  box-shadow: 0 2px 12px rgba(26,54,128,0.12);
  cursor: pointer;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ck-navy);
  font-family: inherit;
  transition: box-shadow 0.15s, transform 0.15s;
}
#cp-cookie-manage-btn:hover {
  box-shadow: 0 4px 18px rgba(26,54,128,0.18);
  transform: translateY(-1px);
}
#cp-cookie-manage-btn i { font-size: 13px; color: var(--ck-gold2); }

/* ── Info cookies page (tableau) ── */
.cp-ck-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  margin-top: 10px;
}
.cp-ck-table th {
  background: var(--ck-navy);
  color: var(--ck-white);
  padding: 7px 10px;
  text-align: left;
  font-weight: 600;
}
.cp-ck-table td {
  border-bottom: 1px solid var(--ck-border);
  padding: 7px 10px;
  color: var(--ck-text);
  vertical-align: top;
}
.cp-ck-table tr:last-child td { border-bottom: none; }
.cp-ck-table tr:nth-child(even) td { background: var(--ck-grey); }

/* ── Responsive mobile ── */
@media (max-width: 600px) {
  #cp-cookie-banner {
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    border-radius: 14px 14px 0 0;
    border-top: 3px solid var(--ck-gold);
  }

  @keyframes ckSlideUp {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }

  .cp-ck-banner__actions {
    flex-direction: column;
  }

  .cp-ck-btn { width: 100%; text-align: center; }
  .cp-ck-btn--manage { margin-left: 0; }

  .cp-ck-modal__box {
    max-height: 90vh;
    border-radius: 16px 16px 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    margin: 0;
  }

  #cp-cookie-modal {
    align-items: flex-end;
    padding: 0;
  }

  .cp-ck-modal__footer { flex-direction: column; }
  .cp-ck-modal__footer .cp-ck-btn { width: 100%; }
}
