/* ==========================================================================
   MODALS RESPONSIVE — UX Optimale
   heleneriu.fr — Février 2026
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. PRODUCT ZOOM MODAL (#product-modal)
   -------------------------------------------------------------------------- */

/* Close button — visible sur tous les viewports */
#product-modal .modal-header--zoom {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 10;
  padding: 0;
  border: none;
  background: transparent;
}

#product-modal .close--zoom {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin: 8px;
  padding: 0;
  font-size: 2rem;
  font-weight: 300;
  line-height: 1;
  color: #2d2418;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  cursor: pointer;
  opacity: 1;
  transition: background 0.2s ease, transform 0.2s ease;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

#product-modal .close--zoom:hover {
  background: #fff;
  transform: scale(1.1);
}

#product-modal .close--zoom:focus {
  outline: 2px solid #8b7355;
  outline-offset: 2px;
}

/* Modal dialog — desktop */
#product-modal .modal-dialog--product-zoom {
  max-width: 90vw;
  margin: 2vh auto;
}

#product-modal .modal-content {
  position: relative;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 8px;
  overflow: hidden;
}

#product-modal .modal-body {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 1rem;
  padding: 0;
  margin-left: 0; /* Override du margin-left: -35% legacy */
  background: #fff;
  border-radius: 8px;
}

/* Image principale */
#product-modal .product-zoom__figure {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  max-height: 85vh;
  overflow: hidden;
  margin: 0;
}

#product-modal .product-cover-modal {
  max-width: 100%;
  max-height: 80vh;
  width: auto;
  height: auto;
  object-fit: contain;
  background: #fff;
}

/* Thumbnails sidebar — desktop */
#product-modal .thumbnails {
  flex: 0 0 auto;
  width: 120px;
  padding: 1rem 0.5rem;
  background: #faf8f5;
  border-left: 1px solid rgba(0, 0, 0, 0.06);
}

#product-modal .product-images {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#product-modal .product-images img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s ease;
  background: #fff;
}

#product-modal .product-images img:hover,
#product-modal .product-images img.selected {
  border-color: #8b7355;
}

/* Masquer la caption dans la modale (déjà visible sur la page) */
#product-modal .image-caption {
  display: none;
}

/* --------------------------------------------------------------------------
   2. BLOCKCART MODAL (#blockcart-modal)
   Override theme.css max-width: 1140px → 700px
   -------------------------------------------------------------------------- */

#blockcart-modal .modal-dialog {
  width: auto !important;
  max-width: 700px !important;
  margin: 5vh auto !important;
}

#blockcart-modal .modal-content {
  border-radius: 12px;
  border: none;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

#blockcart-modal .modal-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  background: #faf8f5;
}

#blockcart-modal .modal-header .close {
  opacity: 1;
  font-size: 1.5rem;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s ease;
}

#blockcart-modal .modal-header .close:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* Body layout — 2 colonnes */
#blockcart-modal .modal-body {
  padding: 1.5rem !important;
}

#blockcart-modal .modal-body > .row {
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 1.5rem;
}

#blockcart-modal .modal-body .divide-right {
  flex: 0 0 40% !important;
  max-width: 40% !important;
  border-right: 1px solid rgba(0, 0, 0, 0.06);
  padding-right: 1.5rem;
}

#blockcart-modal .modal-body .col-md-7 {
  flex: 1 1 60% !important;
  max-width: 60% !important;
}

/* Image produit */
#blockcart-modal .product-image {
  max-width: 180px !important;
  margin: 0 auto 1rem !important;
}

/* Boutons d'action */
#blockcart-modal .cart-content-btn {
  display: flex !important;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

#blockcart-modal .cart-content-btn .btn {
  flex: 1;
  text-align: center;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  transition: all 0.2s ease;
}

#blockcart-modal .cart-content-btn .btn-secondary {
  background: #fff;
  border: 1px solid #8b7355;
  color: #8b7355;
}

#blockcart-modal .cart-content-btn .btn-secondary:hover {
  background: #faf8f5;
}

