/* Admin: Product Search Autocomplete Styling */
.product-showcase-search-wrapper {
  margin: 1rem 0;
}

.product-showcase-search-wrapper .form-item {
  margin-bottom: 1rem;
}

.product-showcase-search-wrapper input.product-showcase-search {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #dee2e6;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.2s ease;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%23999' d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: calc(100% - 1rem) center;
  background-size: 18px;
  padding-right: 3rem;
}

.product-showcase-search-wrapper input.product-showcase-search:focus {
  border-color: #0d6efd;
  outline: none;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Style autocomplete dropdown */
#autocomplete {
  border: 2px solid #0d6efd;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  margin-top: 0.25rem;
  background: #fff;
  max-height: 300px;
  overflow-y: auto;
}

#autocomplete li {
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background-color 0.15s ease;
  border-bottom: 1px solid #f1f3f5;
}

#autocomplete li:last-child {
  border-bottom: none;
}

#autocomplete li:hover {
  background-color: #f8f9fa;
}

#autocomplete li.is-selected {
  background-color: #e7f1ff;
  color: #0d6efd;
}

/* Product showcase frontend */
.product-showcase {
  padding: 2rem 0;
  margin: 0 auto;
  --button-bg-color: #e74c3c;
  --price-color: #e74c3c;
  position: relative;
}

.product-showcase__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding: 0 1rem;
}

.product-showcase__title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #333;
  margin: 0;
}

.product-showcase__navigation {
  display: flex;
  gap: 0.5rem;
}

.product-showcase__nav-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid #dee2e6;
  background: white;
  color: #495057;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}

.product-showcase__nav-btn:hover {
  border-color: #0d6efd;
  color: #0d6efd;
  background: #f8f9fa;
}

.product-showcase__nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  border-color: #dee2e6;
  color: #adb5bd;
}

.product-showcase__nav-btn:disabled:hover {
  border-color: #dee2e6;
  color: #adb5bd;
  background: white;
}

.product-showcase__nav-btn svg {
  width: 20px;
  height: 20px;
}

.product-showcase__wrapper {
  position: relative;
}

.product-showcase__grid {
  display: flex;
  overflow-x: auto;
  scroll-behavior: smooth;
  gap: 1rem;
  padding: 0 1rem 1rem;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.product-showcase__grid::-webkit-scrollbar {
  display: none;
}

.product-card {
  flex: 0 0 220px;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  position: relative;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.product-card__link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.product-card__image {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: #f8f9fa;
  overflow: hidden;
}

.product-card__image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.product-card__no-image {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.product-card__content {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-card__title {
  font-size: 0.875rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  color: #333;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
}

.product-card__reference {
  font-size: 0.75rem;
  color: #666;
  margin: 0 0 0.5rem 0;
  font-weight: 500;
  font-style: italic;
}

.product-card__price-wrapper {
  margin-top: auto;
  margin-bottom: 1rem;
}

/* Style Commerce's default price field */
.product-card__price-wrapper .field--name-price {
  margin: 0;
}

/* Original price (crossed out) - must come first to be overridden */
.product-card__price-wrapper .price--original,
.product-card__price-wrapper .price--original *,
.product-card__price-wrapper [class*="original"],
.product-card__price-wrapper [class*="original"] *,
.product-card__price-wrapper del,
.product-card__price-wrapper del * {
  font-size: 0.875rem !important;
  color: #999 !important;
  text-decoration: line-through !important;
  display: block;
  margin-bottom: 0.25rem;
  font-weight: normal !important;
}

/* Current/discounted price - show in blue (must come after original to override) */
.product-card__price-wrapper .field__item {
  font-size: 1.25rem !important;
  font-weight: 700 !important;
  color: #0d6efd !important;
  margin: 0;
}

/* Target only the non-deleted price text */
.product-card__price-wrapper .field__item > *:not(del):not([class*="original"]),
.product-card__price-wrapper .field__item ins,
.product-card__price-wrapper .field__item ins *,
.product-card__price-wrapper .price--calculated,
.product-card__price-wrapper .price--calculated * {
  color: #0d6efd !important;
}

.product-card__add-to-cart-form {
  width: 100%;
  margin: 0;
}

.product-card__add-to-cart {
  width: 100%;
  padding: 0.75rem;
  background: var(--button-bg-color, #e74c3c) !important;
  color: white;
  border: none;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: filter 0.3s ease, transform 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.product-card__add-to-cart:hover {
  filter: brightness(0.85);
  transform: translateY(-1px);
}

.product-card__add-to-cart svg {
  width: 16px;
  height: 16px;
}

.product-showcase__empty {
  text-align: center;
  padding: 3rem 1rem;
  color: #666;
  font-size: 1rem;
}

@media (max-width: 768px) {
  .product-card {
    flex: 0 0 180px;
  }
  
  .product-showcase__title {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .product-card {
    flex: 0 0 160px;
  }
  
  .product-card__content {
    padding: 0.75rem;
  }
  
  .product-card__title {
    font-size: 0.8125rem;
  }
  
  .product-card__price {
    font-size: 1.125rem;
  }
  
  .product-card__add-to-cart {
    padding: 0.625rem;
    font-size: 0.8125rem;
  }
  
  .product-showcase__header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
  
  .product-showcase__title {
    font-size: 1.5rem;
  }
  
  .product-showcase__navigation {
    align-self: flex-end;
  }
  
  .product-showcase__nav-btn {
    width: 36px;
    height: 36px;
  }
  
  .product-showcase__nav-btn svg {
    width: 18px;
    height: 18px;
  }
}
