/**
 * @file
 * Bannière de consentement aux cookies EMN.
 * Couleurs de la charte : #003262 (bleu), #00b5df (cyan), #00182f (hover).
 *
 * NB : le thème EMN fixe `html { font-size: 10px }` (reset Bootstrap 3), donc
 * 1rem = 10px. On utilise donc des tailles en PIXELS pour rester prévisible et
 * lisible, quel que soit le contexte.
 */

.emn-cookie,
.emn-cookie *,
.emn-cookie *::before,
.emn-cookie *::after,
.emn-cookie-manage,
.emn-cookie-manage * {
  box-sizing: border-box;
}

.emn-cookie {
  --emn-blue: #003262;
  --emn-blue-dark: #00182f;
  --emn-cyan: #00b5df;
  --emn-cyan-dark: #0098bd;
  --emn-text: #2b3540;
  --emn-muted: #555f6b;
  --emn-border: #e1e7ee;

  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.3s ease;
  font-family: inherit;
  -webkit-font-smoothing: antialiased;
}

.emn-cookie[hidden] {
  display: none;
}

.emn-cookie.is-visible {
  opacity: 1;
}

.emn-cookie__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 24, 47, 0.62);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.emn-cookie__modal {
  position: relative;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  background: #fff;
  border-top: 5px solid var(--emn-cyan);
  box-shadow: 0 18px 50px rgba(0, 24, 47, 0.35);
  padding: 28px 30px 24px;
  transform: translateY(24px) scale(0.98);
  transition: transform 0.3s ease;
  color: var(--emn-text);
  text-align: left;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.emn-cookie.is-visible .emn-cookie__modal {
  transform: none;
}

.emn-cookie__header {
  text-align: center;
  margin-bottom: 16px;
}

.emn-cookie__logo {
  display: inline-block;
  width: auto;
  max-width: 230px;
  max-height: 92px;
  height: auto;
}

.emn-cookie__title {
  margin: 0 0 12px;
  color: var(--emn-blue);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
}

.emn-cookie__intro {
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--emn-text);
}

.emn-cookie__policy {
  margin: 0 0 4px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--emn-text);
}

.emn-cookie a {
  color: var(--emn-cyan-dark);
  text-decoration: underline;
}

.emn-cookie a:hover,
.emn-cookie a:focus {
  color: var(--emn-blue);
}

/* Panneau « Personnaliser ». */
.emn-cookie__panel {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--emn-border);
}

.emn-cookie__panel[hidden] {
  display: none;
}

.emn-cookie__category {
  padding: 14px 0;
  border-bottom: 1px solid var(--emn-border);
}

.emn-cookie__category:last-of-type {
  border-bottom: 0;
}

.emn-cookie__category-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.emn-cookie__category-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--emn-blue);
}

.emn-cookie__badge {
  flex: none;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--emn-cyan-dark);
  background: rgba(0, 181, 223, 0.12);
  padding: 4px 10px;
  border-radius: 2px;
  white-space: nowrap;
}

.emn-cookie__category-desc {
  margin: 7px 0 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--emn-muted);
}

.emn-cookie__note {
  margin: 14px 0 0;
  font-size: 13px;
  font-style: italic;
  line-height: 1.5;
  color: var(--emn-muted);
}

/* Interrupteur (toggle) pour la catégorie Statistiques. */
.emn-cookie__switch {
  flex: none;
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  margin: 0;
}

.emn-cookie__switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.emn-cookie__slider {
  position: absolute;
  inset: 0;
  background: #c4ccd6;
  border-radius: 26px;
  transition: background 0.2s ease;
}

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

.emn-cookie__switch input:checked + .emn-cookie__slider {
  background: var(--emn-cyan);
}

.emn-cookie__switch input:checked + .emn-cookie__slider::before {
  transform: translateX(22px);
}

.emn-cookie__switch input:focus-visible + .emn-cookie__slider {
  outline: 2px solid var(--emn-blue);
  outline-offset: 2px;
}

/* Boutons d'action. */
.emn-cookie__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
}

.emn-cookie__actions-main {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-left: auto;
}

