/* ============================================================
   Consentement aux cookies : bandeau (premier niveau) et panneau "Personnaliser" (second niveau)
   Charge par partials/consent.php sur toutes les pages publiques.
   z-index : bandeau 400 (au-dessus de l'en-tete 100 et du sous-menu 120, sous la bulle de
   l'assistant 500 et son panneau 510) ; panneau modal 900 (sous la visionneuse 1000).
   Boutons de meme taille et de meme style (contour blanc sur fond fonce) : aucun choix n'est mis en avant.
   ============================================================ */

.abo-consent {
  --consent-bg: #0e1831;
  --consent-line: rgba(255,255,255,.18);
  --consent-muted: rgba(255,255,255,.84);
  --consent-accent: var(--blue-cyan, #28C9F9);
  font-family:'Fira Sans', system-ui, sans-serif;
}
.abo-consent [hidden] { display:none !important; }

/* Texte reserve aux lecteurs d'ecran (annonce du choix enregistre) */
.abo-consent-sr { position:absolute; width:1px; height:1px; margin:-1px; padding:0; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0; }

/* --- Textes communs --- */
.abo-consent-title { margin:0 0 .375rem; font-size:1.0625rem; font-weight:800; line-height:1.25; color:#fff; }
.abo-consent-text { margin:0 0 .5rem; color:var(--consent-muted); }
.abo-consent-link { align-self:flex-start; color:var(--consent-accent); font-weight:600; text-decoration:underline; text-underline-offset:2px; }
.abo-consent-link:hover { color:#fff; }
.abo-consent-link:focus-visible { outline:3px solid var(--consent-accent); outline-offset:2px; border-radius:2px; }

/* --- Boutons : meme taille, meme style --- */
.abo-consent-actions { display:grid; grid-template-columns:minmax(0,1fr); gap:.5rem; }
.abo-consent-btn {
  display:inline-flex; align-items:center; justify-content:center; min-width:0; min-height:2.75rem;
  padding:.5rem 1rem; border:2px solid #fff; border-radius:var(--radius-pill, 9999px);
  background:transparent; color:#fff; cursor:pointer;
  font:inherit; font-size:var(--text-sm, .875rem); font-weight:700; line-height:1.2; text-align:center;
  transition:background var(--dur-base, 240ms) var(--ease-tide, ease), color var(--dur-base, 240ms) var(--ease-tide, ease);
  -webkit-tap-highlight-color:transparent;
}
/* Survol reserve aux appareils qui le gerent : pas d'etat "survole" persistant apres un toucher. */
@media (hover:hover) {
  .abo-consent-btn:hover { background:#fff; color:var(--blue-deep, #183383); }
}
.abo-consent-btn:focus-visible { outline:3px solid var(--consent-accent); outline-offset:2px; }
/* Trois colonnes egales des 360 px (le texte d'un bouton passe a la ligne si besoin) ; empiles en dessous. */
@media (min-width:360px) {
  .abo-consent-actions { grid-template-columns:repeat(3, minmax(0,1fr)); }
  .abo-consent-actions--single { grid-template-columns:minmax(0,12rem); justify-content:end; }
}
@media (min-width:360px) and (max-width:479.98px) {
  .abo-consent-btn { padding:.4rem .375rem; font-size:.8125rem; overflow-wrap:anywhere; }
}

/* --- Bandeau : bas de l'ecran, non bloquant --- */
.abo-consent-banner {
  position:fixed; z-index:400; left:0; right:0; bottom:0;
  display:flex; flex-direction:column; gap:.875rem;
  max-height:85vh; overflow-y:auto; overscroll-behavior:contain;
  padding:1rem var(--gutter, 1rem) calc(1rem + env(safe-area-inset-bottom, 0px));
  background:var(--consent-bg); color:#fff;
  border-top:1px solid var(--consent-line); border-radius:1rem 1rem 0 0;
  box-shadow:0 -12px 40px rgba(3,11,48,.28);
  font-size:var(--text-sm, .875rem); line-height:1.5;
}
.abo-consent-banner:focus, .abo-consent-panel:focus { outline:none; }
.abo-consent-banner-copy { display:flex; flex-direction:column; }

/* Tablette et ordinateur : carte en bas a gauche, la bulle de l'assistant (en bas a droite) reste libre. */
@media (min-width:768px) {
  .abo-consent-banner {
    left:calc(1.25rem + env(safe-area-inset-left, 0px)); right:auto; bottom:calc(1.25rem + env(safe-area-inset-bottom, 0px));
    width:min(38rem, calc(100vw - 7.5rem));
    max-height:calc(100vh - 2.5rem - var(--nav-h, 85px));
    padding:1.375rem 1.5rem;
    border:1px solid var(--consent-line); border-radius:1rem;
    box-shadow:0 24px 70px rgba(3,11,48,.35);
  }
}

/* Mobile : le bandeau occupe toute la largeur ; la bulle de l'assistant est masquee tant qu'il est ouvert
   (elle recouvrirait ses boutons). Elle revient des que le choix est fait. */
@media (max-width:767.98px) {
  html.abo-consent-banner-open .abo-chat-bubble { visibility:hidden; }
}
/* Petits ecrans : texte un peu plus compact pour ne pas masquer l'essentiel de la page. */
@media (max-width:479.98px) {
  .abo-consent-banner { gap:.75rem; padding-top:.875rem; font-size:.8125rem; line-height:1.45; }
  .abo-consent-banner .abo-consent-title { font-size:1rem; }
}

/* --- Panneau "Personnaliser" : modal --- */
html.abo-consent-panel-open,
html.abo-consent-panel-open body { overflow:hidden; }

.abo-consent-overlay {
  position:fixed; inset:0; z-index:900;
  display:flex; align-items:flex-end; justify-content:center;
  background:rgba(10,16,34,.62);
}
.abo-consent-panel {
  display:flex; flex-direction:column; width:100%;
  max-height:92vh; max-height:92dvh; overflow:hidden;
  background:var(--consent-bg); color:#fff;
  border-top:1px solid var(--consent-line); border-radius:1rem 1rem 0 0;
  box-shadow:0 -12px 40px rgba(3,11,48,.32);
  font-size:var(--text-sm, .875rem); line-height:1.55;
}
@media (min-width:768px) {
  .abo-consent-overlay { align-items:center; padding:2rem; }
  .abo-consent-panel { width:min(42rem, 100%); max-height:calc(100vh - 4rem); border:1px solid var(--consent-line); border-radius:1rem; box-shadow:0 30px 90px rgba(0,0,0,.38); }
}

.abo-consent-panel-head { flex:0 0 auto; display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:1rem 1.25rem; border-bottom:1px solid var(--consent-line); }
.abo-consent-panel-head .abo-consent-title { margin:0; font-size:1.125rem; }
.abo-consent-close {
  flex:0 0 2.5rem; width:2.5rem; height:2.5rem; display:grid; place-items:center;
  border:1px solid rgba(255,255,255,.55); border-radius:var(--radius-pill, 9999px);
  background:transparent; color:#fff; cursor:pointer;
  transition:background var(--dur-base, 240ms) var(--ease-tide, ease), color var(--dur-base, 240ms) var(--ease-tide, ease);
}
@media (hover:hover) {
  .abo-consent-close:hover { background:#fff; color:var(--blue-deep, #183383); }
}
.abo-consent-close:focus-visible { outline:3px solid var(--consent-accent); outline-offset:2px; }
.abo-consent-close svg { width:1.1rem; height:1.1rem; }

.abo-consent-panel-body { flex:1 1 auto; min-height:0; overflow-y:auto; overscroll-behavior:contain; display:flex; flex-direction:column; gap:1rem; padding:1rem 1.25rem; }
.abo-consent-panel-body .abo-consent-text { margin:0; }

.abo-consent-cat { padding:1rem; border:1px solid var(--consent-line); border-radius:.75rem; background:rgba(255,255,255,.04); }
.abo-consent-cat-head { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:.5rem .75rem; margin-bottom:.5rem; }
.abo-consent-cat-title { margin:0; font-size:1rem; font-weight:800; line-height:1.3; color:#fff; }
.abo-consent-cat-desc { margin:0 0 .75rem; color:var(--consent-muted); }
.abo-consent-cat-desc:last-child { margin-bottom:0; }
.abo-consent-cookies { display:flex; flex-direction:column; gap:.5rem; margin:0; padding:0; list-style:none; }
.abo-consent-cookies li { padding-left:.75rem; border-left:2px solid var(--consent-line); color:var(--consent-muted); overflow-wrap:anywhere; }
.abo-consent-cookies code { padding:.05rem .35rem; border-radius:.3rem; background:rgba(255,255,255,.12); color:#fff; font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size:.8125rem; }
.abo-consent-duration { display:block; color:#fff; font-weight:600; }
.abo-consent-badge { padding:.2rem .65rem; border:1px solid rgba(255,255,255,.55); border-radius:var(--radius-pill, 9999px); font-size:var(--text-xs, .75rem); font-weight:700; letter-spacing:.04em; color:#fff; }

.abo-consent-actions--panel { flex:0 0 auto; padding:1rem 1.25rem calc(1rem + env(safe-area-inset-bottom, 0px)); border-top:1px solid var(--consent-line); }

/* --- Interrupteur : case native (accessible) posee sur un rail dessine --- */
.abo-consent-switch { position:relative; display:inline-flex; align-items:center; gap:.5rem; color:#fff; font-weight:600; cursor:pointer; }
.abo-consent-switch input { position:absolute; left:0; top:50%; width:2.75rem; height:1.5rem; margin:-.75rem 0 0; opacity:0; cursor:pointer; }
.abo-consent-switch-track { position:relative; flex:0 0 2.75rem; width:2.75rem; height:1.5rem; border:2px solid rgba(255,255,255,.8); border-radius:var(--radius-pill, 9999px); background:rgba(255,255,255,.14); transition:background .2s ease, border-color .2s ease; }
.abo-consent-switch-track::after { content:""; position:absolute; top:2px; left:2px; width:1rem; height:1rem; border-radius:50%; background:#fff; transition:transform .2s ease, background .2s ease; }
.abo-consent-switch input:checked + .abo-consent-switch-track { background:var(--consent-accent); border-color:var(--consent-accent); }
.abo-consent-switch input:checked + .abo-consent-switch-track::after { transform:translateX(1.25rem); background:var(--consent-bg); }
.abo-consent-switch input:focus-visible + .abo-consent-switch-track { outline:3px solid #fff; outline-offset:2px; }
.abo-consent-switch input:disabled { cursor:not-allowed; }
.abo-consent-switch:has(input:disabled) { cursor:not-allowed; }
.abo-consent-switch input:disabled + .abo-consent-switch-track { opacity:.7; }

/* --- Bouton "Gerer mes cookies" du pied de page, presente comme les liens voisins --- */
.abo-consent-manage {
  display:inline; margin:0; padding:0; border:0; background:none; cursor:pointer;
  font:inherit; font-size:.875rem; line-height:inherit; color:rgba(255,255,255,.78); text-align:left;
}
.abo-consent-manage:hover { color:#fff; }
.abo-consent-manage:focus-visible { outline:2px solid var(--blue-cyan, #28C9F9); outline-offset:2px; border-radius:2px; color:#fff; }

/* --- Animations, seulement si l'utilisateur les accepte --- */
@media (prefers-reduced-motion: no-preference) {
  .abo-consent-banner:not([hidden]) { animation:abo-consent-in 320ms var(--ease-tide, ease) both; }
  .abo-consent-overlay:not([hidden]) { animation:abo-consent-fade 200ms ease both; }
  .abo-consent-overlay:not([hidden]) .abo-consent-panel { animation:abo-consent-in 280ms var(--ease-tide, ease) both; }
}
@keyframes abo-consent-in { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:none; } }
@keyframes abo-consent-fade { from { opacity:0; } to { opacity:1; } }
@media (prefers-reduced-motion: reduce) {
  .abo-consent-btn, .abo-consent-close, .abo-consent-switch-track, .abo-consent-switch-track::after { transition:none; }
}

@media print {
  .abo-consent-banner, .abo-consent-overlay { display:none !important; }
}
