/* ******************************************************************
   Cuisinez pour Bébé — entête (desktop, mobile et menu mobile)
   Porté du prototype Peinture « CPB Web Site », itération nouveau-header
******************************************************************* */

:root {
  --cpb-green: #15a466;
  --cpb-green-dark: #0e7c4d;
  --cpb-green-tint: #f2f8f4;
  --cpb-orange-app: #ffa500;
  --cpb-orange-app-hover: #e69500;
  --cpb-header-ink: #23272d;
  --cpb-ink: #010906;
  --cpb-nav-gray: #6b7280;
  --cpb-header-border: #efefef;
  --cpb-header-field: #e2e5eb;
  --cpb-display: "Quicksand", sans-serif;
  --cpb-nav-font: "Roboto", sans-serif;
}

#page-header {
  background: #fff;
}

#page-header a {
  text-decoration: none;
}

#page-header button {
  background: none;
  border: none;
  margin: 0;
  cursor: pointer;
}

/* ---------- Entête ---------- */

/* Bascule entête desktop / mobile : sous 1100 px, la ligne desktop ne tient pas avec une recherche utilisable */
.cpb-header-mobile {
  display: none;
}

/* Desktop : header collant, translucide et flouté pour laisser transparaître le contenu au défilement.
   Le flou fait de #page-header le repère des éléments fixes : seul le tiroir l'est, et il est masqué ici. */
@media only screen and (min-width: 1100px) {
  #page-header {
    position: sticky;
    top: 0;
    z-index: 2100;
    background: rgba(255, 255, 255, 0.88);
    -webkit-backdrop-filter: blur(12px) saturate(1.4);
    backdrop-filter: blur(12px) saturate(1.4);
  }

  .admin-bar #page-header {
    top: 32px;
  }
}

@media only screen and (max-width: 1099px) {
  .cpb-header-desktop {
    display: none;
  }

  .cpb-header-mobile {
    display: block;
  }
}

/* La bordure fait toute la largeur, le contenu reprend le conteneur du site (.boxed-wrapper : 1160 px, marges de 40 px) */
.cpb-header-desktop {
  border-bottom: 1px solid var(--cpb-header-border);
}

.cpb-header-row {
  display: flex;
  align-items: center;
  gap: 1.6rem;
  max-width: 1160px;
  margin: 0 auto;
  padding: 1.1rem 40px;
}

/* Marque — icône de l'app + nom du site en vert */
.cpb-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.cpb-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: block;
}

.cpb-mark img {
  width: 100%;
  height: 100%;
  border-radius: 9px;
  display: block;
}

.cpb-brand-name {
  font-family: var(--cpb-display);
  font-weight: 700;
  font-size: 17.5px;
  line-height: 1.12;
  letter-spacing: -0.01em;
  color: var(--cpb-green);
  white-space: nowrap;
}

/* Navigation desktop */
.cpb-nav {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  flex: 0 0 auto;
}

.cpb-nav-item {
  position: relative;
}

#page-header .cpb-nav-link {
  font-family: var(--cpb-nav-font);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--cpb-nav-gray);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0;
  white-space: nowrap;
}

.cpb-nav-link .fa-chevron-down {
  font-size: 10px;
  transition: transform 0.2s ease;
}

#page-header .cpb-nav-link.active,
#page-header .cpb-nav-link:hover,
#page-header .cpb-nav-item.open .cpb-nav-link {
  color: var(--cpb-ink);
}

.cpb-nav-item.open .cpb-nav-link .fa-chevron-down {
  transform: rotate(180deg);
}

/* Menus déroulants — un groupe à gauche, ses liens à droite */
.cpb-dropdown {
  position: absolute;
  top: calc(100% + 18px);
  left: -12px;
  display: flex;
  background: #fff;
  border: 1px solid #ececec;
  border-radius: 14px;
  box-shadow: 0 22px 44px rgba(3, 20, 12, 0.14);
  padding: 6px;
  z-index: 30;
  animation: cpb-dropdown-in 0.16s ease;
}

