/**
 * ProductModal Styles
 * Design responsive mobile-first - Convostomo Theme
 */

/* ========== MODAL BASE ========== */
.product-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  max-width: 100vw;
  height: 100%;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: hidden;
}

.product-modal.active {
  display: flex;
}

/* Overlay */
.product-modal__overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(45, 62, 80, 0.95);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.3s ease-out;
}

/* Container principal */
.product-modal__container {
  position: relative;
  width: 100%;
  max-width: 100%;
  height: 100%;
  background: var(--white);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1;
}

/* ========== HEADER ========== */
.product-modal__header {
  padding: 1rem 1.5rem;
  border-bottom: 3px solid transparent;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-pink), var(--accent-yellow), var(--accent-green));
  background-size: 100% 3px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  flex-shrink: 0;
  position: relative;
}

.product-modal__header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(13, 164, 225, 0.05) 0%, rgba(227, 13, 131, 0.05) 50%, rgba(249, 180, 30, 0.05) 100%);
  z-index: -1;
}

.product-modal__title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-color);
  margin: 0 2rem 0.35rem 0;
  line-height: 1.2;
}

.product-modal__description {
  font-size: 0.85rem;
  color: var(--text-light);
  margin: 0;
  line-height: 1.4;
}

/* Close button */
.product-modal__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2rem;
  height: 2rem;
  background: var(--white);
  border: 2px solid var(--secondary-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  z-index: 10;
  box-shadow: 0 2px 8px var(--shadow);
}

.product-modal__close:hover {
  background: var(--secondary-color);
  transform: scale(1.1) rotate(90deg);
  box-shadow: 0 4px 15px rgba(232, 73, 29, 0.3);
}

.product-modal__close i {
  font-size: 1rem;
  color: var(--secondary-color);
  transition: var(--transition);
}

.product-modal__close:hover i {
  color: var(--white);
}

/* ========== TABS ========== */
.product-modal__tabs {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 1rem;
  border-bottom: 2px solid var(--bg-light);
  background: var(--bg-light);
  flex-shrink: 0;
  position: relative;
}

.tabs-scroll-container {
  display: flex;
  gap: 0;
  overflow-x: auto;
  overflow-y: hidden;
  flex: 1;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tabs-scroll-container::-webkit-scrollbar {
  display: none;
}

/* Boutons de navigation prev/next */
.tabs-nav-btn {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--bg-light);
  border-radius: 50%;
  color: var(--text-light);
  cursor: pointer;
  transition: var(--transition);
  opacity: 0.6;
  z-index: 2;
  margin: 0.5rem 0;
}

.tabs-nav-btn:hover {
  opacity: 1;
  background: var(--white);
  color: var(--primary-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transform: scale(1.1);
}

.tabs-nav-btn i {
  font-size: 0.85rem;
}

.tabs-prev {
  margin-right: 0.5rem;
}

.tabs-next {
  margin-left: 0.5rem;
}

.product-modal__tab {
  padding: 1rem 1.25rem;
  background: transparent;
  border: none;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-light);
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  transition: var(--transition);
  flex-shrink: 0;
  font-family: 'Poppins', sans-serif;
}

.product-modal__tab:hover {
  color: var(--primary-color);
  background: rgba(255, 255, 255, 0.5);
}

.product-modal__tab.active {
  color: var(--primary-color);
  font-weight: 600;
}

.product-modal__tab.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-pink));
  border-radius: 2px 2px 0 0;
}

/* ========== BODY ========== */
.product-modal__body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.75rem 1.5rem 1.5rem;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

/* Category content */
.category-content {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.category-text {
  order: 1;
}

.category-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--primary-color);
  margin: 0;
  position: relative;
  padding-bottom: 0.75rem;
}

.category-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-pink));
  border-radius: 2px;
}

.category-description {
  font-size: 1rem;
  color: var(--text-light);
  line-height: 1.7;
  margin: 0 0 1.5rem 0;
}

/* Specs */
.category-specs {
  background: var(--bg-light);
  padding: 1.25rem;
  border-radius: 10px;
  border: 2px solid transparent;
  background-image: linear-gradient(var(--white), var(--white)),
                    linear-gradient(135deg, var(--accent-blue), var(--accent-pink));
  background-origin: border-box;
  background-clip: padding-box, border-box;
}

