/**
 * BTV Consent — styles front.
 * Palette BaseballTV : bleu #002866, rouge #cc000a. Dark-aware, accessible.
 */

.btv-consent-noscroll { overflow: hidden; }

/* CRITIQUE : nos conteneurs ont display:flex, ce qui ÉCRASE le comportement
 * natif de l'attribut [hidden] (display:none). Sans cette règle, la barre et
 * surtout la modale (scrim plein écran) restent présentes et interceptent les
 * clics même « cachées ». On force donc display:none quand [hidden] est posé. */
.btv-consent-root[hidden],
.btv-consent-bar[hidden],
.btv-consent-modal[hidden] { display: none !important; }

.btv-consent-root {
  --btv-c-navy: #002866;
  --btv-c-red: #cc000a;
  --btv-c-bg: #ffffff;
  --btv-c-fg: #14263f;
  --btv-c-muted: #5b6b80;
  --btv-c-border: #e2e8f0;
  --btv-c-ghost: #eef2f7;
  --btv-c-radius: 12px;
  --btv-c-shadow: 0 -4px 24px rgba(0, 20, 60, .16);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

/* ---- Bandeau bas ---- */

.btv-consent-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 16px 20px;
  background: var(--btv-c-bg);
  color: var(--btv-c-fg);
  border-top: 3px solid var(--btv-c-red);
  box-shadow: var(--btv-c-shadow);
  animation: btv-c-slideup .3s ease;
}

@keyframes btv-c-slideup {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.btv-consent-bar__text { flex: 1 1 320px; min-width: 0; }
.btv-consent-bar__title { display: block; font-size: 15px; font-weight: 700; color: var(--btv-c-navy); margin-bottom: 2px; }
.btv-consent-bar__body { color: var(--btv-c-muted); }
.btv-consent-bar__link { color: var(--btv-c-navy); text-decoration: underline; white-space: nowrap; }

.btv-consent-bar__actions { display: flex; gap: 8px; flex-wrap: wrap; flex-shrink: 0; }

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

.btv-consent-btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease, opacity .12s ease;
  font-family: inherit;
}
.btv-consent-btn:hover { transform: translateY(-1px); }
.btv-consent-btn:focus-visible { outline: 3px solid rgba(0, 40, 102, .35); outline-offset: 2px; }

