/**
 * Modern Product Archive Styles - Albarq Theme
 * Creative, animated product listing matching cart/checkout design
 * 
 * @package Albarq
 * @version 1.0.0
 */

/* ============================================
   Archive Wrapper & Container
   ============================================ */
.olympic-archive-wrapper {
  min-height: 100vh;
  background: var(--color-bg);
  padding: 0;
}

/* ============================================
   Archive Header - Animated
   ============================================ */
.archive-header {
  background: linear-gradient(135deg, var(--color-primary) 0%, #ff8ec7 100%);
  padding: 40px 0;
  margin-bottom: 40px;
  animation: slideDown 0.5s ease-out;
  box-shadow: 0 4px 20px rgba(255, 105, 180, 0.2);
}

/* Breadcrumbs */
.archive-breadcrumbs {
  margin-bottom: 24px;
}

.breadcrumb {
  margin: 0;
  padding: 0;
}

.breadcrumb-list {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.breadcrumb-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
}

.breadcrumb-item a {
  color: rgba(255, 255, 255, 0.9);
  transition: color 0.3s;
}

.breadcrumb-item a:hover {
  color: #ffffff;
}

.breadcrumb-separator {
  color: rgba(255, 255, 255, 0.6);
}

/* Archive Title Section */
.archive-title-section {
  display: flex;
  align-items: center;
  gap: 20px;
}

.archive-icon-wrapper {
  width: 80px;
  height: 80px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  animation: pulse 2s ease-in-out infinite;
  backdrop-filter: blur(10px);
}

.archive-icon-wrapper svg {
  color: #ffffff;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.archive-title-content {
  flex: 1;
}

.archive-title {
  font-size: 32px;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 8px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.archive-description {
  color: rgba(255, 255, 255, 0.95);
  font-size: 16px;
  margin: 0 0 12px;
  line-height: 1.6;
}

.archive-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.product-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.2);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-size: 14px;
  font-weight: 500;
  backdrop-filter: blur(10px);
}

.product-count svg {
  opacity: 0.8;
}

/* ============================================
   Subcategories Section
   ============================================ */
.subcategories-section {
  padding: 40px 0;
  animation: fadeInUp 0.6s ease-out 0.2s both;
}

.section-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title svg {
  color: var(--color-primary);
}

.subcategories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

.subcategory-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: all 0.3s ease;
  display: block;
}

.subcategory-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.subcategory-card__image {
  position: relative;
  padding-top: 75%;
  overflow: hidden;
  background: var(--color-bg);
}

.subcategory-card__image img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.subcategory-card:hover .subcategory-card__image img {
  transform: scale(1.1);
}

.subcategory-card__overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 105, 180, 0.9) 0%, rgba(255, 142, 199, 0.9) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.subcategory-card:hover .subcategory-card__overlay {
  opacity: 1;
}

.subcategory-card__arrow {
  color: #ffffff;
  transform: translateX(0);
  transition: transform 0.3s ease;
}

.subcategory-card:hover .subcategory-card__arrow {
  transform: translateX(-8px);
}

.subcategory-card__content {
  padding: 16px;
  text-align: center;
}

.subcategory-card__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 4px;
}

.subcategory-card__count {
  font-size: 13px;
  color: var(--color-muted);
}

/* ============================================
   Products Section
   ============================================ */
.archive-products-section {
  padding: 0 0 60px;
  animation: fadeInUp 0.6s ease-out 0.3s both;
}

/* Products Toolbar */
.products-toolbar {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  box-shadow: var(--shadow-card);
  flex-wrap: wrap;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.results-count {
  font-size: 14px;
  color: var(--color-muted);
  font-weight: 500;
}

/* View Toggle */
.view-toggle {
  display: flex;
  gap: 4px;
  background: var(--color-bg);
  padding: 4px;
  border-radius: var(--radius-sm);
}

.view-btn {
  background: transparent;
  border: none;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--color-muted);
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.view-btn:hover {
  color: var(--color-primary);
  background: rgba(255, 105, 180, 0.1);
}

.view-btn.active {
  background: var(--color-primary);
  color: #ffffff;
}

/* Sorting Dropdown */
.woocommerce-ordering {
  margin: 0;
}

.woocommerce-ordering select,
.orderby {
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-surface);
  cursor: pointer;
  transition: all 0.3s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 5l3 3 3-3' stroke='%23666' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
}

.woocommerce-ordering select:hover,
.orderby:hover {
  border-color: var(--color-primary);
}

.woocommerce-ordering select:focus,
.orderby:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(255, 105, 180, 0.1);
}

/* ============================================
   Products Grid
   ============================================ */
.products-grid-wrapper {
  animation: fadeInUp 0.6s ease-out 0.4s both;
}

.products,
ul.products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 24px;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ============================================
   Modern Product Card
   ============================================ */
.modern-product-card {
  list-style: none;
  margin: 0;
  padding: 0;
}

.product-card-inner {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: all 0.3s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
  animation: scaleIn 0.4s ease-out;
}

