/**
 * Advanced Product Slider Public Stylesheet
 * Premium, ultra-clean Ecommerce Aesthetics with equal-height cards and micro-animations.
 */

:root {
  --aps-main-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --aps-primary:#ffaa17;
  --aps-primary-hover: #000;
  --aps-card-bg: #ffffff;
  --aps-border: #f1f5f9;
  --aps-text-title: #0f172a;
  --aps-text-price: #ffaa17;
  --aps-text-muted: #64748b;
  --aps-rating-color: #f59e0b;
  --aps-btn-text: #ffffff;
  --aps-shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.03), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
  --aps-shadow-card-hover: 0 20px 25px -5px rgba(99, 102, 241, 0.08), 0 10px 10px -6px rgba(99, 102, 241, 0.04);
}

/* Outer Layout */
.aps-slider-outer-wrapper {
  font-family: var(--aps-main-font);
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

.aps-slider-outer-wrapper * {
  box-sizing: border-box;
}

/* Dynamic Filter Styling */
.aps-filter-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
  padding: 0 4px;
}

.aps-filter-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--aps-text-title);
}

.aps-custom-select-wrapper {
  position: relative;
  min-width: 200px;
}

.aps-category-select-filter {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 100%;
  padding: 10px 40px 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--aps-text-title);
  background-color: #ffffff;
  border: 1px solid var(--aps-border);
  border-radius: 20px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease-in-out;
}

.aps-category-select-filter:hover {
  border-color: var(--aps-primary);
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.05);
}

