/* --- Brand Variables --- */
:root {
  --primary-color: #d4a373; 
  --primary-hover: #bc8f63;
  --text-dark: #222222;
  --text-light: #777777;
  --light-bg: #f9f9f9;
  --border-color: #eaeaea;
  --danger: #d32f2f;
  --radius: 6px;
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.06);
  --transition: all 0.25s ease-in-out;
}

.shop-section {
  padding: 3rem 2rem;
  max-width: 1400px;
  margin: 0 auto;
  background-color: #ffffff;
}

/* --- Centered Page Header --- */
.shop-page-header {
  text-align: center;
  margin-bottom: 3.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.shop-page-header h1 {
  font-size: 2.5rem;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.shop-page-header p {
  color: var(--text-light);
  font-size: 1.1rem;
}

.shop-page-header::after {
  content: '';
  display: block;
  width: 60px;
  height: 3px;
  background: var(--primary-color);
  margin-top: 1rem;
  border-radius: 6px;
}

/* --- Layout --- */
.shop-container {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 3rem;
  align-items: start;
}

/* --- Sidebar Filters --- */
.shop-sidebar {
  background: #ffffff;
  padding: 1.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  position: sticky;
  top: 2rem;
}

.filter-toggle {
  display: none;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border-color);
  background: white;
  font-weight: 600;
  color: var(--text-dark);
  cursor: pointer;
  border-radius: var(--radius);
  transition: var(--transition);
}

.filter-toggle:hover {
  border-color: var(--primary-color);
}

.filter-toggle i {
  transition: transform 0.3s ease;
}

.filter-toggle.active i {
  transform: rotate(180deg);
}

.filter-form {
  display: block;
}

.filter-group {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}
.filter-group:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.filter-group h4 {
  font-size: 1.1rem;
  margin-bottom: 1.2rem;
  color: var(--text-dark);
  font-weight: 600;
}

/* Custom Checkboxes */
.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
  cursor: pointer;
  color: var(--text-light);
  font-size: 0.95rem;
  transition: var(--transition);
}

.filter-checkbox:hover {
  color: var(--text-dark);
}

.filter-checkbox input[type="checkbox"] {
  accent-color: var(--primary-color);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Price Range Slider */
.price-range {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.price-range input[type="range"] {
  width: 100%;
  accent-color: var(--primary-color);
}

.price-range p {
  font-size: 0.9rem;
  color: var(--text-light);
  display: flex;
  justify-content: space-between;
}
.price-range p strong {
  color: var(--text-dark);
  font-size: 1rem;
}

.shop-sidebar .btn {
  width: 100%;
  padding: 0.9rem;
  border-radius: 6px;
  font-weight: 600;
  margin-top: 1rem;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-align: center;
  display: block;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}
.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-dark);
  margin-top: 0.5rem !important;
}
.btn-secondary:hover {
  background: var(--light-bg);
}

/* --- Products Area --- */
.shop-products {
  flex: 1;
}

.shop-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 1rem;
}

.product-count {
  color: var(--text-light);
  font-size: 0.95rem;
}

.sort-select {
  padding: 0.6rem 2rem 0.6rem 1rem;
  border: 1px solid var(--border-color);
  background: white;
  cursor: pointer;
  border-radius: 6px;
  color: var(--text-dark);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
}
.sort-select:focus {
  border-color: var(--primary-color);
}
  
/* --- Product Grid & Cards --- */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 2rem;
}

.product-card {
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-color);
  transition: var(--transition);
  position: relative;
  display: flex;
  flex-direction: column;
  animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
}

.product-image {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--light-bg);
  overflow: hidden;
}

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

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

.product-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: var(--transition);
}

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

.product-overlay .btn-sm {
  background: white;
  color: var(--text-dark);
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transform: translateY(15px);
  transition: var(--transition);
}
.product-card:hover .product-overlay .btn-sm {
  transform: translateY(0);
}
.product-overlay .btn-sm:hover {
  background: var(--primary-color);
  color: white;
}

.badge-sale {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: var(--danger);
  color: white;
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 6px;
  letter-spacing: 0.5px;
  z-index: 2;
}

.wishlist-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: white;
  border: none;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-light);
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  transition: var(--transition);
  z-index: 2;
}
.wishlist-btn:hover, .wishlist-btn.active {
  color: var(--danger);
}

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

