/**
 * Jardideco Pictos - Styles Front-Office
 */

.product__carousel,
.product__no-image {
  position: relative !important;
}

.jardideco-product-pictos {
  position: relative;
  display: inline-flex !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 10px 0 16px 0;
  padding: 0;
  z-index: 10;
  pointer-events: auto !important;
}

.jardideco-product-pictos.position-before-price,
.jardideco-product-pictos.position-under-price {
  position: relative !important;
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 10px 0 16px 0;
  width: 100%;
}

/* Positions si superposé à l'image produit (compatibilité / rétrocompatibilité) */
.product__carousel .jardideco-product-pictos,
.product__no-image .jardideco-product-pictos {
  position: absolute !important;
  z-index: 30 !important;
  margin: 0;
}

.product__carousel .jardideco-product-pictos.position-bottom-right,
.product__no-image .jardideco-product-pictos.position-bottom-right {
  bottom: 18px;
  right: 18px;
}

.product__carousel .jardideco-product-pictos.position-bottom-left,
.product__no-image .jardideco-product-pictos.position-bottom-left {
  bottom: 18px;
  left: 18px;
}

.product__carousel .jardideco-product-pictos.position-top-right,
.product__no-image .jardideco-product-pictos.position-top-right {
  top: 18px;
  right: 18px;
}

.product__carousel .jardideco-product-pictos.position-top-left,
.product__no-image .jardideco-product-pictos.position-top-left {
  top: 18px;
  left: 18px;
}

/* Badge individuel */
.jardideco-picto-badge {
  position: relative;
  width: 54px;
  height: 54px;
  background-color: #82a445;
  color: #ffffff;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  cursor: default;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.22s ease, background-color 0.2s ease;
  padding: 6px;
  user-select: none;
  text-decoration: none;
}

.jardideco-picto-badge.is-clickable {
  cursor: pointer;
}

.jardideco-picto-badge.is-clickable:hover {
  transform: translateY(-4px) scale(1.06);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
}

.jardideco-picto-badge.is-clickable:active {
  transform: translateY(-1px) scale(1.02);
}

/* Icône SVG interne */
.jardideco-picto-badge svg,
.jardideco-picto-badge img {
  width: 36px;
  height: 36px;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.jardideco-picto-badge svg text {
  fill: currentColor;
}

/* Micro-indicateur d'action (vidéo, pdf, popup) */
.jardideco-picto-badge .action-indicator {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 17px;
  height: 17px;
  background: #ffffff;
  color: #82a445;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
  font-size: 10px;
  font-weight: bold;
}

.jardideco-picto-badge .action-indicator.video-indicator svg {
  width: 9px;
  height: 9px;
  fill: #82a445;
}

.jardideco-picto-badge .action-indicator.pdf-indicator svg {
  width: 9px;
  height: 9px;
  fill: #d32f2f;
}

/* Tooltip customisé */
.jardideco-picto-badge .picto-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background-color: rgba(30, 41, 59, 0.96);
  backdrop-filter: blur(4px);
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  width: max-content;
  max-width: 250px;
  white-space: normal;
  text-align: center;
  line-height: 1.35;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  z-index: 50;
}

.jardideco-picto-badge .picto-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: rgba(30, 41, 59, 0.96) transparent transparent transparent;
}

.jardideco-picto-badge:hover .picto-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Positionnement pour les configurations Top (ouverture vers le bas) */
.jardideco-product-pictos.position-top-right .picto-tooltip,
.jardideco-product-pictos.position-top-left .picto-tooltip {
  bottom: auto;
  top: calc(100% + 8px);
  transform: translateX(-50%) translateY(-4px);
}

.jardideco-product-pictos.position-top-right .picto-tooltip::after,
.jardideco-product-pictos.position-top-left .picto-tooltip::after {
  top: auto;
  bottom: 100%;
  border-color: transparent transparent rgba(30, 41, 59, 0.96) transparent;
}

.jardideco-product-pictos.position-top-right .jardideco-picto-badge:hover .picto-tooltip,
.jardideco-product-pictos.position-top-left .jardideco-picto-badge:hover .picto-tooltip {
  transform: translateX(-50%) translateY(0);
}

/* Vignette la plus à droite (défaut et positions à droite) : aligner le tooltip à droite */
.jardideco-product-pictos.position-bottom-right .jardideco-picto-badge:last-child .picto-tooltip,
.jardideco-product-pictos:not(.position-bottom-left):not(.position-top-left) .jardideco-picto-badge:last-child .picto-tooltip {
  left: auto;
  right: -2px;
  transform: translateY(4px);
}

.jardideco-product-pictos.position-bottom-right .jardideco-picto-badge:last-child:hover .picto-tooltip,
.jardideco-product-pictos:not(.position-bottom-left):not(.position-top-left) .jardideco-picto-badge:last-child:hover .picto-tooltip {
  transform: translateY(0);
}

.jardideco-product-pictos.position-bottom-right .jardideco-picto-badge:last-child .picto-tooltip::after,
.jardideco-product-pictos:not(.position-bottom-left):not(.position-top-left) .jardideco-picto-badge:last-child .picto-tooltip::after {
  left: auto;
  right: 23px;
  transform: none;
}

.jardideco-product-pictos.position-top-right .jardideco-picto-badge:last-child .picto-tooltip {
  left: auto;
  right: -2px;
  transform: translateY(-4px);
}

