/* ==========================================================================
   Bannière de consentement cookies
   ========================================================================== */

.cookie-consent {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background-color: var(--color-bg);
  border-top: 1px solid rgba(34, 34, 34, 0.1);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.06);
  animation: cookieSlideUp 0.4s ease;
}

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

.cookie-consent--closing {
  animation: cookieSlideDown 0.3s ease forwards;
}

.cookie-consent__inner {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 24px 16px;
}

/* ---------- Vue principale ---------- */

.cookie-consent__main {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cookie-consent__text {
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--color-black);
}

.cookie-consent__text a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cookie-consent__text a:hover {
  color: #b37070;
}

.cookie-consent__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ---------- Boutons communs ---------- */

.cookie-consent__accept-all,
.cookie-consent__refuse-all,
.cookie-consent__customize,
.cookie-consent__save {
  padding: 10px 20px;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: var(--radius);
  cursor: pointer;
  transition:
    background-color var(--transition),
    color var(--transition),
    border-color var(--transition);
}

.cookie-consent__accept-all,
.cookie-consent__save {
  color: #fff;
  background-color: var(--color-primary);
  border: 2px solid var(--color-primary);
}

.cookie-consent__accept-all:hover,
.cookie-consent__accept-all:focus-visible,
.cookie-consent__save:hover,
.cookie-consent__save:focus-visible {
  background-color: #b37070;
  border-color: #b37070;
}

.cookie-consent__refuse-all,
.cookie-consent__customize {
  color: var(--color-black);
  background-color: transparent;
  border: 2px solid rgba(34, 34, 34, 0.15);
}

.cookie-consent__refuse-all:hover,
.cookie-consent__refuse-all:focus-visible,
.cookie-consent__customize:hover,
.cookie-consent__customize:focus-visible {
  border-color: rgba(34, 34, 34, 0.35);
}

/* ---------- Vue détaillée ---------- */

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

.cookie-consent__categories {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}

.cookie-consent__category {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  background-color: var(--color-bg-alt);
  border-radius: var(--radius);
}

.cookie-consent__category-info {
  flex: 1;
  min-width: 0;
}

.cookie-consent__category-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-black);
  margin-bottom: 4px;
}

.cookie-consent__category-desc {
  font-size: 0.8125rem;
  line-height: 1.5;
  color: rgba(34, 34, 34, 0.6);
}

/* ---------- Toggle switch ---------- */

.cookie-consent__toggle {
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 24px;
  margin-top: 2px;
}

.cookie-consent__toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.cookie-consent__toggle-track {
  position: absolute;
  inset: 0;
  background-color: rgba(34, 34, 34, 0.15);
  border-radius: 12px;
  cursor: pointer;
  transition: background-color var(--transition);
}

.cookie-consent__toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background-color: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.cookie-consent__toggle input:checked + .cookie-consent__toggle-track {
  background-color: var(--color-primary);
}

.cookie-consent__toggle input:checked + .cookie-consent__toggle-track::after {
  transform: translateX(20px);
}

.cookie-consent__toggle input:disabled + .cookie-consent__toggle-track {
  opacity: 0.5;
  cursor: not-allowed;
}

.cookie-consent__toggle input:focus-visible + .cookie-consent__toggle-track {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Badge "toujours actif" */
.cookie-consent__always-on {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-primary);
  white-space: nowrap;
  margin-top: 6px;
}

/* ---------- Animations ---------- */

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

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

/* ---------- Desktop ---------- */

@media (min-width: 768px) {
  .cookie-consent__inner {
    padding: 24px 80px;
  }

  .cookie-consent__main {
    flex-direction: row;
    align-items: center;
  }

  .cookie-consent__text {
    flex: 1;
  }

  .cookie-consent__actions {
    flex-wrap: nowrap;
  }

  .cookie-consent__categories {
    flex-direction: row;
    gap: 12px;
  }

  .cookie-consent__category {
    flex: 1;
    flex-direction: column;
    align-items: flex-start;
  }

  .cookie-consent__details-actions {
    display: flex;
    justify-content: flex-end;
  }
}