.btv-consent-btn--accept { background: var(--btv-c-navy); color: #fff; }
.btv-consent-btn--accept:hover { background: #013a8f; }
.btv-consent-btn--reject { background: var(--btv-c-ghost); color: var(--btv-c-fg); }
.btv-consent-btn--ghost { background: transparent; color: var(--btv-c-navy); border-color: var(--btv-c-border); }

/* ---- Modale ---- */

.btv-consent-modal {
  position: fixed; inset: 0; z-index: 2147483100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.btv-consent-modal__scrim { position: absolute; inset: 0; background: rgba(4, 14, 30, .55); backdrop-filter: blur(2px); }
.btv-consent-modal__panel {
  position: relative;
  width: 100%; max-width: 560px;
  max-height: 88vh; overflow-y: auto;
  background: var(--btv-c-bg); color: var(--btv-c-fg);
  border-radius: var(--btv-c-radius);
  box-shadow: 0 24px 64px rgba(0, 10, 40, .4);
  animation: btv-c-pop .22s ease;
}
@keyframes btv-c-pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.btv-consent-modal__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 22px 8px;
}
.btv-consent-modal__title { margin: 0; font-size: 19px; font-weight: 800; color: var(--btv-c-navy); }
.btv-consent-modal__x {
  appearance: none; background: none; border: none; cursor: pointer;
  font-size: 26px; line-height: 1; color: var(--btv-c-muted); padding: 4px 8px;
}
.btv-consent-modal__intro { margin: 0 22px 12px; color: var(--btv-c-muted); }

.btv-consent-cats { padding: 0 22px; }
.btv-consent-cat { padding: 14px 0; border-top: 1px solid var(--btv-c-border); }
.btv-consent-cat:first-child { border-top: none; }
.btv-consent-cat__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.btv-consent-cat__name { font-weight: 700; color: var(--btv-c-fg); }
.btv-consent-cat__locked { font-size: 12px; font-weight: 700; color: var(--btv-c-navy); background: var(--btv-c-ghost); padding: 3px 10px; border-radius: 20px; }
.btv-consent-cat__desc { margin: 6px 0 0; color: var(--btv-c-muted); font-size: 13px; }

.btv-consent-modal__actions {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end;
  padding: 16px 22px 22px; margin-top: 8px;
  position: sticky; bottom: 0; background: var(--btv-c-bg); border-top: 1px solid var(--btv-c-border);
}

/* ---- Switch ---- */

.btv-consent-switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.btv-consent-switch input { opacity: 0; width: 0; height: 0; }
.btv-consent-switch__slider {
  position: absolute; inset: 0; cursor: pointer;
  background: #c3ccd8; border-radius: 26px; transition: background .2s;
}
.btv-consent-switch__slider::before {
  content: ""; position: absolute; height: 20px; width: 20px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform .2s;
}
.btv-consent-switch input:checked + .btv-consent-switch__slider { background: var(--btv-c-navy); }
.btv-consent-switch input:checked + .btv-consent-switch__slider::before { transform: translateX(20px); }
.btv-consent-switch input:focus-visible + .btv-consent-switch__slider { outline: 3px solid rgba(0, 40, 102, .35); outline-offset: 2px; }

/* ---- Lien « Gérer mes cookies » ---- */

.btv-consent-manage-link {
  appearance: none; background: none; border: none; cursor: pointer;
  color: var(--btv-c-navy); text-decoration: underline; font: inherit; padding: 0;
}

/* ---- Placeholder d'embed bloqué ---- */

.btv-embed-block {
  position: relative; width: 100%; margin: 1em 0;
  aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden;
  background: #0a1a33;
}
.btv-embed-block__inner {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center;
}
.btv-embed-block__scrim { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(2,12,28,.6), rgba(2,12,28,.82)); }
.btv-embed-block__box { position: relative; text-align: center; color: #fff; padding: 22px; max-width: 440px; }
.btv-embed-block__icon svg { width: 48px; height: 48px; opacity: .95; margin-bottom: 8px; }
.btv-embed-block__title { font-size: 16px; font-weight: 800; margin: 0 0 4px; }
.btv-embed-block__body { font-size: 13px; opacity: .85; margin: 0 0 14px; }
.btv-embed-block__actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.btv-embed-block__load, .btv-embed-block__always {
  appearance: none; cursor: pointer; border-radius: 8px; padding: 9px 16px;
  font-size: 13px; font-weight: 700; font-family: inherit; border: 1px solid transparent;
}
.btv-embed-block__load { background: var(--btv-c-red, #cc000a); color: #fff; }
.btv-embed-block__always { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.btv-embed-restored { margin: 1em 0; }

/* ---- Politique cookies ---- */

.btv-cookie-policy__table { width: 100%; border-collapse: collapse; margin: 8px 0 4px; }
.btv-cookie-policy__table th, .btv-cookie-policy__table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--btv-c-border, #e2e8f0); font-size: 13px; }

/* ---- Mobile ---- */

@media (max-width: 600px) {
  .btv-consent-bar { flex-direction: column; align-items: stretch; gap: 12px; }
  .btv-consent-bar__actions { justify-content: stretch; }
  .btv-consent-bar__actions .btv-consent-btn { flex: 1 1 auto; }
}

/* ---- Dark mode ---- */

@media (prefers-color-scheme: dark) {
  .btv-consent-root {
    --btv-c-bg: #0f1b2e;
    --btv-c-fg: #e6edf6;
    --btv-c-muted: #9fb0c6;
    --btv-c-border: #24344b;
    --btv-c-ghost: #1b2a41;
    --btv-c-navy: #4d8bff;
    --btv-c-shadow: 0 -4px 24px rgba(0, 0, 0, .5);
  }
  .btv-consent-bar__title, .btv-consent-bar__link, .btv-consent-modal__title { color: #7db0ff; }
  .btv-consent-btn--accept { background: #1e5bd6; }
  .btv-consent-switch input:checked + .btv-consent-switch__slider { background: #1e5bd6; }
}

/* ---- Respect reduced motion ---- */

@media (prefers-reduced-motion: reduce) {
  .btv-consent-bar, .btv-consent-modal__panel { animation: none; }
  .btv-consent-btn:hover { transform: none; }
}
