/*
 * RegiFlow — Bannière de consentement cookies
 * Styles autonomes, sans dépendance externe.
 * Charte graphique RegiFlow : dark theme #0C0C0C / accent #31E9A4 / Montserrat
 */

/* ── Variables (charte RegiFlow) ─────────────────────────────── */
#rf-cookie-banner,
#rf-cookie-panel {
  --rf-primary     : #0C0C0C;
  --rf-surface     : #1A1A1A;
  --rf-accent      : #31E9A4;
  --rf-accent-dark : #1DB97F;
  --rf-border      : rgba(255, 255, 255, 0.08);
  --rf-white       : #ffffff;
  --rf-gray        : #9CA3AF;
  --rf-gray-light  : #D1D5DB;
  font-family: 'Montserrat', sans-serif;
}

/* ═══════════════════════════════════════════════════════════════
   BANNIÈRE BASSE
   ═══════════════════════════════════════════════════════════════ */
#rf-cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9000;
  background: var(--rf-surface);
  border-top: 1px solid var(--rf-border);
  box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.5);
  padding: 16px 24px;
  animation: rf-slideUp 0.3s ease;
}

#rf-cookie-banner[hidden] { display: none; }

@keyframes rf-slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.rf-cb-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.rf-cb-text {
  flex: 1;
  font-size: 0.875rem;
  color: var(--rf-gray-light);
  line-height: 1.55;
  min-width: 200px;
  margin: 0;
}

.rf-cb-text strong { color: var(--rf-white); }

.rf-cb-link {
  color: var(--rf-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.rf-cb-link:hover { opacity: 0.8; }

/* ── Groupe de boutons ─────────────────────────────────────── */
.rf-cb-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════
   BOUTONS COMMUNS
   Règle CNIL : "Refuser" et "Accepter" doivent avoir le MÊME
   poids visuel — même taille, même hauteur, contraste équivalent.
   ══════════════════════════════════════════════════════════════ */
.rf-cb-btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
  line-height: 1.4;
}
.rf-cb-btn:hover { opacity: 0.85; }
.rf-cb-btn:focus-visible {
  outline: 2px solid var(--rf-accent);
  outline-offset: 2px;
  border-radius: 8px;
}

/* Tout accepter */
.rf-cb-btn--primary {
  background: var(--rf-accent);
  color: var(--rf-primary);
}
.rf-cb-btn--primary:hover { background: var(--rf-accent-dark); opacity: 1; }

/* Tout refuser — même poids visuel qu'Accepter (obligatoire CNIL) */
.rf-cb-btn--outline {
  background: transparent;
  color: var(--rf-gray-light);
  border: 1px solid rgba(255, 255, 255, 0.3);
}
.rf-cb-btn--outline:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.5);
  opacity: 1;
}

/* Personnaliser — discret */
.rf-cb-btn--ghost {
  background: transparent;
  color: var(--rf-gray);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.rf-cb-btn--ghost:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--rf-gray-light);
  opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════
   PANNEAU DE PERSONNALISATION (modale)
   ═══════════════════════════════════════════════════════════════ */
#rf-cookie-panel {
  position: fixed;
  inset: 0;
  z-index: 9100;
  display: flex;
  align-items: center;
  justify-content: center;
}
#rf-cookie-panel[hidden] { display: none; }

/* Overlay sombre */
.rf-cp-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

/* Boîte centrale */
.rf-cp-box {
  position: relative;
  background: var(--rf-surface);
  border: 1px solid var(--rf-border);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 480px;
  margin: 16px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
  animation: rf-fadeIn 0.2s ease;
}

@keyframes rf-fadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1);    }
}

/* Bouton fermer */
.rf-cp-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--rf-gray);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.2s;
}
.rf-cp-close:hover { color: var(--rf-white); }

.rf-cp-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--rf-white);
  margin: 0 0 24px 0;
}

/* ── Liste des catégories ──────────────────────────────────── */
.rf-cp-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rf-cp-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--rf-border);
  border-radius: 10px;
}

.rf-cp-info strong {
  display: block;
  font-size: 0.9rem;
  color: var(--rf-white);
  margin-bottom: 4px;
}
.rf-cp-info p {
  font-size: 0.8rem;
  color: var(--rf-gray);
  line-height: 1.45;
  margin: 0;
}

/* Badge "Toujours actifs" */
.rf-cp-badge {
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--rf-accent);
  background: rgba(49, 233, 164, 0.1);
  border: 1px solid rgba(49, 233, 164, 0.25);
  border-radius: 20px;
  padding: 4px 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Toggle switch ─────────────────────────────────────────── */
.rf-cp-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}
.rf-cp-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.rf-cp-slider {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  transition: background 0.25s ease;
}
.rf-cp-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: var(--rf-white);
  border-radius: 50%;
  transition: transform 0.25s ease;
}
.rf-cp-toggle input:checked + .rf-cp-slider { background: var(--rf-accent); }
.rf-cp-toggle input:checked + .rf-cp-slider::before { transform: translateX(20px); }
.rf-cp-toggle input:focus-visible + .rf-cp-slider {
  outline: 2px solid var(--rf-accent);
  outline-offset: 2px;
}

/* Bouton "Enregistrer mes choix" */
.rf-cp-save {
  width: 100%;
  margin-top: 24px;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — mobile < 640px
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .rf-cb-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }
  .rf-cb-actions {
    flex-direction: column;
  }
  .rf-cb-btn {
    width: 100%;
    text-align: center;
  }
  .rf-cp-box {
    padding: 24px 20px;
  }
}