#blockcart-modal .cart-content-btn .btn-primary {
  background: #8b7355;
  border: 1px solid #8b7355;
  color: #fff;
}

#blockcart-modal .cart-content-btn .btn-primary:hover {
  background: #7a6448;
}

/* --------------------------------------------------------------------------
   3. COMMENT MODALS (.product-comment-modal)
   -------------------------------------------------------------------------- */

.product-comment-modal .modal-dialog {
  max-width: 600px;
  margin: 5vh auto;
}

.product-comment-modal .modal-content {
  border-radius: 8px;
  border: none;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   4. MODAL BACKDROP — global
   -------------------------------------------------------------------------- */

.modal-backdrop.in {
  opacity: 0.6;
  background: #2d2418;
}

/* --------------------------------------------------------------------------
   5. RESPONSIVE — Tablet (max-width: 768px)
   -------------------------------------------------------------------------- */

@media (max-width: 768px) {

  /* Product zoom — fullscreen */
  #product-modal .modal-dialog--product-zoom {
    max-width: 100vw;
    width: 100vw;
    height: 100vh;
    margin: 0;
  }

  #product-modal .modal-content {
    height: 100vh;
    border-radius: 0;
  }

  #product-modal .modal-body {
    flex-direction: column;
    height: 100vh;
    margin-left: 0;
    border-radius: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  #product-modal .product-zoom__figure {
    flex: 1 1 auto;
    min-height: 50vh;
    max-height: none;
    padding-top: 48px; /* espace pour le close button */
  }

  #product-modal .product-cover-modal {
    max-height: 60vh;
  }

  /* Thumbnails — horizontal en bas */
  #product-modal .thumbnails {
    flex: 0 0 auto;
    width: 100%;
    padding: 0.75rem;
    border-left: none;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    background: #faf8f5;
  }

  #product-modal .product-images {
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0.5rem;
    padding-bottom: 0.25rem;
  }

  #product-modal .thumb-container {
    flex: 0 0 80px;
  }

  #product-modal .product-images img {
    width: 80px;
    height: 80px;
    object-fit: cover;
  }

  #product-modal .close--zoom {
    width: 44px;
    height: 44px;
    margin: 6px;
    font-size: 1.75rem;
    background: rgba(255, 255, 255, 0.95);
  }

  /* Arrows — horizontal */
  #product-modal .arrows {
    display: none;
  }

  /* Mask overflow */
  #product-modal .mask {
    max-height: none !important;
    margin-top: 0 !important;
    overflow: visible !important;
  }

  /* Blockcart modal — tablet */
  #blockcart-modal .modal-dialog {
    max-width: 95vw !important;
    margin: 2vh auto !important;
  }

  #blockcart-modal .modal-body > .row {
    flex-wrap: wrap !important;
    gap: 1rem;
  }

  #blockcart-modal .modal-body .divide-right {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    border-right: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    padding-right: 0;
    padding-bottom: 1rem;
    display: flex !important;
    align-items: center;
    gap: 1rem;
  }

  #blockcart-modal .modal-body .col-md-7 {
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }

  #blockcart-modal .product-image {
    max-width: 100px !important;
    flex-shrink: 0;
  }

  #blockcart-modal .modal-body {
    padding: 1rem !important;
  }

  #blockcart-modal .cart-content-btn {
    flex-direction: column !important;
    gap: 0.5rem;
  }

  #blockcart-modal .cart-content-btn .btn {
    width: 100%;
    text-align: center;
  }

  /* Comment modals */
  .product-comment-modal .modal-dialog {
    max-width: 95vw;
    margin: 2vh auto;
  }
}

/* --------------------------------------------------------------------------
   6. RESPONSIVE — Mobile (max-width: 480px)
   -------------------------------------------------------------------------- */

