:root {
  --bleu: #023a66;
  --ombre: 0 3px 10px rgba(0, 0, 0, 0.08), 3px 0 10px rgba(0, 0, 0, 0.04);
}

#pastille svg {
  width: 3rem;
  height: 3rem;
  fill: white;
}

#pastille .count {
  position: relative;
  top: -0.75rem;
  left: -0.5rem;
}

/* Pastille compteur */
#pastille {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}
#pastille .count {
  display: inline-flex;
  min-width: 1.25rem;
  height: 1.25rem;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.75rem;
  align-items: center;
  justify-content: center;
  padding: 0 0.25rem;
}

/* ================= Modales communes ================= */
.modal,
.modal-cart {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100000;
  overflow: hidden; /* ⬅️ pas de scroll sur l'overlay */
}
.modal.active,
.modal-cart.active {
  display: flex;
}

/* Modal image */
.modal .imgbox {
  background: #fff;
  padding: 0.5rem;
  border-radius: 0.5rem;
  max-width: 700px;
  max-height: 700px;
}
.modal .imgbox img {
  display: block;
  max-width: 100%;
  max-height: 680px;
}
.modal .close,
.modal-cart .close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #fff;
  border: 0;
  border-radius: 0.35rem;
  padding: 0.35rem 0.5rem;
  cursor: pointer;
}

/* ================= Panel panier (le SEUL conteneur scrollable) ================= */
.modal-cart .panel {
  background: #fff;
  border-radius: 0.6rem;
  box-shadow: var(--ombre);
  width: min(900px, 100%);
  max-width: 100%;
  display: flex;
  flex-direction: column;
  margin: auto;
  max-height: calc(100dvh - 2rem); /* ⬅️ la hauteur max visible */
  overflow: auto; /* ⬅️ le scroll se fait ici */
  -webkit-overflow-scrolling: touch;
}

/* Header (reste visible pendant le scroll du panel) */
.modal-cart .header {
  background: var(--bleu);
  color: #fff;
  padding: 1rem 1.25rem;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 2;
}

@media (min-width: 600px) {
  .modal-cart .header h2 {
    border-radius: 0.6rem 0.6rem 0 0;
  }
}

/* Corps : dans le flux, pas de scroll interne */
.modal-cart .body {
  padding: 1rem 1.25rem;
  flex: 0 0 auto; /* pas d’étirement */
  overflow: visible; /* pas de scroll interne */
}

/* Items */
.modal-cart .item {
  display: flex;
  flex-direction: column;
  grid-template-columns: 72px 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px dashed #e5e7eb;
  margin: 1rem 0;
}

@media (min-width: 600px) {
  .modal-cart .item {
    display: grid;
    margin: 0;
  }
}

.modal-cart .item img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 0.4rem;
}
.modal-cart .item h4 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}
.modal-cart .controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.modal-cart .controls .qty {
  min-width: 2rem;
  text-align: center;
  padding: 0.25rem 0.35rem;
  background: #f1f5f9;
  border-radius: 0.35rem;
}

/* Footer (reste visible en bas du panel lors du scroll) */
.modal-cart .footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid #e5e7eb;
  display: grid;
  gap: 0.75rem;
  background: #fff;
  bottom: 0;
  z-index: 2;
  box-shadow: 0 -1px 1px rgba(0, 0, 0, 0.08);
}

/* Champs */
.modal-cart .field {
  display: grid;
  gap: 0.25rem;
}
.modal-cart input[type="email"],
.modal-cart input[type="tel"],
.modal-cart textarea {
  width: 100%;
  padding: 0.6rem 0.65rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.4rem;
}
.modal-cart label {
  font-weight: 600;
}
.modal-cart .row {
  display: grid;
  gap: 0.75rem;
}
@media (min-width: 700px) {
  .modal-cart .row {
    grid-template-columns: 1fr 1fr;
  }
}

/* Notices */
.notice {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  background: #065f46;
  color: #ecfdf5;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  display: none;
  z-index: 1100;
}
.notice.show {
  display: block;
}