.cpb-dropdown[hidden] {
  display: none;
}

/* Pont invisible entre le lien et le menu pour ne pas le fermer au survol */
.cpb-dropdown::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -20px;
  height: 20px;
}

@keyframes cpb-dropdown-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.cpb-dropdown-col {
  display: flex;
  flex-direction: column;
  min-width: 245px;
  padding: 4px;
}

.cpb-dropdown-col[hidden] {
  display: none;
}

#page-header .cpb-dropdown-group,
#page-header .cpb-dropdown-sub a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.4rem;
  text-align: left;
  font-family: var(--cpb-nav-font);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--cpb-header-ink);
  padding: 11px 14px;
  border-radius: 9px;
  white-space: nowrap;
}

.cpb-dropdown-group .fa-chevron-right {
  font-size: 11px;
  color: #a0a6ad;
}

#page-header .cpb-dropdown-group.active,
#page-header .cpb-dropdown-group:hover,
#page-header .cpb-dropdown-sub a:hover {
  background: var(--cpb-green-tint);
  color: var(--cpb-green);
}

.cpb-dropdown-group:hover .fa-chevron-right,
.cpb-dropdown-group.active .fa-chevron-right {
  color: var(--cpb-green);
}

.cpb-dropdown-sub {
  border-left: 1px solid #ededed;
  margin-left: 6px;
  padding-left: 6px;
  min-width: 255px;
}

#page-header .cpb-dropdown-sub a {
  white-space: normal;
}

/* Actions à droite — recherche, connexion, abonnement */
.cpb-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  margin-left: auto;
  flex: 1 1 auto;
  min-width: 0;
}

#page-header .cpb-login {
  font-family: var(--cpb-nav-font);
  font-size: 14px;
  font-weight: 500;
  color: var(--cpb-ink);
  white-space: nowrap;
}

#page-header .cpb-login .fa {
  margin-right: 0.3rem;
}

#page-header .cpb-login:hover {
  color: var(--cpb-green);
}

/* Specs : même taille de texte que les autres liens du header, seul bouton coloré */
#page-header .cpb-subscribe {
  display: inline-flex;
  align-items: center;
  background: var(--cpb-orange-app);
  color: #fff;
  font-family: var(--cpb-nav-font);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(255, 165, 0, 0.3);
  white-space: nowrap;
}

#page-header .cpb-subscribe:hover {
  background: var(--cpb-orange-app-hover);
  color: #fff;
}

/* Champ de recherche (desktop et mobile) */
.cpb-search {
  background: #fff;
  border: 1px solid var(--cpb-header-field);
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0 1.1rem;
  width: min(620px, 100%);
}

.cpb-search:focus-within {
  border-color: var(--cpb-green);
}

/* La recherche mobile est rendue dans .page-content (voir header.php) : mêmes réglages qu'à l'intérieur du header */
.cpb-search-row .cpb-search button {
  background: none;
  border: none;
  margin: 0;
  cursor: pointer;
}

#page-header .cpb-search button,
.cpb-search-row .cpb-search button {
  color: #9aa0a6;
  font-size: 17px;
  line-height: 1;
  padding: 0;
}

#page-header .cpb-search button:hover,
.cpb-search-row .cpb-search button:hover {
  color: var(--cpb-green);
}

#page-header .cpb-search input,
.cpb-search-row .cpb-search input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  padding: 0.95rem 0;
  font-family: var(--cpb-nav-font);
  font-size: 17px;
  color: #1c1f24;
}

.cpb-search input::placeholder,
.cpb-search-row .cpb-search input::placeholder {
  color: #9aa0a6;
}

/* Masque la croix native de Chrome / Safari */
.cpb-search input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

/* La recherche rétrécit en premier quand la ligne manque de place, sans descendre sous une largeur utilisable */
.cpb-header-desktop .cpb-search {
  width: auto;
  flex: 0 1 300px;
  min-width: 150px;
  border-color: #e5e7eb;
  border-radius: 12px;
  padding: 0 13px;
  gap: 8px;
}

