/* =========================================================
   RezepteChef Child 1.0.5 — Bannière cookies Complianz (7.5.x)
   Chargé uniquement quand Complianz est actif.
   Complianz peut injecter sa feuille APRÈS celle-ci (par JavaScript) :
   les règles ci-dessous gagnent donc par leur priorité (« html body … »),
   jamais par l'ordre de chargement.

   Corrige (constaté en simulation avec le CSS d'origine de Complianz 7.5.5) :
   1. Mobile en paysage (hauteur ≤ 500 px) : Complianz réduit la bannière
      (zoom 0,6) et les boutons (zoom 0,5) → boutons de 18 px de haut et croix
      de 7 px, presque impossibles à toucher.
   2. Position « En bas » sur tablette/ordinateur : 3e bouton coupé à 1024 px,
      boutons étirés à 95–167 px de haut.
   3. Texte en 12 px, peu lisible sur mobile ; police différente du site.
   4. iPhone/Android : hauteur d'écran réelle (barre du navigateur) et zone
      de la barre d'accueil (« safe area ») non prises en compte.
   Couleurs : celles du site (orange/brun), contraste AA respecté ;
   « Ablehnen » a la même taille que « Akzeptieren ».
   ========================================================= */

/* ---------- Couleurs, police, tailles (toutes tailles d'écran) ---------- */
html body .cmplz-cookiebanner,
html body #cmplz-manage-consent {
  --cmplz_banner_background_color: #ffffff;
  --cmplz_banner_border_color: rgba(31, 20, 15, 0.10);
  --cmplz_banner_border_radius: 18px;
  --cmplz_text_color: #1f140f;
  --cmplz_hyperlink_color: #1f140f;
  --cmplz_title_font_size: 16px;
  --cmplz_text_font_size: 14px;
  --cmplz_text_line_height: 1.55;
  --cmplz_link_font_size: 13px;
  --cmplz_category_body_font_size: 13px;
  --cmplz_category_header_title_font_size: 15px;
  --cmplz_category_header_active_font_size: 13px;
  --cmplz_category_header_always_active_color: #2f7d32;
  --cmplz_button_font_size: 15px;
  --cmplz_button_border_radius: 999px;
  --cmplz_button_accept_background_color: #c84714;   /* blanc sur ce fond : 4,8:1 */
  --cmplz_button_accept_border_color: #c84714;
  --cmplz_button_accept_text_color: #ffffff;
  --cmplz_button_deny_background_color: #ffffff;
  --cmplz_button_deny_border_color: #1f140f;
  --cmplz_button_deny_text_color: #1f140f;
  --cmplz_button_settings_background_color: #fff3ef;
  --cmplz_button_settings_border_color: #f1d9cf;
  --cmplz_button_settings_text_color: #1f140f;
  --cmplz_slider_active_color: #c84714;
  font-family: inherit;
}

html body .cmplz-cookiebanner {
  box-shadow: 0 18px 50px rgba(31, 20, 15, 0.18);
}

html body .cmplz-cookiebanner .cmplz-title {
  font-weight: 800;
}

html body .cmplz-cookiebanner .cmplz-buttons .cmplz-btn {
  font-family: inherit;
  font-weight: 700;
  line-height: 1.2;
  text-transform: none;
  letter-spacing: 0;
  border-width: 2px;
  border-style: solid;
  box-shadow: none;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

html body .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-accept:hover {
  background-color: #b93f0f;
  border-color: #b93f0f;
  color: #ffffff;
}

html body .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-deny:hover,
html body .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-view-preferences:hover,
html body .cmplz-cookiebanner .cmplz-buttons .cmplz-btn.cmplz-save-preferences:hover {
  background-color: #fbe6dd;
  color: #1f140f;
}

html body .cmplz-cookiebanner .cmplz-btn:focus-visible,
html body .cmplz-cookiebanner .cmplz-close:focus-visible,
html body .cmplz-cookiebanner .cmplz-link:focus-visible,
html body .cmplz-cookiebanner .cmplz-category-toggle:focus-visible,
html body #cmplz-manage-consent .cmplz-manage-consent:focus-visible {
  outline: 3px solid #1f140f;
  outline-offset: 2px;
}

/* Croix de fermeture : zone de toucher de 32 px */
html body .cmplz-cookiebanner .cmplz-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

html body .cmplz-cookiebanner .cmplz-close svg {
  width: 18px;
  height: 18px;
}

html body .cmplz-cookiebanner .cmplz-documents a,
html body .cmplz-cookiebanner .cmplz-information a {
  text-underline-offset: 2px;
}

/* Bouton « Zustimmung verwalten » (après le choix) */
html body #cmplz-manage-consent .cmplz-manage-consent {
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(31, 20, 15, 0.12);
}

/* ---------- Mobile et petite tablette (≤ 767 px) ---------- */
@media (max-width: 767px) {
  /* Toutes positions (y compris « Centre ») : en bas d'écran, à portée du pouce */
  html body .cmplz-cookiebanner {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    transform: none;
    width: 100%;
    max-width: 100%;
    border-radius: 18px 18px 0 0;
    padding: 14px 16px 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    max-height: calc(100vh - 12px);
    max-height: calc(100dvh - 12px);
  }

  html body .cmplz-cookiebanner .cmplz-header .cmplz-title {
    display: block;
    font-size: 15px;
  }

  /* Le texte défile si besoin ; les boutons restent toujours visibles */
  html body .cmplz-cookiebanner .cmplz-body {
    max-height: 34vh;
    max-height: 34dvh;
  }

  html body .cmplz-cookiebanner .cmplz-buttons {
    flex-direction: column;
    gap: 8px;
  }

  html body .cmplz-cookiebanner .cmplz-buttons .cmplz-btn {
    width: 100%;
    min-height: 46px;
    height: auto;
    padding: 10px 14px;
  }

  html body .cmplz-cookiebanner .cmplz-links.cmplz-documents ul {
    flex-wrap: wrap;
    justify-content: center;
    row-gap: 4px;
  }

  html body #cmplz-manage-consent .cmplz-manage-consent {
    right: 16px;
  }
}

