/* ════════════════════════════════════════════════════════════════════
   BTM Cookie Banner — thème BadgeTaMere
   Tokens : #1c1b2e fond · #ff6b4a corail · #ffbcab pêche
            #4e7364 vert · #b8edd8 menthe · #fff9f5 fond clair
   Hard-shadow style identique au thème (3-4px offset, 0 blur)
   ════════════════════════════════════════════════════════════════════ */

/* ── Bannière principale ─────────────────────────────────────────── */

.btm-banner {
  position: fixed;
  bottom: 1.75rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  width: min(660px, calc(100vw - 2rem));
  font-family: "DM Sans", sans-serif;
  font-size: 0.9rem;
  line-height: 1.55;
  /* Entrance animation */
  transition:
    opacity 0.32s ease,
    transform 0.32s ease;
}

/* Initial state when animating in (JS adds .btm-banner--animating first) */
.btm-banner--animating {
  opacity: 0;
  transform: translateX(-50%) translateY(18px);
}

/* Visible state — JS adds this one frame later to trigger transition */
.btm-banner--animating.btm-banner--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.btm-banner[hidden] {
  display: none !important;
}

.btm-banner__box {
  background: #1c1b2e;
  border: 2px solid #ff6b4a;
  border-radius: 20px;
  box-shadow: 5px 5px 0 #ff6b4a;
  padding: 1.5rem 1.75rem 1.25rem;
  color: #fff;
}

/* ── En-tête ─────────────────────────────────────────────────────── */

.btm-banner__header {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.65rem;
}

.btm-banner__icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}

.btm-banner__title {
  font-family: "Baloo 2", sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  color: #ffbcab;
  margin: 0;
  line-height: 1.15;
}

.btm-banner__text {
  margin: 0 0 1.1rem;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.85rem;
  line-height: 1.6;
}

.btm-banner__text a {
  color: #ff6b4a;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.btm-banner__text a:hover {
  color: #ffbcab;
}

/* ── Actions (boutons principaux) ───────────────────────────────── */

.btm-banner__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.btm-banner__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.3rem;
  border-radius: 50px;
  font-family: "DM Sans", sans-serif;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid transparent;
  transition:
    transform 0.15s,
    box-shadow 0.15s,
    background 0.15s,
    color 0.15s;
  white-space: nowrap;
  text-decoration: none;
}

/* Tout accepter — pêche + hard shadow corail */
.btm-banner__btn--accept {
  background: #ffbcab;
  color: #1c1b2e;
  border-color: #ff6b4a;
  box-shadow: 3px 3px 0 #ff6b4a;
}
.btm-banner__btn--accept:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 #ff6b4a;
}

/* Tout refuser — transparent, bordure blanche */
.btm-banner__btn--refuse {
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: 3px 3px 0 rgba(255, 255, 255, 0.1);
}
.btm-banner__btn--refuse:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.6);
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 rgba(255, 255, 255, 0.15);
}

/* Personnaliser — lien discret */
.btm-banner__btn--custom {
  background: transparent;
  color: rgba(255, 255, 255, 0.45);
  border-color: transparent;
  box-shadow: none;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}
.btm-banner__btn--custom:hover {
  color: #fff;
  transform: none;
  box-shadow: none;
}

/* ── Bouton enregistrer les choix ───────────────────────────────── */

.btm-banner__save {
  margin-top: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.85rem;
}

.btm-banner__save[hidden] {
  display: none !important;
}

/* Btn vert menthe — identique à .btn-ink-green du thème */
.btm-banner__btn--save {
  background: #1c1b2e;
  color: #b8edd8;
  border: 2px solid #4e7364;
  border-radius: 50px;
  box-shadow: 3px 3px 0 #4e7364;
  width: 100%;
  font-family: "DM Sans", sans-serif;
  font-size: 0.84rem;
  font-weight: 700;
  padding: 0.6rem 1.3rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
}
.btm-banner__btn--save:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 #4e7364;
  color: #b8edd8;
}

/* ── Panneau de personnalisation ────────────────────────────────── */

.btm-banner__details {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 48vh;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 107, 74, 0.35) transparent;
}

.btm-banner__details::-webkit-scrollbar {
  width: 3px;
}
.btm-banner__details::-webkit-scrollbar-thumb {
  background: rgba(255, 107, 74, 0.4);
  border-radius: 2px;
}

.btm-banner__details[hidden] {
  display: none !important;
}

/* ── Carte catégorie ─────────────────────────────────────────────── */

.btm-banner__cat {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  overflow: hidden;
}

.btm-banner__cat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.7rem 0.9rem;
}

/* Collapsible toggle button */
.btm-banner__cat-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex: 1;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  min-width: 0;
}

.btm-banner__cat-name {
  font-family: "Baloo 2", sans-serif;
  font-size: 0.88rem;
  font-weight: 800;
  color: #ffbcab;
  flex: 1;
  min-width: 0;
}

.btm-banner__cat-chevron {
  font-size: 1rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.4);
  line-height: 1;
  flex-shrink: 0;
  transition:
    transform 0.25s ease,
    color 0.2s;
  margin-right: 0.4rem;
  display: inline-block;
}