#page-header .cpb-header-desktop .cpb-search input {
  font-size: 14px;
  line-height: 18px;
  height: auto;
  padding: 9px 0;
}

#page-header .cpb-header-desktop .cpb-search button {
  color: #8b909b;
  font-size: 16px;
}

/* Sous la largeur du conteneur, la marque se réduit à l'icône pour garder une recherche utilisable */
@media only screen and (min-width: 1100px) and (max-width: 1199px) {
  .cpb-header-desktop .cpb-brand-name {
    display: none;
  }
}

/* Entête mobile — marque à gauche sur une ligne, burger à droite */
.cpb-topbar {
  background: #fff;
  color: #1c1f24;
  border-bottom: 1px solid var(--cpb-header-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem clamp(1rem, 4vw, 3rem);
  position: relative;
  z-index: 10;
}

#page-header .cpb-burger {
  color: #111;
  font-size: 22px;
  line-height: 1;
  padding: 8px;
  margin-right: -8px;
}

#page-header .cpb-burger:hover {
  color: var(--cpb-green);
}

.cpb-header-mobile .cpb-mark,
.cpb-drawer-head .cpb-mark {
  width: 44px;
  height: 44px;
}

.cpb-header-mobile .cpb-mark img,
.cpb-drawer-head .cpb-mark img {
  border-radius: 10px;
}

.cpb-header-mobile .cpb-brand-name,
.cpb-drawer-head .cpb-brand-name {
  font-size: 20px;
}

/* Recherche mobile : sans fond propre, elle repose sur le fond de la page */
.cpb-search-row {
  display: flex;
  padding: 0.9rem clamp(1rem, 4vw, 3rem) 1rem;
}

@media only screen and (min-width: 1100px) {
  .cpb-search-row {
    display: none;
  }
}

/* Le plafond de 620 px ne vaut que pour le desktop : sur tablette, la barre s'arrêtait avant le burger */
.cpb-search-row .cpb-search {
  width: 100%;
}

@media only screen and (max-width: 540px) {
  .cpb-topbar {
    padding: 10px 16px;
  }

  .cpb-search-row {
    padding: 14px 16px 18px;
  }

  .cpb-search {
    padding: 0 16px;
  }

  .cpb-search-row .cpb-search button {
    font-size: 18px;
  }
}

/* ---------- Menu mobile (plein écran) ---------- */
/* Pas de voile derrière le tiroir : il couvre tout l'écran, et Safari iOS teintait la barre d'état avec le voile */
.cpb-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  background: #fff;
  z-index: 99999;
  transform: translateX(105%);
  visibility: hidden;
  transition: transform 0.28s ease, visibility 0.28s;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.cpb-drawer.open {
  transform: none;
  visibility: visible;
}

/* Le tiroir n'existe que sous le point de rupture du header */
@media only screen and (min-width: 1100px) {
  .cpb-drawer {
    display: none;
  }
}

.cpb-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 20px;
  border-bottom: 1px solid var(--cpb-header-border);
  flex: 0 0 auto;
}

#page-header .cpb-drawer-close {
  color: #111;
  font-size: 26px;
  line-height: 1;
  padding: 6px;
  margin-right: -10px;
}

#page-header .cpb-drawer-close:hover {
  color: var(--cpb-green);
}

.cpb-drawer > ul {
  list-style: none;
  margin: 0;
  padding: 8px 24px 0;
  flex: 0 0 auto;
}

.cpb-drawer li {
  border-bottom: 1px solid #ececec;
}

.cpb-drawer > ul > li:last-child {
  border-bottom: none;
}

#page-header .cpb-drawer li a,
#page-header .cpb-drawer-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  color: #1a1a1a;
  font-family: var(--cpb-nav-font);
  font-size: 19px;
  font-weight: 400;
  line-height: 1.4;
  padding: 17px 0;
}

#page-header .cpb-drawer li a:hover,
#page-header .cpb-drawer li a.active,
#page-header .cpb-drawer-toggle:hover,
#page-header .cpb-drawer-toggle.active,
#page-header .cpb-drawer-toggle[aria-expanded="true"] {
  color: var(--cpb-green);
}