.product-info h3 {
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
  line-height: 1.4;
  min-height: 1.4em;
}

.product-info h3 a {
  color: var(--text-dark);
  text-decoration: none;
  transition: var(--transition);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.product-info h3 a:hover {
  color: var(--primary-color);
}

.product-price {
  margin-bottom: 1.2rem;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.price-current {
  color: var(--text-dark);
  font-weight: 700;
}
.price-original {
  color: var(--text-light);
  text-decoration: line-through;
  font-size: 0.9rem;
}

.quick-add {
  margin-top: auto;
}

.product-actions {
  display: flex;
  flex-direction: row;
  gap: 0.6rem;
  margin-top: 0.8rem;
}

.btn-add-cart,
.btn-buy-now {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  white-space: nowrap;
  line-height: 1.2;
  flex: 1 1 0;
  min-width: 0;
  padding: 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  transition: var(--transition);
}

.btn-add-cart {
  background: var(--light-bg);
  border: 1px solid var(--border-color);
  color: var(--text-dark);
}

.btn-add-cart:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.btn-buy-now {
  background: var(--primary-color);
  border: 1px solid var(--primary-color);
  color: white;
}

.btn-buy-now:hover {
  background: var(--white);
  color: var(--primary-color);
}

/* --- Pagination --- */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 3rem;
  flex-wrap: wrap;
}

.page-link {
  padding: 0.6rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-dark);
  text-decoration: none;
  transition: var(--transition);
  font-weight: 500;
}

.page-link:hover,
.page-link.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.page-link.disabled {
  background: transparent;
  color: var(--text-light);
  border-color: transparent;
  cursor: default;
}
.page-link.disabled:hover {
  background: transparent;
  color: var(--text-light);
}

/* --- Responsive Design --- */
@media (max-width: 1024px) {
  .shop-container {
    grid-template-columns: 240px 1fr;
    gap: 2rem;
  }
}

@media (max-width: 768px) {
  .shop-section {
    padding: 2rem 1rem;
  }
  .shop-container {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .shop-sidebar {
    position: static;
    padding: 0;
    border: none;
    background: transparent;
  }
  .filter-toggle {
    display: flex;
  }
  .filter-form {
    display: block;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transform: translateY(-10px);
    transition: max-height 0.4s ease, opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    background: white;
    padding: 0 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
  }
  .filter-form.open {
    max-height: 1200px; /* arbitrary large number */
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    padding: 1.5rem 1rem;
    margin-bottom: 1.5rem;
  }
  .products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
  }
}

/* Mobile: improve product card buttons for touch and readability */
@media (max-width: 480px) {
  .products-grid {
    grid-template-columns: 1fr; /* single column for better spacing */
    gap: 1rem;
  }

  .product-actions {
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.6rem;
  }

  .btn-add-cart,
  .btn-buy-now,
  .product-overlay .btn-sm {
    white-space: normal; /* allow text to wrap instead of overflowing */
    font-size: 0.88rem; /* slightly smaller on very small devices */
    padding: 0.7rem 0.7rem; /* reduced padding for compactness */
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
  }

  /* ensure overlay small button remains readable on small screens */
  .product-overlay .btn-sm {
    padding: 0.5rem 0.8rem;
    font-size: 0.88rem;
  }
}

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

/* Related / You May Also Like section styling */
.related-products {
  padding: 3rem 2rem;
  max-width: 1400px;
  margin: 0 auto;
}
.related-products h2 {
  font-size: 1.6rem;
  margin-bottom: 1.5rem;
  text-align: center;
  color: var(--text-dark);
}
.related-products .products-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.25rem;
}

@media (max-width: 1200px) {
  .related-products .products-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 992px) {
  .related-products .products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 576px) {
  .related-products .products-grid {
    grid-template-columns: 1fr;
  }
}

/* Tidy up card contents inside related products */
.related-products .product-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.related-products .product-info {
  padding: 1rem;
  text-align: left;
}
.related-products .product-info h3 {
  font-size: 0.97rem;
  margin-bottom: 0.4rem;
}
.related-products .product-price {
  margin-bottom: 0.6rem;
}
.related-products .product-actions {
  margin-top: auto;
}