.btm-banner__cat.open .btm-banner__cat-chevron {
  transform: rotate(45deg);
  color: #ff6b4a;
}

.btm-banner__always-on {
  font-size: 0.7rem;
  font-weight: 700;
  color: #b8edd8;
  background: rgba(78, 115, 100, 0.22);
  border: 1px solid rgba(78, 115, 100, 0.45);
  padding: 0.12rem 0.6rem;
  border-radius: 50px;
  white-space: nowrap;
  letter-spacing: 0.3px;
}

/* Collapsible body */
.btm-banner__cat-body {
  max-height: 0;
  overflow: hidden;
  transition:
    max-height 0.3s ease,
    padding 0.3s ease;
}

.btm-banner__cat.open .btm-banner__cat-body {
  max-height: 600px;
}

.btm-banner__cat-desc {
  font-size: 0.76rem;
  color: rgba(255, 255, 255, 0.42);
  margin: 0;
  line-height: 1.5;
  padding: 0.1rem 0.9rem 0.65rem;
}

/* ── Individual cookie rows ──────────────────────────────────── */

.btm-banner__cookies {
  display: flex;
  flex-direction: column;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.btm-banner__cookie-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(0, 0, 0, 0.15);
  transition: background 0.15s;
}

.btm-banner__cookie-row:last-child {
  border-bottom: none;
}

.btm-banner__cookie-row:hover {
  background: rgba(255, 107, 74, 0.06);
}

.btm-banner__cookie-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  min-width: 0;
}

.btm-banner__cookie-name {
  font-family: "Courier New", monospace;
  font-size: 0.72rem;
  font-weight: 700;
  color: #ffbcab;
  background: rgba(255, 188, 171, 0.12);
  border: 1px solid rgba(255, 188, 171, 0.2);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btm-banner__cookie-provider {
  font-size: 0.68rem;
  font-weight: 700;
  color: #ff6b4a;
  letter-spacing: 0.2px;
}

.btm-banner__cookie-purpose {
  font-size: 0.69rem;
  color: rgba(255, 255, 255, 0.38);
  margin: 0;
  line-height: 1.4;
}

.btm-banner__cookie-duration {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.25);
  font-style: italic;
}

/* ── Toggle switch ───────────────────────────────────────────────── */

.btm-toggle {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

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

.btm-toggle__track {
  display: block;
  width: 42px;
  height: 24px;
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.18);
  position: relative;
  transition:
    background 0.22s,
    border-color 0.22s,
    box-shadow 0.22s;
}

.btm-toggle__track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  transition:
    left 0.22s,
    background 0.22s;
}

.btm-toggle input:checked + .btm-toggle__track {
  background: #ff6b4a;
  border-color: #ff6b4a;
  box-shadow: 2px 2px 0 rgba(255, 107, 74, 0.4);
}

.btm-toggle input:checked + .btm-toggle__track::after {
  left: 18px;
  background: #fff;
}

.btm-toggle input:focus-visible + .btm-toggle__track {
  outline: 2px solid #ffbcab;
  outline-offset: 2px;
}

/* Small variant */
.btm-toggle--sm .btm-toggle__track {
  width: 32px;
  height: 18px;
}
.btm-toggle--sm .btm-toggle__track::after {
  width: 10px;
  height: 10px;
  top: 2px;
  left: 2px;
}
.btm-toggle--sm input:checked + .btm-toggle__track::after {
  left: 14px;
}

/* ── Bouton rouvrir (coin bas-gauche) ───────────────────────────── */

.btm-reopen {
  position: fixed;
  bottom: 1.25rem;
  left: 1.25rem;
  z-index: 99998;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #1c1b2e;
  border: 2px solid #ff6b4a;
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 3px 3px 0 #ff6b4a;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
  line-height: 1;
}

.btm-reopen[hidden] {
  display: none !important;
}

.btm-reopen:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 #ff6b4a;
}

/* ── Responsive ─────────────────────────────────────────────────── */

@media (max-width: 500px) {
  .btm-banner {
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
  }

  /* Mobile: slide up from bottom edge */
  .btm-banner--animating {
    opacity: 0;
    transform: translateY(24px);
  }

  .btm-banner--animating.btm-banner--visible {
    opacity: 1;
    transform: translateY(0);
  }

  .btm-banner__box {
    border-radius: 18px 18px 0 0;
    border-bottom: none;
    box-shadow: 0 -3px 0 #ff6b4a;
    padding: 1.25rem 1.25rem 1.5rem;
  }

  .btm-banner__details {
    max-height: 42vh;
  }

  .btm-banner__actions {
    flex-direction: column;
  }

  .btm-banner__btn--custom {
    text-align: center;
  }
}

/* ── Force display (thème compatibility) ───────────────────── */
/* Prevents themes from hiding the banner or reopen button          */

.btm-banner:not([hidden]) {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.btm-reopen:not([hidden]) {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* ── Overlay bloquant (premier consentement) ─────────────────────── */

.btm-overlay {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 99998;
  background: rgba(15, 14, 30, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  pointer-events: all;
  cursor: not-allowed;
  touch-action: none;
}

.btm-overlay[hidden] {
  display: none !important;
  pointer-events: none;
}