.spec-item {
  font-size: 0.9rem;
  color: var(--text-color);
  line-height: 1.8;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.spec-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.spec-item strong {
  color: var(--primary-color);
  font-weight: 600;
  display: inline-block;
  min-width: 120px;
}

/* ========== NOUVEAU LAYOUT ========== */

/* Container principal du nouveau layout */
.category-content-new {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Bloc de description textuelle */
.category-description-block {
  background: var(--white);
  padding: 0;
  position: relative;
}

.category-description-block p {
  font-size: 0.95rem;
  color: var(--text-light);
  line-height: 1.8;
  margin: 0 0 1rem 0;
  text-align: justify;
}

.category-description-block p:last-child {
  margin-bottom: 0;
}

/* Collapse du texte */
.category-description-block.collapsed .description-content {
  max-height: 6.8rem; /* environ 4 lignes */
  overflow: hidden;
  position: relative;
}

.category-description-block.collapsed .description-content::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2rem;
  background: linear-gradient(to bottom, transparent, var(--white));
}

/* Bouton Lire plus */
.read-more-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.5rem auto 0;
  padding: 0.25rem 1.5rem;
  background: transparent;
  border: none;
  color: var(--text-light);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  opacity: 0.7;
}

.read-more-btn:hover {
  opacity: 1;
  color: var(--primary-color);
}

.read-more-btn i {
  font-size: 0.9rem;
  transition: transform 0.3s ease;
}

.category-description-block.collapsed .read-more-btn i {
  transform: rotate(0deg);
}

.category-description-block:not(.collapsed) .read-more-btn i {
  transform: rotate(180deg);
}

/* Bloc PDFs */
.category-pdfs-block {
  background: linear-gradient(135deg, rgba(13, 164, 225, 0.05), rgba(227, 13, 131, 0.05));
  padding: 1.5rem;
  border-radius: 12px;
  border: 2px solid var(--bg-light);
}

.pdfs-title,
.gallery-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary-color);
  margin: 0 0 1rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pdfs-title i,
.gallery-title i {
  color: var(--accent-blue);
}

.pdfs-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.pdf-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--white);
  border: 2px solid var(--accent-blue);
  border-radius: 10px;
  color: var(--accent-blue);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.pdf-card:hover {
  background: var(--accent-blue);
  color: var(--white);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(13, 164, 225, 0.3);
}

.pdf-card i {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.pdf-card span {
  flex: 1;
}

/* Bloc galerie d'images */
.category-gallery-block {
  padding: 0;
}

.images-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

/* Pagination de la galerie */
.modal-gallery-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.modal-gallery-pagination .gallery-page-btn,
.modal-gallery-pagination .gallery-dot {
  padding: 0.5rem 1rem;
  border: none;
  background: var(--white);
  color: var(--primary-color);
  border-radius: 5px;
  cursor: pointer;
  transition: var(--transition);
  font-family: 'Poppins', sans-serif;
  font-weight: 500;
}

.modal-gallery-pagination .gallery-page-btn:hover,
.modal-gallery-pagination .gallery-dot:hover {
  background: var(--secondary-color);
  color: var(--white);
}

.modal-gallery-pagination .gallery-dot {
  width: 12px;
  height: 12px;
  padding: 0;
  border-radius: 50%;
  background: var(--text-light);
}

.modal-gallery-pagination .gallery-dot.active {
  background: var(--secondary-color);
  width: 30px;
  border-radius: 6px;
}

.gallery-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 4/3;
  cursor: pointer;
  box-shadow: 0 4px 15px var(--shadow);
  transition: var(--transition);
}

.gallery-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 30px var(--shadow-dark);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: var(--transition);
}

.gallery-item:hover img {
  transform: scale(1.1);
}

.gallery-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(45, 62, 80, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: var(--transition);
}

.gallery-item:hover .gallery-overlay {
  opacity: 1;
}

.gallery-overlay i {
  font-size: 2.5rem;
  color: var(--white);
}

/* Styles spécifiques pour la vue d'ensemble */
.overview-item {
  cursor: pointer;
}

.overview-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, rgba(45, 62, 80, 0.3), rgba(45, 62, 80, 0.85));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 1.5rem;
  opacity: 1;
  transition: var(--transition);
}

.overview-item:hover .overview-overlay {
  background: linear-gradient(to bottom, rgba(13, 164, 225, 0.4), rgba(13, 164, 225, 0.9));
}

.overview-overlay h5 {
  color: var(--white);
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  text-align: center;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: var(--transition);
}

.overview-overlay i {
  font-size: 1.5rem;
  color: var(--white);
  opacity: 0.8;
  transition: var(--transition);
}

.overview-item:hover .overview-overlay h5 {
  transform: translateY(-5px);
}

.overview-item:hover .overview-overlay i {
  opacity: 1;
  transform: translateX(5px);
}

/* ========== LEGACY STYLES (à garder pour compatibilité) ========== */

.section-image, .section-text, .section-pdfs, .pdf-link, .category-section {
  /* Kept for backward compatibility */
}

/* Legacy - kept for compatibility */
.category-images {
  order: 2;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  width: 100%;
  min-height: 200px;
}

.category-image {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  min-height: 200px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 15px var(--shadow);
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid transparent;
  background: var(--bg-light);
}

.category-image:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px var(--shadow-dark);
  border-color: var(--accent-blue);
}