.cpb-drawer-toggle .fa-chevron-down {
  font-size: 13px;
  color: #8a8f98;
  transition: color 0.15s ease, transform 0.2s ease;
}

.cpb-drawer-toggle[aria-expanded="true"] .fa-chevron-down {
  color: var(--cpb-green);
  transform: rotate(180deg);
}

.cpb-drawer-sub {
  list-style: none;
  margin: 0;
  padding: 0 0 10px;
}

.cpb-drawer-sub[hidden] {
  display: none;
}

.cpb-drawer-sub li {
  border-bottom: none;
}

#page-header .cpb-drawer-sub li a {
  font-size: 16px;
  padding: 11px 0 11px 12px;
  color: #4b5563;
}

.cpb-drawer-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 24px calc(24px + env(safe-area-inset-bottom, 0px));
  flex: 0 0 auto;
}

#page-header .cpb-drawer-subscribe,
#page-header .cpb-drawer-login {
  font-family: var(--cpb-nav-font);
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  padding: 16px;
  border-radius: 22px;
}

#page-header .cpb-drawer-subscribe {
  background: var(--cpb-orange-app);
  color: #fff;
}

#page-header .cpb-drawer-subscribe:hover {
  filter: brightness(0.96);
}

#page-header .cpb-drawer-login {
  background: #fff;
  border: 1px solid var(--cpb-header-field);
  color: #1c1f24;
}

#page-header .cpb-drawer-login:hover {
  border-color: var(--cpb-green);
  color: var(--cpb-green);
}

#page-header .cpb-drawer-register {
  color: var(--cpb-green);
  font-family: var(--cpb-nav-font);
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  padding: 6px 0 2px;
}

/* Responsive Menu Pro injecte son propre burger et son menu : remplacés par le menu mobile du header */
#responsive-menu-pro-button,
#responsive-menu-pro-container,
#responsive-menu-pro-header {
  display: none !important;
}

body.cpb-drawer-open {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .cpb-dropdown,
  .cpb-drawer {
    animation: none;
    transition: none;
  }
}

/* ---------- Entête allégé (connexion, création de compte, mot de passe oublié) ---------- */

.cpb-light-header {
  background: #fff;
  border-bottom: 1px solid #f2ede9;
}

/* Même conteneur que .cpb-header-row : 1160px max, centré, 40px de marge intérieure */
.cpb-light-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 72px;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 40px;
}

.cpb-light-header a {
  text-decoration: none;
}

.cpb-light-header .cpb-mark {
  width: 44px;
  height: 44px;
}

.cpb-light-header .cpb-mark img {
  border-radius: 10px;
}

.cpb-light-header .cpb-brand-name {
  font-size: 20px;
}

.cpb-light-header .cpb-light-back {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  padding: 0 0.5rem;
  margin-right: -0.5rem;
  font-family: "Roboto", sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: #010906;
  white-space: nowrap;
}

.cpb-light-header .cpb-light-back:hover,
.cpb-light-header .cpb-light-back:focus-visible {
  color: var(--cpb-green);
}

.cpb-light-back .fa {
  font-size: 12px;
}

@media only screen and (max-width: 979px) {
  .cpb-light-row {
    height: 64px;
    padding: 0 8px 0 16px;
  }

  .cpb-light-header .cpb-light-back {
    margin-right: 0;
  }

  .cpb-light-header .cpb-mark {
    width: 40px;
    height: 40px;
  }

  .cpb-light-header .cpb-mark img {
    border-radius: 9px;
  }

  .cpb-light-header .cpb-brand-name {
    font-size: 19px;
  }

  .cpb-light-back-extra {
    display: none;
  }
}

@media only screen and (max-width: 359px) {
  .cpb-light-header .cpb-brand-name {
    font-size: 16px;
  }

  .cpb-light-header .cpb-light-back {
    gap: 0.4rem;
    padding: 0 0.25rem;
  }
}
