/**
 * Product Archive Styles
 * Unified styles for both main product archive and category pages
 */

/* Main container - Full width with reasonable margins */
.rd-shop-container {
  width: 100vw;
  max-width: 100vw;
  margin: 0;
  margin-left: calc(-50vw + 50%);
  margin-right: calc(-50vw + 50%);
  overflow-x: hidden;
  box-sizing: border-box;
}

/* Inner container for content */
.rd-shop-container .container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 30px;
}

.rd-back-to-shop-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #0073aa;
  text-decoration: none;
  background-color: #f5f5f5;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.rd-back-to-shop-link:hover {
  color: #005177;
  background-color: #e8e8e8;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.rd-back-icon {
  stroke: currentColor;
  stroke-width: 2px;
}

/* Hide the redundant "View all products" link on category pages */
.shop-all-products-link {
  display: none;
}

/* Shop header */
.rd-shop-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 30px;
  width: 100%;
  margin-top: 20px; /* Add margin above the header to separate from menu bar */
}

/* Category/Shop image */
.rd-category-image {
  flex: 0 0 40%;
  padding-right: 30px;
  margin-bottom: 20px;
  height: 300px; /* Fixed height */
  width: 300px; /* Fixed width for 3:2 aspect ratio */
  position: relative;
  background-color: #f8f9fa; /* Light background for empty space */
  border-radius: 8px;
}

.rd-category-image img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Category text content */
.rd-category-text {
  flex: 1;
  min-width: 300px;
  display: flex;
  flex-direction: column;
}

.rd-shop-title {
  margin-top: 0;
  margin-bottom: 15px;
  color: #333;
  font-size: 2em;
}

.rd-category-description {
  color: #555;
  line-height: 1.5;
}

/* Category navigation - now above header */
.rd-shop-categories {
  margin-bottom: 25px;
  margin-top: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: #fff;
  padding: 15px 0;
  border-bottom: 1px solid #eee;
  width: 100%;
  height: 60px; /* Fixed height to prevent jumping */
  display: flex;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.rd-category-list {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  list-style: none;
  padding: 0;
  margin: 0;
  justify-content: center;
  width: 100%;
}

.rd-category-item {
  margin: 0;
}

.rd-category-link {
  display: inline-block;
  padding: 6px 12px;
  background-color: #f0f0f0;
  color: #333;
  text-decoration: none;
  border-radius: 4px;
  transition: all 0.2s ease;
  font-size: 0.95em;
}

.rd-category-item.active .rd-category-link {
  background-color: #0073aa;
  color: white;
}

.rd-category-link:hover {
  background-color: #e0e0e0;
}

.rd-category-item.active .rd-category-link:hover {
  background-color: #005177;
}

/* Featured products section */
.rd-featured-products {
  margin-bottom: 40px;
}

.rd-section-title {
  margin-bottom: 20px;
  font-size: 1.5em;
  color: #333;
}

/* Product grid */
.rd-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin: 30px 0;
  justify-content: center;
}

/* Featured grid specific styling */
.rd-featured-grid {
  margin-bottom: 40px;
}

/* Ensure equal height cards in both category and main shop pages */
.rd-product-grid .shop-product-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* Make sure the content wrapper takes up remaining space */
.rd-product-grid .shop-product-card .shop-product-content-wrapper {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

/* Pagination */
.rd-pagination {
  margin-top: 30px;
  text-align: center;
}

.rd-page-numbers {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 5px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.rd-page-item {
  margin: 0;
}

.rd-page-item a,
.rd-page-item span {
  display: inline-block;
  padding: 8px 12px;
  background-color: #f0f0f0;
  color: #333;
  text-decoration: none;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.rd-page-item span.current {
  background-color: #0073aa;
  color: white;
}

.rd-page-item a:hover {
  background-color: #e0e0e0;
}

/* No products message */
.rd-no-products {
  text-align: center;
  padding: 30px;
  background-color: #f9f9f9;
  border-radius: 8px;
  margin-bottom: 30px;
}

/* Responsive styles */
@media (max-width: 1200px) {
  .rd-product-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

@media (max-width: 992px) {
  .rd-product-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }
}

@media (max-width: 768px) {
  .rd-shop-categories {
    overflow-x: auto;
    padding: 10px 0;
    height: auto;
    min-height: 60px;
  }

  .rd-category-list {
    justify-content: flex-start;
    min-width: max-content;
    padding: 0 10px;
  }

  .rd-category-image {
    flex: 0 0 100%;
    padding-right: 0;
    margin-bottom: 20px;
  }

  .rd-shop-header {
    flex-direction: column;
  }

  .rd-product-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
  }
}

@media (max-width: 576px) {
  .rd-category-list {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 5px;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
  }

  .rd-category-item {
    flex: 0 0 auto;
  }

  .rd-product-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 15px;
  }
}

/* Smallest screens */
@media (max-width: 480px) {
  .rd-product-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 15px;
  }

  .rd-shop-title {
    font-size: 1.5em;
  }

  .rd-section-title {
    font-size: 1.3em;
  }
}
