/* JM Motors — Accessoires (style Fiido) */

.jm-acc {
  margin: 2rem 0;
  padding: 1.25rem 1.5rem;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  background: #fff;
}

.jm-acc__head {
  margin-bottom: 1rem;
}

.jm-acc__title {
  margin: 0 0 .25rem;
  font-size: 1.15rem;
  font-weight: 700;
}

.jm-acc__subtitle {
  margin: 0;
  color: #777;
  font-size: .9rem;
}

.jm-acc__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .75rem;
}

.jm-acc__item {
  margin: 0;
}

/* Affichage en grille (shortcode layout="grid") */
.jm-acc__list--grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.jm-acc__list--grid .jm-acc__label {
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  height: 100%;
}

.jm-acc__list--grid .jm-acc__thumb {
  width: 100%;
  height: 140px;
}

.jm-acc__list--grid .jm-acc__checkbox {
  position: absolute;
  margin: .6rem;
}

.jm-acc__list--grid .jm-acc__item {
  position: relative;
}

.jm-acc__label {
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: .65rem .75rem;
  border: 1px solid #eee;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
  margin: 0;
}

.jm-acc__label:hover {
  border-color: #cfcfcf;
}

.jm-acc__checkbox:checked + .jm-acc__thumb {
  outline: 2px solid #111;
}

.jm-acc__label.is-unavailable {
  opacity: .55;
  cursor: not-allowed;
}

.jm-acc__checkbox {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  accent-color: #111;
}

.jm-acc__thumb {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: 8px;
  overflow: hidden;
  background: #f6f6f6;
  display: flex;
  align-items: center;
  justify-content: center;
}

.jm-acc__thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.jm-acc__info {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  flex: 1 1 auto;
  min-width: 0;
}

.jm-acc__name {
  font-weight: 600;
  color: #222;
  line-height: 1.25;
}

.jm-acc__subtitle {
  font-size: .82rem;
  color: #888;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Colonne prix à droite */
.jm-acc__pricing {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  white-space: nowrap;
  padding-left: .75rem;
  flex: 0 0 auto;
}

.jm-acc__price {
  font-weight: 700;
  color: #111;
}

.jm-acc__price-old {
  color: #999;
  text-decoration: line-through;
  font-size: .85rem;
}

.jm-acc__badge-free {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 4px;
  background: #e6f7ef;
  color: #1ca85f;
  font-weight: 700;
  font-size: .8rem;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.jm-acc__stock {
  font-size: .75rem;
  color: #c0392b;
}

/* Sélecteur de déclinaison (attributs) — dans la carte cliquable */
.jm-acc__variants {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-top: .45rem;
  flex-wrap: wrap;
}

.jm-acc__variants-label {
  font-size: .8rem;
  color: #777;
}

.jm-acc__combo {
  flex: 1 1 auto;
  max-width: 280px;
  padding: .35rem .5rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  font-size: .9rem;
  cursor: pointer;
}

/* Masquage des produits au-delà du seuil + bouton « Voir plus » */
.jm-acc__item--hidden {
  display: none;
}

.jm-acc__more-wrap {
  margin-top: .9rem;
  text-align: center;
}

.jm-acc__more {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.2rem;
  border: 1px solid #111;
  border-radius: 999px;
  background: #fff;
  color: #111;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}

.jm-acc__more:hover {
  background: #111;
  color: #fff;
}

.jm-acc__footer {
  margin-top: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  padding-top: 1rem;
  border-top: 1px solid #f0f0f0;
}

.jm-acc__total {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.jm-acc__total-label {
  font-size: .8rem;
  color: #777;
}

.jm-acc__total-amount {
  font-size: 1.25rem;
  font-weight: 800;
  color: #111;
}

.jm-acc__hint {
  font-size: .9rem;
  color: #555;
  text-align: right;
}

.jm-acc__note {
  margin: .9rem 0 0;
  padding-top: .75rem;
  border-top: 1px dashed #e5e5e5;
  font-size: .82rem;
  color: #888;
  line-height: 1.35;
}

.jm-acc__add {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}

.jm-acc__add[disabled] {
  opacity: .55;
  cursor: not-allowed;
}

.jm-acc__add.is-loading {
  opacity: .7;
  pointer-events: none;
}

.jm-acc__add.is-loading .jm-acc__add-label::after {
  content: '…';
}

@media (max-width: 480px) {
  .jm-acc__footer {
    flex-direction: column;
    align-items: stretch;
  }
  .jm-acc__add {
    justify-content: center;
  }
}

/* Toast de confirmation maison */
.jm-acc__toast {
  position: fixed;
  z-index: 99999;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  display: flex;
  align-items: center;
  gap: .6rem;
  max-width: 90vw;
  padding: .8rem 1.25rem;
  background: #111;
  color: #fff;
  font-weight: 600;
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .28);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}

.jm-acc__toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.jm-acc__toast-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #2ecc71;
  color: #fff;
  font-size: .8rem;
  flex: 0 0 auto;
}