.emn-cookie__btn {
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  border: 2px solid transparent;
  border-radius: 0;
  padding: 11px 22px;
  min-height: 44px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.emn-cookie__btn:focus-visible {
  outline: 2px solid var(--emn-cyan);
  outline-offset: 2px;
}

.emn-cookie__btn--accept {
  background: var(--emn-cyan);
  border-color: var(--emn-cyan);
  color: #fff;
}

.emn-cookie__btn--accept:hover {
  background: var(--emn-cyan-dark);
  border-color: var(--emn-cyan-dark);
}

.emn-cookie__btn--reject {
  background: var(--emn-blue);
  border-color: var(--emn-blue);
  color: #fff;
}

.emn-cookie__btn--reject:hover {
  background: var(--emn-blue-dark);
  border-color: var(--emn-blue-dark);
}

.emn-cookie__btn--save {
  background: #fff;
  border-color: var(--emn-blue);
  color: var(--emn-blue);
}

.emn-cookie__btn--save:hover {
  background: var(--emn-blue);
  color: #fff;
}

.emn-cookie__btn--link {
  background: none;
  border-color: transparent;
  color: var(--emn-blue);
  text-decoration: underline;
  padding: 11px 6px;
  min-height: 44px;
}

.emn-cookie__btn--link:hover {
  color: var(--emn-cyan-dark);
}

/* Bouton flottant « Cookies » (rouvrir / modifier ses choix). */
.emn-cookie-manage {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 99990;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #003262;
  color: #fff;
  border: 0;
  border-radius: 2px;
  padding: 9px 14px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 24, 47, 0.3);
  transition: background 0.15s ease;
}

.emn-cookie-manage[hidden] {
  display: none;
}

.emn-cookie-manage:hover {
  background: #00182f;
}

.emn-cookie-manage:focus-visible {
  outline: 2px solid #00b5df;
  outline-offset: 2px;
}

.emn-cookie-manage__icon {
  flex: none;
}

/* ----------------------------------------------------------------------------
 * Responsive
 * ------------------------------------------------------------------------- */

/* Tablettes / petits écrans : on resserre un peu les marges. */
@media (max-width: 768px) {
  .emn-cookie {
    padding: 16px;
  }

  .emn-cookie__modal {
    padding: 26px 24px 22px;
  }
}

/* Téléphones : feuille ancrée en bas, boutons pleine largeur. */
@media (max-width: 600px) {
  .emn-cookie {
    padding: 0;
    align-items: flex-end;
  }

  .emn-cookie__modal {
    max-width: 100%;
    max-height: 94vh;
    padding: 24px 18px 20px;
    border-top-width: 4px;
  }

  .emn-cookie__title {
    font-size: 19px;
  }

  .emn-cookie__logo {
    max-width: 195px;
    max-height: 78px;
  }

  .emn-cookie__actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-top: 18px;
  }

  .emn-cookie__actions-main {
    margin-left: 0;
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }

  .emn-cookie__btn {
    width: 100%;
    text-align: center;
  }

  /* Ordre logique en colonne : Accepter, Refuser, Enregistrer, Personnaliser. */
  .emn-cookie__btn--accept {
    order: 1;
  }

  .emn-cookie__btn--reject {
    order: 2;
  }

  .emn-cookie__btn--save {
    order: 3;
  }

  .emn-cookie__btn--link {
    order: 4;
  }

  .emn-cookie-manage {
    left: 12px;
    bottom: 12px;
    padding: 11px;
  }

  .emn-cookie-manage__label {
    display: none;
  }
}

/* Très petits écrans. */
@media (max-width: 360px) {
  .emn-cookie__modal {
    padding: 20px 14px 16px;
  }

  .emn-cookie__title {
    font-size: 18px;
  }

  .emn-cookie__intro {
    font-size: 14px;
  }
}

/* Écrans très courts (paysage mobile) : on garde tout accessible au scroll. */
@media (max-height: 460px) {
  .emn-cookie {
    align-items: flex-start;
    padding: 10px;
    overflow-y: auto;
  }

  .emn-cookie__modal {
    max-height: none;
  }
}

/* Réduction des animations si l'utilisateur le demande. */
@media (prefers-reduced-motion: reduce) {
  .emn-cookie,
  .emn-cookie__modal {
    transition: none;
  }
}