/* ---------- Mobile en paysage / écrans peu hauts (≤ 500 px de haut) ----------
   Annule le « zoom » de Complianz et garde des boutons de taille normale,
   côte à côte, avec le texte qui défile au-dessus. */
@media (max-height: 500px) and (orientation: landscape) {
  html body .cmplz-cookiebanner,
  html body .cmplz-cookiebanner .cmplz-close,
  html body .cmplz-cookiebanner .cmplz-buttons .cmplz-btn,
  html body .cmplz-cookiebanner .cmplz-documents,
  html body .cmplz-cookiebanner .cmplz-information {
    zoom: 1 !important;
  }

  html body .cmplz-cookiebanner {
    display: flex;
    flex-direction: column;
    gap: 8px;
    top: auto;
    bottom: 0;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(760px, 100%);
    min-width: 0;
    height: auto !important;
    max-height: calc(100vh - 8px);
    max-height: calc(100dvh - 8px);
    padding: 10px 18px 12px !important;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important;
    padding-left: calc(18px + env(safe-area-inset-left, 0px)) !important;
    padding-right: calc(18px + env(safe-area-inset-right, 0px)) !important;
    border-radius: 18px 18px 0 0;
    overflow: hidden;
  }

  html body .cmplz-cookiebanner .cmplz-header {
    max-height: none !important;
    margin-bottom: 0 !important;
  }

  html body .cmplz-cookiebanner .cmplz-header .cmplz-title {
    display: block;
  }

  html body .cmplz-cookiebanner .cmplz-body {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    margin-top: 0 !important;
    overflow-y: auto;
  }

  html body .cmplz-cookiebanner .cmplz-message,
  html body .cmplz-cookiebanner .cmplz-categories {
    width: auto;
  }

  html body .cmplz-cookiebanner .cmplz-buttons {
    flex-direction: row !important;
    gap: 8px !important;
  }

  html body .cmplz-cookiebanner .cmplz-buttons .cmplz-btn {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    height: auto !important;
    min-height: 44px !important;
    padding: 8px 10px !important;
    font-size: 14px !important;
    line-height: 1.2 !important;
    white-space: normal !important;
  }

  html body .cmplz-cookiebanner .cmplz-divider {
    display: none;
  }
}

/* ---------- Position « En bas » : tablette et ordinateur (≥ 1024 px) ---------- */
@media (min-width: 1024px) {
  html body .cmplz-cookiebanner.cmplz-bottom {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 28px;
    padding: 18px 28px;
  }

  html body .cmplz-cookiebanner.cmplz-bottom .cmplz-header,
  html body .cmplz-cookiebanner.cmplz-bottom .cmplz-divider {
    grid-column: 1 / -1;
  }

  html body .cmplz-cookiebanner.cmplz-bottom .cmplz-body {
    grid-column: 1;
    grid-row: 3;
  }

  html body .cmplz-cookiebanner.cmplz-bottom .cmplz-buttons {
    grid-column: 2;
    grid-row: 3;
    align-self: center;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  html body .cmplz-cookiebanner.cmplz-bottom .cmplz-buttons .cmplz-btn {
    width: auto;
    min-width: 170px;
    height: auto;
    min-height: 46px;
    padding: 10px 22px;
    white-space: nowrap;
  }

  html body .cmplz-cookiebanner.cmplz-bottom.cmplz-categories-visible .cmplz-buttons {
    flex-direction: column;
  }

  html body .cmplz-cookiebanner.cmplz-bottom .cmplz-links.cmplz-documents {
    grid-column: 1 / -1;
    grid-row: 5;
  }

  html body .cmplz-cookiebanner.cmplz-bottom.optin .cmplz-categories,
  html body .cmplz-cookiebanner.cmplz-bottom.optout .cmplz-categories {
    width: auto;
    max-width: 100%;
  }
}

/* ---------- 1.0.6 — Bouton « Einwilligung verwalten » visible sur mobile ----------
   Équivaut au réglage Complianz « Hover on Desktop – Show on Mobile » :
   - ordinateur (> 768 px) : comportement Complianz inchangé (languette qui
     monte au survol) ;
   - mobile/tablette (≤ 768 px) : bouton entièrement visible après le choix du
     visiteur, pour pouvoir retirer son consentement aussi facilement qu'il l'a
     donné (RGPD art. 7 § 3).
   Le bouton reste caché tant que la bannière est ouverte (classe
   « cmplz-dismissed ») et avant le chargement de Complianz (« cmplz-hidden »). */
@media (max-width: 768px) {
  html body #cmplz-manage-consent .cmplz-manage-consent:not(.cmplz-dismissed):not(.cmplz-hidden) {
    display: block;
    animation: none;
    bottom: 0;
    bottom: env(safe-area-inset-bottom, 0px);
    right: 16px;
    height: auto;
    min-width: 0;
    min-height: 40px;
    padding: 10px 16px;
    font-size: 13px;
    line-height: 1.2;
    border-bottom-width: 0;
  }
}