/* ================ Mobile =================
   Panel plein écran et scrollable, overlay non scrollable */
@media (max-width: 700px) {
  .modal-cart {
    align-items: stretch;
    padding: 0;
  } /* pas d’espace autour */
  .modal-cart .panel {
    width: 100%;
    max-width: 100%;
    border-radius: 0; /* bord à bord */
    max-height: 100dvh; /* hauteur écran */
    overflow: auto; /* toujours le panel qui scrolle */
  }
  .modal-cart .body {
    flex: 0 0 auto;
    overflow: visible;
  }
}

/* Bloquer le scroll du fond quand la modale est ouverte */
html.modal-open,
body.modal-open {
  overflow: hidden;
}

/* ================= Mise en page catégorie de pièces ================= */
.pieces-topbar {
  background: var(--bleu);
  color: #fff;
  padding: 0.75rem 1rem;
}
.pieces-topbar .wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.pieces-topbar a.btn-back {
  background: #fff;
  color: var(--bleu);
  padding: 0.5rem 0.75rem;
  border-radius: 0.4rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  font-weight: 600;
}
.pieces-topbar h1 {
  flex: 1;
  text-align: center;
  margin: 0;
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
}

.grid-pieces {
  display: grid;
  gap: 1rem;
  padding: 1rem;
}
@media (min-width: 600px) {
  .grid-pieces {
    grid-template-columns: 1fr;
  }
}

.card-piece {
  box-shadow: var(--ombre);
  padding: 0.75rem;
  border-radius: 0.5rem;
  background: #fff;
}
.card-piece .media {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}
@media (min-width: 600px) {
  .card-piece .media {
    justify-content: flex-start;
  }
}
.card-piece .media img {
  width: 140px;
  max-width: 100%;
  height: auto;
  border-radius: 0.35rem;
  cursor: zoom-in;
}
.card-piece h2 {
  margin: 0.5rem 0 0.25rem;
  font-size: 1.1rem;
}
.card-piece .ref {
  font-weight: 300;
  opacity: 0.9;
  margin-bottom: 0.5rem;
}
.card-piece .desc {
  margin-bottom: 0.75rem;
}
.card-piece .actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.etiquette {
  display: inline-block;
  border: 1px solid #ddd;
  border-left: 6px solid var(--bleu);
  padding: 0.35rem 0.6rem;
  border-radius: 0.35rem;
  background: #f7f9fc;
  font-weight: 600;
}
.btn {
  appearance: none;
  border: 0;
  border-radius: 0.4rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
}
.btn-primary {
  background: var(--bleu);
  color: #fff;
  font-weight: 700;
}
.btn-ghost {
  background: #f1f5f9;
  color: #111;
}

#ocadeSearchForm {
  position: relative !important;
}

/** Le button sera la loupe et le input search devra atre placé sous la loupe quand on clique dessus **/
#ocadeSearchForm input#recherche {
  position: absolute !important;
  top: calc(100% + 16px);
  right: 0;
  width: 300px;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
  z-index: 999999999;
}

#ocadeSearchForm input#recherche.active {
  opacity: 1;
}

.wp-block-ocade-blocks-header-2-lignes
  > .wp-block-columns
  .wp-block-column
  form {
  min-width: 50px !important;
}

.wp-block-ocade-blocks-header-2-lignes>.wp-block-columns .wp-block-column form {
    margin-left: 0 !important;
}

#ocadeSearchForm button {
    border: none !important;
    box-shadow: none !important;
}

#ocadeSearchForm button span {
    width: 2rem;
    height: 2rem;
    font-size: 2rem;
}


#ocadeSearchForm button span datalist {
    display: none !important;
}

@media (max-width:1280px) {
    #ocadeSearchForm {display: none !important;}
}

.actions .etiquette {
  background-color: transparent;
  border: none;
}

button[title="Lancer la recherche"] {
  justify-content: flex-end !important;
  margin-right: .25rem;
}