/* ABC Télécom — Bandeau & modale de consentement cookies (RGPD)
   Ce fichier habille les éléments injectés par js/cookie-consent.js
   (#cookie-banner, #cookie-modal-backdrop, etc.). À inclure sur
   toutes les pages qui chargent cookie-consent.js. */

#cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  max-width: 980px;
  margin: 0 auto 20px;
  padding: 20px 24px;
  background: var(--ink-900, #0b1220);
  color: rgba(255, 255, 255, .88);
  border-radius: 14px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, .28);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: .92rem;
  line-height: 1.5;

  /* caché tant que .visible n'est pas ajouté */
  opacity: 0;
  transform: translateY(24px);
  pointer-events: none;
  transition: opacity .35s ease, transform .35s ease;
}

#cookie-banner.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#cookie-banner .cookie-text {
  flex: 1 1 320px;
  min-width: 240px;
}

#cookie-banner .cookie-text a {
  color: var(--signal-500, #ff5a3c);
  text-decoration: underline;
}

#cookie-banner .cookie-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  flex: 0 0 auto;
}

#cookie-banner .cookie-actions .btn {
  white-space: nowrap;
  padding: 10px 18px;
  font-size: .88rem;
}

/* --- Modale "Préférences de cookies" --- */

#cookie-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(8, 12, 22, .6);
  backdrop-filter: blur(2px);

  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease;
}

#cookie-modal-backdrop.visible {
  opacity: 1;
  visibility: visible;
}

#cookie-modal {
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  background: #fff;
  color: var(--ink-900, #0b1220);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, .35);
  font-family: 'Inter', system-ui, sans-serif;

  transform: translateY(16px) scale(.98);
  transition: transform .25s ease;
}

#cookie-modal-backdrop.visible #cookie-modal {
  transform: translateY(0) scale(1);
}

#cookie-modal h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.3rem;
  margin: 0 0 10px;
}

#cookie-modal > p {
  margin: 0 0 22px;
  color: #5b6472;
  font-size: .92rem;
  line-height: 1.55;
}

.cookie-pref-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 0;
  border-top: 1px solid #e6e9ee;
}

.cookie-pref-row:first-of-type {
  border-top: 1px solid #e6e9ee;
}

.cookie-pref-row h4 {
  font-size: .95rem;
  margin: 0 0 4px;
}

.cookie-pref-row p {
  margin: 0;
  font-size: .84rem;
  color: #5b6472;
  line-height: 1.5;
}

/* Interrupteur (toggle switch) */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
  flex: 0 0 auto;
  margin-top: 2px;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}

.switch input:disabled {
  cursor: not-allowed;
}

.switch .track {
  position: absolute;
  inset: 0;
  background: #d7dbe1;
  border-radius: 999px;
  transition: background .2s ease;
}

.switch .track::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .2s ease;
}

.switch input:checked ~ .track {
  background: var(--signal-500, #ff5a3c);
}

.switch input:checked ~ .track::before {
  transform: translateX(18px);
}

.switch input:disabled ~ .track {
  background: #c7d9cf;
  opacity: .8;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 24px;
}

/* Lien "Gérer mes cookies" ajouté dans le footer */
.cookie-manage-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  opacity: .7;
  text-decoration: underline;
  cursor: pointer;
}

.cookie-manage-link:hover {
  opacity: 1;
}

/* Mobile */
@media (max-width: 640px) {
  #cookie-banner {
    margin: 0 12px 12px;
    padding: 18px;
    flex-direction: column;
    align-items: stretch;
  }
  #cookie-banner .cookie-actions {
    justify-content: stretch;
  }
  #cookie-banner .cookie-actions .btn {
    flex: 1 1 auto;
    text-align: center;
  }
  #cookie-modal {
    padding: 24px;
  }
}