.aps-category-select-filter:focus {
  border-color: var(--aps-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.aps-custom-select-wrapper:after {
  content: "▼";
  font-size: 10px;
  color: var(--aps-text-muted);
  right: 18px;
  top: 13px;
  position: absolute;
  pointer-events: none;
}

/* Outer Container */
.aps-swiper-outer-container {
  position: relative;
  padding: 0px 4px 0px 4px;
}

/* Swiper Container Adjustments */
.aps-swiper-container {
  width: 100%;
  height: auto;
  border-radius: 12px;
}

.aps-swiper-slide {
  height: auto !important; /* Forces swiper cards to expand to match tallest card */
  display: flex !important;
}

/* 3. PREMIUM EQUAL HEIGHT PRODUCT CARD */
.aps-product-card {
  display: flex;
  flex-direction: column;
  background-color: var(--aps-card-bg);
  border: 1px solid var(--aps-border);
  border-radius: 12px;
  overflow: hidden;
  width: 100%;
  box-shadow: var(--aps-shadow-card);
  transition: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
}

.aps-product-card:hover {
  transform: translateY(-6px);
  border-color: rgba(99, 102, 241, 0.15);
  box-shadow: var(--aps-shadow-card-hover);
}

/* Image Container & Hover Zoom */
.aps-product-image-container {
  position: relative;
  width: 100%;
  padding-top: 100%; /* Perfect 1:1 Aspect Ratio Square */
  background-color: #fafafa;
  overflow: hidden;
  flex-shrink: 0;
}

.aps-product-link {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.aps-product-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.aps-product-card:hover .aps-product-img {
  transform: scale(1.06);
}

/* Details Section (Flex Fill) */
.aps-product-details-container {
  padding: 16px 20px 20px 20px;
  display: flex;
  flex-direction: column;
  flex: 1; /* Automatically expands and pushes card footer elements down */
  justify-content: space-between;
  gap: 10px;
}

/* Title Styling */
.aps-product-title {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2; /* Truncates long titles after 2 lines cleanly */
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 38px; /* Standardize baseline for titles */
}

.aps-product-title a {
  color: var(--aps-text-title);
  text-decoration: none;
  transition: color 0.15s ease;
}

.aps-product-title a:hover {
  color: var(--aps-primary);
}

/* Rating Stars */
.aps-product-rating {
  font-size: 12px;
  color: var(--aps-rating-color);
  min-height: 16px;
  display: flex;
  align-items: center;
}

.aps-product-rating .star-rating {
  font-size: 12px;
  width: 75px;
  height: 16px;
  font-family: star;
  position: relative;
  display: inline-block;
  overflow: hidden;
}

.aps-product-rating .star-rating:before {
  content: "\s\s\s\s\s";
  color: #d3ced2;
  position: absolute;
  top: 0;
  left: 0;
}

.aps-product-rating .star-rating span {
  overflow: hidden;
  float: left;
  top: 0;
  left: 0;
  position: absolute;
  padding-top: 1.5em;
}

.aps-product-rating .star-rating span:before {
  content: "\S\S\S\S\S";
  color: var(--aps-rating-color);
  position: absolute;
  top: 0;
  left: 0;
}

/* Price Formatting */
.aps-product-price {
  font-size: 16px;
  font-weight: 700;
  color: var(--aps-text-price);
  margin-top: 2px;
}

.aps-product-price del {
  color: var(--aps-text-muted);
  font-size: 13px;
  font-weight: 500;
  margin-right: 6px;
}

.aps-product-price ins {
  background: none;
  text-decoration: none;
}

/* Action Buttons (Add to Cart) */
.aps-product-actions {
  margin-top: auto; /* Push add-to-cart down */
  padding-top: 6px;
}

.aps-add-to-cart-button {
  display: inline-block;
  width: 100%;
  padding: 6px 10px;
  background: var(--aps-primary);
  color: var(--aps-btn-text) !important;
  text-align: center;
  border-radius: 4px;
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.15);
  cursor: pointer;
  border: none;
  outline: none;
}

.aps-add-to-cart-button:hover {
  background: var(--aps-primary-hover);
  box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.25);
  transform: translateY(-1px);
}

.aps-add-to-cart-button:active {
  transform: translateY(1px);
}

/* Navigation Arrows */
.aps-swiper-button-prev,
.aps-swiper-button-next {
  width: 44px;
  height: 44px;
  background-color: #ffffff;
  border: 1px solid var(--aps-border);
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  color: var(--aps-text-title) !important;
  transition: all 0.2s ease-in-out;
}

.aps-swiper-button-prev:after,
.aps-swiper-button-next:after {
  font-size: 16px !important;
  font-weight: bold;
}

.aps-swiper-button-prev:hover,
.aps-swiper-button-next:hover {
  background-color: var(--aps-primary);
  color: #ffffff !important;
  border-color: var(--aps-primary);
  box-shadow: 0 6px 15px rgba(99, 102, 241, 0.25);
}

.aps-swiper-button-prev {
  left: -20px !important;
}

.aps-swiper-button-next {
  right: -20px !important;
}

/* Pagination Dots */
.aps-swiper-pagination {
  bottom: 0px !important;
}

.aps-swiper-pagination .swiper-pagination-bullet {
  background: var(--aps-text-muted) !important;
  opacity: 0.25;
  width: 7px;
  height: 7px;
  margin: 0 5px !important;
  transition: all 0.2s;
}

.aps-swiper-pagination .swiper-pagination-bullet-active {
  background: var(--aps-primary) !important;
  opacity: 1;
  width: 18px;
  border-radius: 4px;
}

/* State Handlers: Loading & Error Banners */
.aps-no-products-found {
  background: #f8fafc;
  border: 1px solid var(--aps-border);
  padding: 40px;
  border-radius: 12px;
  text-align: center;
  color: var(--aps-text-muted);
}

.aps-swiper-outer-container.aps-loading {
  opacity: 0.55;
  transition: opacity 0.2s;
  pointer-events: none;
}

/* RTL (Right to Left Alignment Support) */
.aps-rtl {
  direction: rtl;
}

.aps-rtl .aps-category-select-filter {
  padding: 10px 16px 10px 40px;
}

.aps-rtl .aps-custom-select-wrapper:after {
  left: 18px;
  right: auto;
}

.aps-rtl .aps-product-details-container {
  text-align: right;
}

.aps-rtl .aps-swiper-button-prev {
  left: auto !important;
  right: -20px !important;
}

.aps-rtl .aps-swiper-button-next {
  right: auto !important;
  left: -20px !important;
}

/* Mobile & Tablet Responsiveness Overrides */
@media (max-width: 768px) {
  .aps-swiper-button-prev,
  .aps-swiper-button-next {
    display: none !important; /* Hide arrows on touch screens, swipe gesture is active */
  }
  .aps-swiper-outer-container {
    padding-bottom: 25px;
  }
}