@media (max-width: 480px) {

  #product-modal .product-cover-modal {
    max-height: 50vh;
  }

  #product-modal .thumb-container {
    flex: 0 0 64px;
  }

  #product-modal .product-images img {
    width: 64px;
    height: 64px;
  }

  #product-modal .close--zoom {
    width: 40px;
    height: 40px;
    margin: 4px;
    font-size: 1.5rem;
  }

  #blockcart-modal .modal-dialog {
    max-width: 100vw !important;
    margin: 0 !important;
    height: 100vh !important;
    width: 100vw !important;
  }

  #blockcart-modal .modal-content {
    border-radius: 0 !important;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
  }

  #blockcart-modal .modal-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  #blockcart-modal .cart-content-btn {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding: 0.75rem 0 !important;
    margin-top: auto;
  }

  .product-comment-modal .modal-dialog {
    max-width: 100vw;
    margin: 0;
  }

  .product-comment-modal .modal-content {
    border-radius: 0;
    min-height: auto;
  }
}

/* --------------------------------------------------------------------------
   7. ANIMATIONS
   -------------------------------------------------------------------------- */

#product-modal.fade .modal-dialog--product-zoom {
  transform: scale(0.95);
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

#product-modal.in .modal-dialog--product-zoom {
  transform: scale(1);
  opacity: 1;
}

/* --------------------------------------------------------------------------
   8. ACCESSIBILITY
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  #product-modal.fade .modal-dialog--product-zoom {
    transition: none;
  }
}

/* Focus trap visuel */
#product-modal .close--zoom:focus-visible,
#blockcart-modal .close:focus-visible,
.product-comment-modal [data-dismiss="modal"]:focus-visible {
  outline: 2px solid #8b7355;
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   9. FIX: Footer — supprimer la bande sombre sous le copyright
   -------------------------------------------------------------------------- */

#footer {
  padding-bottom: 0 !important;
  margin-bottom: 0 !important;
}

.footer-senior {
  padding-bottom: 0 !important;
  margin-bottom: 0 !important;
}

/* Supprimer le padding-bottom du body qui crée un espace blanc */
body#product,
body {
  padding-bottom: 0 !important;
}

/* --------------------------------------------------------------------------
   10. FIX: Tabs — supprimer le scrollbar parasite sur les onglets produit
   -------------------------------------------------------------------------- */

.tabs .nav,
.tabs .nav-tabs {
  overflow: hidden !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
}

/* --------------------------------------------------------------------------
   11. Quick View — masqué
   -------------------------------------------------------------------------- */

.highlighted-informations,
.quick-view {
  display: none !important;
}

/* --------------------------------------------------------------------------
   12. FIX: Afficher nom + prix sur les cartes catégorie
   -------------------------------------------------------------------------- */

/* thumbnail-container : retirer aspect-ratio pour laisser place à la description */
#category .thumbnail-container,
.products .thumbnail-container {
  aspect-ratio: auto !important;
  overflow: visible !important;
}

/* thumbnail-top : garder le carré pour l'image + overflow hidden pour border-radius */
#category .thumbnail-top,
.products .thumbnail-top {
  aspect-ratio: 1 !important;
  overflow: hidden !important;
  border-radius: 12px 12px 0 0 !important;
  position: relative !important;
}

/* Description visible sous l'image */
#category .product-description,
.products .product-description {
  display: flex !important;
  flex-direction: column !important;
  padding: 10px 12px 12px !important;
}

/* Titre produit */
#category .product-title,
.products .product-title {
  min-height: auto !important;
  margin-bottom: 4px !important;
}

#category .product-title a,
.products .product-title a {
  font-size: 13px !important;
  line-height: 1.3 !important;
  color: #2d2418 !important;
  -webkit-line-clamp: 2 !important;
}

/* Prix */
#category .product-price-and-shipping,
.products .product-price-and-shipping {
  padding-top: 6px !important;
  margin-top: auto !important;
  border-top: 1px solid rgba(0, 0, 0, 0.06) !important;
}

#category .product-price-and-shipping .price,
.products .product-price-and-shipping .price {
  color: #8b7355 !important;
  font-weight: 700 !important;
  font-size: 16px !important;
}

#category .product-price-and-shipping .regular-price,
.products .product-price-and-shipping .regular-price {
  color: #999 !important;
  text-decoration: line-through !important;
  font-size: 12px !important;
}