.jardideco-product-pictos.position-top-right .jardideco-picto-badge:last-child:hover .picto-tooltip {
  transform: translateY(0);
}

.jardideco-product-pictos.position-top-right .jardideco-picto-badge:last-child .picto-tooltip::after {
  left: auto;
  right: 23px;
  transform: none;
}

/* Vignette la plus à gauche (positions à gauche) : aligner le tooltip à gauche */
.jardideco-product-pictos.position-bottom-left .jardideco-picto-badge:first-child .picto-tooltip {
  left: -2px;
  right: auto;
  transform: translateY(4px);
}

.jardideco-product-pictos.position-bottom-left .jardideco-picto-badge:first-child:hover .picto-tooltip {
  transform: translateY(0);
}

.jardideco-product-pictos.position-bottom-left .jardideco-picto-badge:first-child .picto-tooltip::after {
  left: 23px;
  right: auto;
  transform: none;
}

.jardideco-product-pictos.position-top-left .jardideco-picto-badge:first-child .picto-tooltip {
  left: -2px;
  right: auto;
  transform: translateY(-4px);
}

.jardideco-product-pictos.position-top-left .jardideco-picto-badge:first-child:hover .picto-tooltip {
  transform: translateY(0);
}

.jardideco-product-pictos.position-top-left .jardideco-picto-badge:first-child .picto-tooltip::after {
  left: 23px;
  right: auto;
  transform: none;
}

/* Intégration spécifique dans la Buybox avant le prix */
.product-buybox .jardideco-product-pictos {
  margin: 12px 0 16px 0;
  width: 100%;
}

.product-buybox .jardideco-picto-badge:first-child .picto-tooltip {
  left: 0 !important;
  right: auto !important;
  transform: translateY(4px) !important;
}

.product-buybox .jardideco-picto-badge:first-child:hover .picto-tooltip {
  transform: translateY(0) !important;
}

.product-buybox .jardideco-picto-badge:first-child .picto-tooltip::after {
  left: 24px !important;
  right: auto !important;
  transform: none !important;
}

.product-buybox .jardideco-picto-badge:not(:first-child) .picto-tooltip {
  left: 50% !important;
  right: auto !important;
  transform: translateX(-50%) translateY(4px) !important;
}

.product-buybox .jardideco-picto-badge:not(:first-child):hover .picto-tooltip {
  transform: translateX(-50%) translateY(0) !important;
}

.product-buybox .jardideco-picto-badge:not(:first-child) .picto-tooltip::after {
  left: 50% !important;
  right: auto !important;
  transform: translateX(-50%) !important;
}

/* Modale Vidéo & Modale Popup autonomes */
.jardideco-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 999999;
  display: none;
  align-items: center;
  justify-content: center;
  background-color: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  padding: 1.25rem;
  opacity: 0;
  transition: opacity 0.22s ease;
}

.jardideco-modal-overlay.is-open {
  display: flex !important;
  opacity: 1;
}

.jardideco-modal-container {
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
  width: 100%;
  max-width: 740px;
  overflow: hidden;
  transform: translateY(24px) scale(0.96);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
}

.jardideco-modal-overlay.is-open .jardideco-modal-container {
  transform: translateY(0) scale(1);
}

.jardideco-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background-color: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.jardideco-modal-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
}

.jardideco-modal-title-icon {
  width: 28px;
  height: 28px;
  background-color: #82a445;
  color: #fff;
  border-radius: 6px;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.jardideco-modal-title-icon svg {
  width: 100%;
  height: 100%;
}

.jardideco-modal-close {
  background: transparent;
  border: none;
  font-size: 1.75rem;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s, color 0.15s;
}

.jardideco-modal-close:hover {
  background-color: #e2e8f0;
  color: #0f172a;
}

.jardideco-modal-body {
  padding: 0;
}

.jardideco-video-wrapper {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 ratio */
  height: 0;
  overflow: hidden;
  background-color: #000;
}

.jardideco-video-wrapper iframe,
.jardideco-video-wrapper video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.jardideco-modal-body-content {
  padding: 1.5rem;
  font-size: 0.95rem;
  line-height: 1.6;
  color: #334155;
  max-height: 70vh;
  overflow-y: auto;
}

body.jardideco-modal-open {
  overflow: hidden !important;
}

/* Responsive smartphone */
@media (max-width: 575.98px) {
  .jardideco-product-pictos {
    bottom: 10px;
    right: 10px;
    gap: 6px;
  }
  
  .jardideco-picto-badge {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    padding: 5px;
  }

  .jardideco-picto-badge svg,
  .jardideco-picto-badge img {
    width: 28px;
    height: 28px;
  }

  .jardideco-picto-badge .picto-tooltip {
    max-width: min(220px, calc(100vw - 40px));
    font-size: 11px;
    padding: 5px 9px;
  }

  .jardideco-product-pictos.position-bottom-right .jardideco-picto-badge:last-child .picto-tooltip::after,
  .jardideco-product-pictos:not(.position-bottom-left):not(.position-top-left) .jardideco-picto-badge:last-child .picto-tooltip::after,
  .jardideco-product-pictos.position-top-right .jardideco-picto-badge:last-child .picto-tooltip::after {
    right: 17px;
  }

  .jardideco-product-pictos.position-bottom-left .jardideco-picto-badge:first-child .picto-tooltip::after,
  .jardideco-product-pictos.position-top-left .jardideco-picto-badge:first-child .picto-tooltip::after {
    left: 17px;
  }
}
