/* Updated: 2025-12-03 v2 */
/**
 * Product Carousel Block Styles
 *
 * Styles for the product carousel block including:
 * - Carousel container and controls
 * - Navigation buttons and pagination
 * - Product cards and swatches
 * - Category dropdown filter
 * - Responsive layouts
 */

/* ==========================================================================
   Carousel Section Container
   ========================================================================== */

.product-carousel-section {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto !important;
  padding: 0 20px 20px !important;
  position: relative;
  box-sizing: border-box;
}

.product-carousel-section.alignwide {
  max-width: 1400px;
}

/* ==========================================================================
   Carousel Controls (Top Bar)
   ========================================================================== */

.product-carousel-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 16px;
  flex-wrap: wrap;
  max-width: 100%;
}

.product-carousel-controls-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.product-carousel-controls-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Similar Products Section - centered heading with nav buttons */
.similar-products-section.product-carousel-section {
  margin-top: 5rem !important;
}

.similar-products-header {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.similar-products-heading {
  font-family: var(--font-primary, inherit);
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 500;
  color: var(--color-text-dark, #1a1a1a);
  margin: 0;
}

.similar-products-nav {
  display: flex;
  gap: 0.5rem;
}

.similar-products-nav .swiper-button-prev,
.similar-products-nav .swiper-button-next {
  position: relative;
  width: 44px;
  height: 44px;
  border: 2px solid #888;
  border-radius: 50%;
  background-color: #fff;
  cursor: pointer;
  margin: 0;
  top: auto;
  left: auto;
  right: auto;
}

.similar-products-nav .swiper-button-prev::after,
.similar-products-nav .swiper-button-next::after {
  font-size: 16px;
  font-weight: bold;
  color: #888;
}

/* ==========================================================================
   Category Dropdown
   ========================================================================== */

.product-carousel-category-select {
  padding: 10px 36px 10px 16px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23333' d='M1.41 0L6 4.59 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  appearance: none;
  cursor: pointer;
  min-width: 180px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.product-carousel-category-select:hover {
  border-color: #999;
}

.product-carousel-category-select:focus {
  outline: none;
  border-color: #0066cc;
  box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.1);
}

/* ==========================================================================
   "Se alla" Link
   ========================================================================== */

.product-carousel-see-all {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  text-decoration: none;
  text-transform: none;
  letter-spacing: 0.5px;
  transition: color 0.2s, opacity 0.2s;
  white-space: nowrap;
}

.product-carousel-see-all:hover {
  color: #0066cc;
  opacity: 0.8;
}

.product-carousel-see-all:focus {
  outline: 2px solid #0066cc;
  outline-offset: 4px;
}

/* ==========================================================================
   Swiper Navigation Buttons
   ========================================================================== */

.product-carousel .swiper-button-prev,
.product-carousel .swiper-button-next {
  position: relative;
  width: 40px;
  height: 40px;
  border: 2px solid #ddd;
  border-radius: 50%;
  background-color: #fff;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 0;
  top: auto;
  left: auto;
  right: auto;
  bottom: auto;
}

.product-carousel .swiper-button-prev::after,
.product-carousel .swiper-button-next::after {
  font-size: 16px;
  font-weight: bold;
  color: #333;
  transition: color 0.2s;
}

.product-carousel .swiper-button-prev:hover,
.product-carousel .swiper-button-next:hover {
  border-color: #333;
  background-color: #f8f8f8;
  transform: scale(1.05);
}

.product-carousel .swiper-button-prev:hover::after,
.product-carousel .swiper-button-next:hover::after {
  color: #0066cc;
}

.product-carousel .swiper-button-disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

.product-carousel .swiper-button-prev:focus,
.product-carousel .swiper-button-next:focus {
  outline: 2px solid #0066cc;
  outline-offset: 2px;
}

/* ==========================================================================
   Carousel Container & Wrapper
   ========================================================================== */

.product-carousel.swiper {
  width: 100%;
  max-width: 100%;
  padding: 0 0 60px 0;
  margin: 0;
  overflow: hidden;
}

.product-carousel .swiper-wrapper {
  display: flex;
  align-items: flex-start;
}

.product-carousel .swiper-slide {
  height: auto;
  width: 280px !important;
  max-width: 280px;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  flex-shrink: 0;
}

/* Hide filtered slides */
.product-carousel .swiper-slide.category-filtered {
  display: none !important;
}

/* ==========================================================================
   Product Cards
   ========================================================================== */

.product-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  min-height: auto;
  max-width: 280px;
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: visible;
  transition: none;
  box-shadow: none;
}

.product-card:hover {
  box-shadow: none;
  transform: none;
}

/* Product Thumbnail */
.product-carousel-section .product-card .product-thumb,
.product-carousel .product-card .product-thumb {
  position: relative;
  width: 280px;
  height: 300px;
  overflow: hidden;
  background: transparent;
  flex-shrink: 0;
  padding: 0;
  margin: 0;
  display: block;
  border: 5px solid #E5E5E5;
  border-radius: 4px;
  aspect-ratio: auto;
}

.product-carousel-section .product-card .product-thumb img,
.product-carousel-section .product-card .product-card-image,
.product-carousel .product-card .product-thumb img,
.product-carousel .product-card .product-card-image {
  width: 100%;
  height: 100%;
  object-fit: contain !important;
  object-position: center !important;
  transition: transform 0.3s ease;
  padding: 8px;
  margin: 0;
  background: transparent;
  display: block;
  box-sizing: border-box;
}

.product-card:hover .product-thumb img,
.product-card:hover .product-card-image {
  transform: scale(1.05);
}

/* Product Link */
.product-card .woocommerce-LoopProduct-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Product Meta */
.product-card .product-meta {
  padding: 12px 0 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 0 0 auto;
  width: 280px;
  min-height: auto;
  text-align: left !important;
  align-items: flex-start !important;
}

.product-card .product-title {
  font-size: 18px !important;
  font-weight: 400;
  margin: 0 0 2px;
  line-height: 1.3;
  color: #1d2327;
  transition: color 0.2s;
  order: 1;
  text-align: left !important;
  width: 100%;
  text-decoration: underline;
}

.product-card .product-category-label {
  font-size: 13px !important;
  text-transform: none;
  color: #999;
  letter-spacing: 0;
  font-weight: 400;
  margin: 0 0 2px;
  order: 2;
  text-align: left !important;
  width: 100%;
}

.product-card .product-title a {
  color: inherit;
  text-decoration: underline;
  text-align: left !important;
  display: block;
  width: 100%;
}

.product-card:hover .product-title a {
  color: #1d2327;
  text-decoration: underline;
}

.product-card .product-color-info {
  margin-top: 0;
  order: 3;
  width: 100%;
  text-align: left !important;
}

.product-card .product-color-count {
  font-size: 13px !important;
  color: #999;
  font-weight: 400;
  text-align: left !important;
  width: 100%;
}

/* ==========================================================================
   Product Card Color Swatches
   ========================================================================== */

.product-card-swatches {
  display: flex !important;
  gap: 8px;
  padding: 4px 0;
  flex-wrap: wrap;
  margin-top: 0;
  width: 280px;
  min-height: 32px;
  position: relative;
  z-index: 10;
}

.product-card-swatches button.product-card-swatch {
  display: inline-block !important;
  width: 24px !important;
  height: 24px !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.product-card-swatch {
  width: 24px !important;
  height: 24px !important;
  min-width: 24px;
  min-height: 24px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.25s ease;
  position: relative;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.product-card-swatch:hover {
  transform: scale(1.2);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  border-color: rgba(0, 0, 0, 0.2);
}

.product-card-swatch.active,
.product-card-swatch[aria-pressed="true"] {
  border-color: rgba(0, 0, 0, 0.4);
  border-width: 2.5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transform: scale(1.15);
}

.product-card-swatch:focus {
  outline: 2px solid #0066cc;
  outline-offset: 2px;
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.product-carousel-bottom {
  margin-top: 32px;
  margin-bottom: 0 !important;
  display: flex;
  justify-content: center;
}

.product-carousel .swiper-pagination {
  position: relative;
  display: flex;
  justify-content: center;
  gap: 8px;
}

.product-carousel .swiper-pagination-bullet {
  width: 10px;
  height: 10px;
  background: #ddd;
  opacity: 1;
  border-radius: 50%;
  transition: all 0.3s ease;
  cursor: pointer;
}

.product-carousel .swiper-pagination-bullet:hover {
  background: #999;
}

.product-carousel .swiper-pagination-bullet-active {
  background: #333;
  width: 28px;
  border-radius: 5px;
}

/* ==========================================================================
   Empty State
   ========================================================================== */

.product-carousel-empty-message {
  padding: 60px 20px;
  text-align: center;
  color: #666;
  font-size: 16px;
}

/* ==========================================================================
   Editor Preview Styles
   ========================================================================== */

.product-carousel-editor-preview {
  min-height: 300px;
  padding: 20px;
  background: #f9f9f9;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
}

/* ==========================================================================
   Responsive Styles
   ========================================================================== */

/* Tablet */
@media (max-width: 1023px) {
  .product-carousel-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .product-carousel-controls-left,
  .product-carousel-controls-right {
    justify-content: space-between;
    width: 100%;
  }

  .product-carousel-category-select {
    flex: 1;
    min-width: auto;
  }
}

/* Mobile */
@media (max-width: 767px) {
  .product-carousel-section {
    margin: 0 !important;
    padding: 0 1rem 10px !important;
  }

  .product-carousel-controls {
    margin-bottom: 16px;
  }

  .product-carousel-controls-right {
    flex-wrap: wrap;
  }

  .product-carousel .swiper-slide {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .product-card {
    min-height: auto;
    max-width: 100%;
    width: 100%;
  }

  .product-card .product-thumb {
    min-height: auto;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
  }

  .product-card .product-meta {
    padding: 16px 0;
    text-align: center !important;
    align-items: center !important;
    width: 100%;
  }

  .product-card .product-title {
    font-size: 18px !important;
    text-align: center !important;
  }

  .product-card .product-category-label {
    font-size: 13px !important;
    text-align: center !important;
  }

  .product-card .product-color-info {
    text-align: center !important;
  }

  .product-card .product-color-count {
    font-size: 14px !important;
    text-align: center !important;
  }

  .product-card-swatches {
    padding: 0 0 16px;
    gap: 6px;
    width: 100%;
    justify-content: center;
  }

  .product-card-swatch {
    width: 22px;
    height: 22px;
  }

  .product-carousel .swiper-button-prev,
  .product-carousel .swiper-button-next {
    width: 36px;
    height: 36px;
  }

  .product-carousel .swiper-button-prev::after,
  .product-carousel .swiper-button-next::after {
    font-size: 14px;
  }

  .product-carousel-bottom {
    margin-top: 24px;
    margin-bottom: 0 !important;
  }

  .product-carousel-see-all {
    font-size: 12px;
  }
}

/* Small Mobile */
@media (max-width: 480px) {
  .product-carousel-controls-right {
    gap: 8px;
  }

  .product-card-swatches {
    gap: 5px;
    padding: 10px 12px 12px;
  }

  .product-card-swatch {
    width: 20px;
    height: 20px;
  }
}