.modern-product-card:hover .product-card-inner {
  transform: translateY(-8px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

/* Product Image */
.product-image-wrapper {
  position: relative;
  overflow: hidden;
  background: var(--color-bg);
}

.product-image-link {
  display: block;
  position: relative;
  padding-top: 100%;
}

.product-thumbnail {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.product-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.modern-product-card:hover .product-thumbnail img {
  transform: scale(1.1);
}

.product-image-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.05) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modern-product-card:hover .product-image-overlay {
  opacity: 1;
}

/* Product Badges */
.product-badges {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  animation: bounceIn 0.5s ease-out;
}

.badge-sale {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.badge-featured {
  background: linear-gradient(135deg, var(--color-primary) 0%, #ff8ec7 100%);
}

.badge-out-of-stock {
  background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
}

/* Quick Actions */
.product-quick-actions {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  display: flex;
  gap: 8px;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 3;
}

.modern-product-card:hover .product-quick-actions {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.quick-action-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  color: var(--color-text);
}

.quick-action-btn:hover {
  background: var(--color-primary);
  color: #ffffff;
  transform: scale(1.1);
}

.quick-action-btn svg {
  flex-shrink: 0;
}

/* Product Info */
.product-info {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-category {
  font-size: 12px;
  color: var(--color-primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: inline-block;
  transition: color 0.3s;
}

.product-category:hover {
  color: #ff8ec7;
}

.product-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 8px;
  line-height: 1.4;
}

.product-title a {
  color: inherit;
  transition: color 0.3s;
}

.product-title a:hover {
  color: var(--color-primary);
}

/* Rating */
.product-rating {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}

.rating-stars {
  display: flex;
  align-items: center;
}

.rating-stars .star-rating {
  font-size: 14px;
}

.rating-count {
  font-size: 12px;
  color: var(--color-muted);
}

/* Price */
.product-price {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 12px;
}

.product-price del {
  font-size: 16px;
  color: var(--color-muted);
  font-weight: 400;
  margin-left: 8px;
}

.product-price ins {
  text-decoration: none;
}

/* Stock Status */
.product-meta {
  margin-bottom: 12px;
}

.stock-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
}

.stock-status.in-stock {
  color: var(--color-success);
}

.stock-status.out-of-stock {
  color: #ef4444;
}

/* Product Actions */
.product-actions {
  margin-top: auto;
}

.product-actions .button,
.product-actions .add_to_cart_button,
.product-actions .product-details-btn {
  width: 100%;
  padding: 12px 20px;
  background: linear-gradient(135deg, var(--color-primary) 0%, #ff8ec7 100%);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  display: block;
}

.product-actions .button:hover,
.product-actions .add_to_cart_button:hover,
.product-actions .product-details-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(255, 105, 180, 0.4);
}

.product-actions .button:active,
.product-actions .add_to_cart_button:active {
  transform: translateY(0);
}

/* Loading State */
.product-actions .button.loading::after,
.product-actions .add_to_cart_button.loading::after {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid #ffffff;
  border-top-color: transparent;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
  animation: spin 0.6s linear infinite;
}

/* ============================================
   No Products Found
   ============================================ */
.no-products-found {
  text-align: center;
  padding: 80px 20px;
  animation: fadeInUp 0.6s ease-out;
}

.no-products-icon {
  margin-bottom: 24px;
}

.no-products-icon svg {
  color: var(--color-muted);
  opacity: 0.5;
}

.no-products-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 12px;
}

.no-products-text {
  font-size: 16px;
  color: var(--color-muted);
  margin: 0 0 24px;
}

.btn-back-to-shop {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--color-primary);
  color: #ffffff;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-back-to-shop:hover {
  background: #ff8ec7;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(255, 105, 180, 0.3);
}

/* ============================================
   Pagination
   ============================================ */
.woocommerce-pagination {
  margin-top: 40px;
  text-align: center;
}

.woocommerce-pagination ul.page-numbers {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.woocommerce-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-weight: 500;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-card);
}

.woocommerce-pagination .page-numbers:hover {
  background: var(--color-primary);
  color: #ffffff;
  transform: translateY(-2px);
}

.woocommerce-pagination .page-numbers.current {
  background: var(--color-primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(255, 105, 180, 0.3);
}

/* ============================================
   Animations
   ============================================ */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================
   Responsive Design
   ============================================ */

/* Tablet */
@media (max-width: 1023px) {
  .archive-title {
    font-size: 28px;
  }
  
  .archive-icon-wrapper {
    width: 60px;
    height: 60px;
  }
  
  .products,
  ul.products {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
  }
  
  .subcategories-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}

/* Mobile */
@media (max-width: 767px) {
  .archive-header {
    padding: 24px 0;
  }
  
  .archive-title-section {
    flex-direction: column;
    text-align: center;
  }
  
  .archive-icon-wrapper {
    width: 50px;
    height: 50px;
  }
  
  .archive-title {
    font-size: 24px;
  }
  
  .archive-description {
    font-size: 14px;
  }
  
  .products-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .toolbar-left,
  .toolbar-right {
    width: 100%;
    justify-content: space-between;
  }
  
  .products,
  ul.products {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 12px;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Each product takes 50% width minus gap */
  .products li.product,
  ul.products li.product {
    flex: 0 0 calc(50% - 6px) !important;
    max-width: calc(50% - 6px) !important;
    width: calc(50% - 6px) !important;
  }

  /* Make odd last item appear in last row (centered) */
  .products li.product:last-child:nth-child(odd),
  ul.products li.product:last-child:nth-child(odd) {
    flex: 0 0 calc(50% - 6px) !important;
    max-width: calc(50% - 6px) !important;
    margin: 0 auto !important;
  }

  .subcategories-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .product-title {
    font-size: 14px;
  }
  
  .product-price {
    font-size: 18px;
  }
}

/* RTL Support */
[dir="rtl"] .breadcrumb-separator svg {
  transform: scaleX(-1);
}

[dir="rtl"] .subcategory-card:hover .subcategory-card__arrow {
  transform: translateX(8px);
}

[dir="rtl"] .woocommerce-ordering select,
[dir="rtl"] .orderby {
  background-position: right 12px center;
  padding: 8px 12px 8px 32px;
}

