/**
 * Morta Side Cart : icône de l'en-tête et panneau du panier (#2547).
 * Couleurs du site : bleu #0541a4, crème #f5f5e9, rouge des pictogrammes #b13f3f.
 */

/* ------------------------------------------------------------------ */
/* Icône de l'en-tête                                                  */
/* ------------------------------------------------------------------ */

.msc-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  text-decoration: none !important;
  cursor: pointer;
}
.msc-trigger__inner {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.msc-trigger__icon {
  display: block;
  flex: none;
}
.msc-trigger__count {
  position: absolute;
  top: -8px;
  left: -6px;
  z-index: 1;
  min-width: 19px;
  height: 19px;
  padding: 0 4px;
  border-radius: 10px;
  background: #0541a4;
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  line-height: 19px;
  text-align: center;
  box-sizing: border-box;
}
.msc-trigger__subtotal {
  color: #0541a4;
  font-size: 16px;
  font-weight: 400;
  white-space: nowrap;
}
.msc-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Menu principal (ordinateur) */
.msc-trigger--menu {
  color: #0541a4;
}

/* Barre du burger (<= 1249 px), entre la loupe et le burger */
.cart-mobile .msc-trigger {
  color: #212121;
}
.cart-mobile .msc-trigger__icon {
  width: 28px;
  height: 28px;
}
.cart-mobile .msc-trigger__count {
  left: auto;
  right: -8px;
  top: -6px;
}
.cart-mobile .msc-trigger__subtotal {
  display: none;
}

/* En mode burger, l'entrée du menu ne sert plus : l'icône est dans la barre. */
@media screen and (max-width: 1249px) {
  body .site-header .site-navigation .menu-item:has(> .msc-trigger) {
    display: none !important;
  }
}

/* ------------------------------------------------------------------ */
/* Panneau                                                             */
/* ------------------------------------------------------------------ */

html.msc-lock,
html.msc-lock body {
  overflow: hidden;
}
/* Badge des avis Google (Trustindex) : il passe devant tout, on le masque panneau ouvert,
   comme le fait la copie fixe du bouton « Ajouter au panier ». */
html.msc-lock .ti-widget[data-layout-category="badge"] {
  display: none !important;
}

.msc {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  visibility: hidden;
  pointer-events: none;
  transition: visibility 0s linear 0.3s;
  font-family: "Roboto", sans-serif;
  color: #000;
}
.msc.is-open {
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

.msc__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.msc.is-open .msc__overlay {
  opacity: 1;
}

.msc__drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 92vw);
  display: flex;
  flex-direction: column;
  background: #f5f5e9;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.18);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  outline: none;
}
.msc.is-open .msc__drawer {
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .msc,
  .msc__overlay,
  .msc__drawer {
    transition: none;
  }
}

/* En-tête du panneau */
.msc__head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 16px 24px;
  background: #000;
  color: #fff;
}
.msc .msc__title {
  margin: 0;
  color: #fff;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 3px;
  text-transform: uppercase;
}
.msc__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
}
.msc__close:hover,
.msc__close:focus-visible {
  color: #f5f5e9;
  opacity: 0.75;
}

/* Messages */
.msc__notices:empty {
  display: none;
}
.msc__notices ul {
  margin: 0;
  padding: 12px 24px 0;
  list-style: none;
}
.msc-notice {
  margin: 0 0 8px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.4;
}
.msc-notice--error,
.msc-notice--notice {
  background: #fbeaea;
  color: #8f2d2d;
}
.msc-notice--success {
  background: #eaf3e2;
  color: #3f6b22;
}
.msc-notice a {
  color: inherit;
  text-decoration: underline;
}