.category-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition);
}

.category-image:hover img {
  transform: scale(1.1);
}

/* ========== FOOTER ========== */
.product-modal__footer {
  padding: 0.625rem 1.5rem;
  background: var(--white);
  border-top: 1px solid var(--bg-light);
  display: flex;
  gap: 1rem;
  flex-shrink: 0;
  box-shadow: 0 -4px 6px var(--shadow);
}

.product-modal__footer .btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  padding: 0.625rem 1.25rem;
  white-space: nowrap;
  font-family: 'Poppins', sans-serif;
}

.product-modal__footer .btn-full {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

/* ========== ANIMATIONS ========== */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ========== RESPONSIVE ========== */

/* Tablet (768px+) */
@media (min-width: 768px) {
  .product-modal {
    padding: 2rem;
  }

  .product-modal__container {
    width: 90vw;
    max-width: 900px;
    height: 90vh;
    max-height: 850px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: scaleIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .product-modal__header {
    padding: 1.25rem 2.5rem;
  }

  .product-modal__title {
    font-size: 1.5rem;
    margin-right: 2.5rem;
  }

  .product-modal__description {
    font-size: 0.9rem;
  }

  .product-modal__close {
    top: 1rem;
    right: 1rem;
    width: 2.25rem;
    height: 2.25rem;
  }

  .product-modal__close i {
    font-size: 1.1rem;
  }

  .product-modal__tabs {
    padding: 0 2rem;
  }

  .product-modal__tab {
    padding: 1.25rem 1.75rem;
    font-size: 1rem;
  }

  .tabs-nav-btn {
    width: 2.25rem;
    height: 2.25rem;
  }

  .tabs-nav-btn i {
    font-size: 0.9rem;
  }

  .product-modal__body {
    padding: 1rem 2.5rem 2.5rem;
  }

  .category-images {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }

  .category-content {
    gap: 2.5rem;
  }

  .category-title {
    font-size: 1.5rem;
  }

  .product-modal__footer {
    padding: 0.75rem 2.5rem;
  }

  .product-modal__footer .btn {
    font-size: 0.9rem;
    padding: 0.75rem 1.5rem;
  }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
  .product-modal__container {
    width: 85vw;
    max-width: 1200px;
    height: 92vh;
    max-height: 1000px;
  }

  /* Nouveau layout desktop */
  .pdfs-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .images-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }

  /* Vue d'ensemble: 3 colonnes sur desktop pour voir les 6 catégories */
  .overview-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }

  .overview-grid .gallery-item {
    aspect-ratio: 5/3;
  }

  .overview-grid .overview-overlay h5 {
    font-size: 0.95rem;
  }

  .overview-grid .overview-overlay i {
    font-size: 1.25rem;
  }

  .overview-grid .overview-overlay {
    padding: 1rem;
  }

  /* Legacy styles */
  .category-content {
    flex-direction: row;
    gap: 3rem;
  }

  .category-text {
    flex: 0 0 40%;
    order: 1;
  }

  .category-images {
    flex: 1;
    order: 2;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
  }

  .product-modal__body {
    padding: 1.25rem 3rem 3rem;
  }

  .product-modal__header {
    padding: 1.5rem 3rem;
  }

  .product-modal__footer {
    padding: 0.875rem 3rem;
  }
}

/* Desktop large (1440px+) */
@media (min-width: 1440px) {
  .images-grid:not(.overview-grid) {
    grid-template-columns: repeat(3, 1fr);
  }

  .pdfs-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Animation scale pour desktop */
@media (min-width: 768px) {
  @keyframes scaleIn {
    from {
      transform: scale(0.9);
      opacity: 0;
    }
    to {
      transform: scale(1);
      opacity: 1;
    }
  }
}

/* ========== ACCESSIBILITY ========== */
@media (prefers-reduced-motion: reduce) {
  .product-modal__container,
  .product-modal__overlay,
  .category-image,
  .product-modal__tab {
    animation: none;
    transition: none;
  }
}

/* Focus visible */
.product-modal__close:focus-visible,
.product-modal__tab:focus-visible,
.product-modal__footer .btn:focus-visible {
  outline: 2px solid var(--secondary-color);
  outline-offset: 2px;
}

/* Print */
@media print {
  .product-modal__overlay,
  .product-modal__close,
  .product-modal__footer {
    display: none;
  }

  .product-modal__container {
    box-shadow: none;
    border: 1px solid var(--bg-light);
  }
}

/* Badge "Voir détails" sur mobile */
@media (max-width: 767px) {
  .product-card::after {
    content: 'Voir détails';
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    background: var(--secondary-color);
    color: var(--white);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    opacity: 0;
    transform: translateY(10px);
    transition: var(--transition);
    pointer-events: none;
  }

  .product-card:hover::after {
    opacity: 1;
    transform: translateY(0);
  }
}