/* Contenu */
.msc-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.msc-items {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 0 24px;
  list-style: none;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.msc-item {
  position: relative;
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 14px;
  margin: 0;
  padding: 20px 28px 20px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}
.msc-item:last-child {
  border-bottom: 0;
}

.msc-item__thumb a,
.msc-item__thumb img {
  display: block;
}
.msc-item__thumb img {
  width: 84px;
  height: 84px;
  object-fit: cover;
  background: #fff;
}

.msc-item__body {
  min-width: 0;
}
.msc .msc-item__sales {
  margin: 0 0 4px;
  color: #71b340;
  font-size: 12px;
  line-height: 1.3;
}
.msc .msc-item__name {
  margin: 0 0 6px;
  font-size: 14px;
  line-height: 1.35;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.msc .msc-item__name a {
  color: #0541a4;
  text-decoration: none;
}
.msc .msc-item__name a:hover {
  text-decoration: underline;
}

/* Options et gravure (wc_get_formatted_cart_item_data) */
.msc-item__meta dl.variation {
  margin: 0;
  font-size: 13px;
  line-height: 1.35;
  color: #555;
}
.msc-item__meta dl.variation dt {
  float: none;
  margin: 0;
  font-weight: 400;
}
.msc-item__meta dl.variation dd {
  margin: 0 0 4px;
  font-weight: 600;
  color: #222;
}
.msc-item__meta dl.variation dd p {
  margin: 0;
}
.msc-item__meta dd[class^="variation-Gravure"] p,
.msc-item__meta dd[class^="variation-Engraving"] p {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}
.msc-item__meta dd[class^="variation-Gravure"] span.gravure-text,
.msc-item__meta dd[class^="variation-Gravure"] span.gravure-pictogram,
.msc-item__meta dd[class^="variation-Engraving"] span.gravure-text,
.msc-item__meta dd[class^="variation-Engraving"] span.gravure-pictogram {
  padding: 2px 5px;
  border-radius: 2px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}
.msc-item__meta dd[class^="variation-Gravure"] span.gravure-text,
.msc-item__meta dd[class^="variation-Engraving"] span.gravure-text {
  background-color: #0541a4;
}
.msc-item__meta dd[class^="variation-Gravure"] span.gravure-pictogram,
.msc-item__meta dd[class^="variation-Engraving"] span.gravure-pictogram {
  background-color: #b13f3f;
}
.msc-item__meta dd[class^="variation-GravurePremium"] a,
.msc-item__meta dd[class^="variation-PremiumEngraving"] a {
  color: #0541a4;
  font-size: 13px;
}
.msc .msc-item__backorder {
  margin: 4px 0 0;
  font-size: 13px;
  color: #8f2d2d;
}

/* Quantité et prix */
.msc-item__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}
.msc-qty {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid #000;
  background: #fff;
}
.msc .msc-qty__btn {
  width: 30px;
  height: 30px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #000;
  font-size: 18px;
  line-height: 30px;
  cursor: pointer;
}
.msc .msc-qty__btn:hover:not([disabled]) {
  background: #000;
  color: #fff;
}
.msc .msc-qty__btn[disabled] {
  color: #bbb;
  cursor: default;
}
.msc .msc-qty__input {
  width: 38px;
  height: 30px;
  margin: 0;
  padding: 0;
  border: 0;
  border-left: 1px solid #000;
  border-right: 1px solid #000;
  border-radius: 0;
  background: #fff;
  color: #000;
  font-size: 15px;
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}
.msc .msc-qty__input::-webkit-outer-spin-button,
.msc .msc-qty__input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.msc-item__price {
  margin-left: auto;
  text-align: right;
}
.msc-item__subtotal {
  display: block;
  font-size: 16px;
  color: #000;
  white-space: nowrap;
}
.msc-item__unit {
  display: block;
  font-size: 12px;
  color: #666;
  white-space: nowrap;
}

/* Croix de retrait : passe devant le style WooCommerce de « a.remove » */
.msc .msc-item a.remove {
  position: absolute;
  top: 16px;
  right: -6px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 0;
  background: transparent !important;
  color: #666 !important;
  font-size: 0;
  line-height: 1;
  text-decoration: none;
}
.msc .msc-item a.remove:hover,
.msc .msc-item a.remove:focus-visible {
  color: #b13f3f !important;
}

/* Pied */
.msc-foot {
  flex: none;
  padding: 16px 24px 20px;
  border-top: 1px solid rgba(0, 0, 0, 0.15);
  background: #f5f5e9;
}
.msc .msc-foot__subtotal {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0;
  font-size: 18px;
}
.msc .msc-foot__subtotal strong {
  font-weight: 500;
}
.msc .msc-foot__shipping {
  margin: 4px 0 14px;
  color: #666;
  font-size: 13px;
}
.msc .msc-foot__links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin: 14px 0 0;
  font-size: 13px;
}
.msc .msc-foot__links a {
  color: #000;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.msc .msc-foot__links a:hover {
  color: #0541a4;
}

/* Boutons, comme « Ajouter au panier » du site */
.msc .msc-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 10px 20px;
  border: 1px solid #000;
  background: transparent;
  color: #000;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 3px;
  text-transform: uppercase;
  text-decoration: none;
  text-align: center;
  box-sizing: border-box;
  transition: all 0.2s ease-in;
}
.msc .msc-button:hover {
  background: #000;
  color: #fff;
}
.msc .msc-button--checkout {
  border-color: #0541a4;
  background: #0541a4;
  color: #fff;
}
.msc .msc-button--checkout:hover {
  background: transparent;
  color: #0541a4;
}

/* Panier vide */
.msc-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 40px 24px;
  text-align: center;
}
.msc .msc-empty__text {
  margin: 0;
  font-size: 16px;
}

/* Attente d'une réponse du serveur */
.msc__busy {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(245, 245, 233, 0.6);
}
.msc.is-busy .msc__busy {
  display: flex;
}
.msc__spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(5, 65, 164, 0.2);
  border-top-color: #0541a4;
  border-radius: 50%;
  animation: msc-spin 0.8s linear infinite;
}
@keyframes msc-spin {
  to {
    transform: rotate(360deg);
  }
}

@media screen and (max-width: 480px) {
  .msc__head {
    padding-left: 18px;
  }
  .msc-items {
    padding: 0 18px;
  }
  .msc-item {
    grid-template-columns: 72px 1fr;
    gap: 12px;
  }
  .msc-item__thumb img {
    width: 72px;
    height: 72px;
  }
  .msc-foot {
    padding: 14px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  }
}

/* Téléphone et écran tactile : boutons −, + et croix de 40 px (demande de Matthieu du 11/11/2026).
   La croix ne gêne que le haut de la ligne : la place à sa droite est réservée au texte seulement,
   la quantité et le prix gardent toute la largeur. */
@media screen and (max-width: 767px), (pointer: coarse) {
  .msc-item {
    padding-right: 0;
  }
  .msc .msc-item__sales,
  .msc .msc-item__name,
  .msc-item__meta,
  .msc .msc-item__backorder {
    padding-right: 32px;
  }
  .msc-item__row {
    flex-wrap: wrap;
    row-gap: 6px;
  }
  .msc .msc-qty__btn {
    width: 40px;
    height: 40px;
    font-size: 20px;
    line-height: 40px;
  }
  .msc .msc-qty__input {
    width: 42px;
    height: 40px;
    font-size: 16px;
  }
  .msc .msc-item a.remove {
    top: 11px;
    right: -11px;
    width: 40px;
    height: 40px;
  }
}
