/* Shop Page Layout - Enhanced */
.shop-container {
  display: flex;
  gap: 30px;
  padding: 40px 5%;
  background: var(--light-color);
  max-width: 1600px;
  margin: 0 auto;
}

/* Sidebar Improvements */
.filters-sidebar {
  width: 280px;
  background: var(--white);
  padding: 25px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  height: fit-content;
  position: sticky;
  top: 100px;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.sidebar-header h3 {
  font-family: var(--font-primary);
  font-size: 1.25rem;
  color: var(--dark-color);
  margin: 0;
}

.clear-btn {
  background: none;
  border: none;
  color: var(--primary-color);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 5px;
}

.filter-group {
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 1px solid #f0f0f0;
}

.filter-group:last-child {
  border-bottom: none;
}

.filter-title {
  font-size: 0.95rem;
  color: var(--dark-color);
  margin-bottom: 15px;
  font-weight: 600;
}

.filter-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text-color);
  cursor: pointer;
  position: relative;
  padding-left: 25px;
}

.filter-option input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.checkmark {
  position: absolute;
  left: 0;
  height: 16px;
  width: 16px;
  border: 1px solid #ddd;
  border-radius: 3px;
}

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

.filter-option input:checked~.checkmark {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.checkmark:after {
  content: "";
  position: absolute;
  display: none;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.filter-option input:checked~.checkmark:after {
  display: block;
}

/* Price Range */
.price-range {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.range-inputs {
  display: flex;
  align-items: center;
  gap: 10px;
}

.price-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.9rem;
}

.price-apply {
  width: 100%;
  padding: 8px;
  font-size: 0.85rem;
}

/* Color Options */
.color-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.color-option {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
}

.color-option:hover {
  transform: scale(1.1);
}

.color-option.selected {
  border-color: var(--dark-color);
  box-shadow: 0 0 0 2px white, 0 0 0 3px var(--dark-color);
}

/* Shop Main Content */
.shop-main {
  flex: 1;
}

.shop-header {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 30px;
}

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

.shop-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.search-bar {
  display: flex;
  align-items: center;
  background: var(--white);
  border-radius: 8px;
  overflow: hidden;
  flex: 1;
  max-width: 400px;
  border: 1px solid #e0e0e0;
}

.search-bar i {
  padding: 0 15px;
  color: var(--text-light);
}

.search-bar input {
  border: none;
  padding: 10px 15px 10px 0;
  font-size: 0.95rem;
  width: 100%;
}

.sort-dropdown {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

.sort-dropdown label {
  font-size: 0.9rem;
  color: var(--text-color, #7a6a62);
  white-space: nowrap;
}

/* Premium Custom Select dropdown */
.custom-select {
  position: relative;
  width: 220px;
  user-select: none;
}

.custom-select-trigger {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: var(--white, #ffffff);
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.92rem;
  color: var(--dark-color, #4d2e2e);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(158, 109, 78, 0.05);
  transition: all 0.2s ease;
}

.custom-select-trigger:hover {
  border-color: var(--primary-color, #9e6d4e);
}

.custom-select.open .custom-select-trigger {
  border-color: var(--primary-color, #9e6d4e);
  box-shadow: 0 0 0 2px rgba(158, 109, 78, 0.15);
}

.custom-select-trigger i {
  font-size: 0.75rem;
  color: var(--primary-color, #9e6d4e);
  transition: transform 0.2s ease;
}

.custom-select.open .custom-select-trigger i {
  transform: rotate(180deg);
}

.custom-options {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background-color: var(--white, #ffffff);
  border: 1px solid #e0d6cc;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(158, 109, 78, 0.12);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 999;
  animation: dropdownFadeIn 0.2s ease;
}

.custom-select.open .custom-options {
  display: flex;
}

.custom-option {
  padding: 10px 14px;
  font-size: 0.9rem;
  color: var(--text-color, #7a6a62);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.custom-option:hover {
  background-color: #faf6f0;
  color: var(--primary-color, #9e6d4e);
  padding-left: 18px;
  /* Smooth slide-in micro-animation */
}

.custom-option.selected {
  background-color: #f5ede6;
  color: var(--primary-color, #9e6d4e);
  font-weight: 600;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* Product Grid Enhancements */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 25px;
}

.product-card {
  background: var(--white);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  position: relative;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.product-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--primary-color);
  color: white;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  z-index: 2;
}

.product-image {
  position: relative;
  overflow: hidden;
  height: 250px;
  background-color: #faf6f0;
  /* Soft warm neutral background to blend margins */
  display: flex;
  align-items: center;
  justify-content: center;
}

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

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

.quick-view {
  position: absolute;
  bottom: -40px;
  left: 0;
  width: 100%;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  text-align: center;
  padding: 8px;
  font-size: 0.85rem;
  transition: bottom 0.3s ease;
  cursor: pointer;
}

.product-card:hover .quick-view {
  bottom: 0;
}

.product-info {
  padding: 15px;
}

.product-name {
  font-size: 1rem;
  color: var(--dark-color);
  margin-bottom: 8px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.product-rating {
  display: flex;
  align-items: center;
  gap: 3px;
  color: #FFA41C;
  font-size: 0.8rem;
}

.product-rating span {
  color: var(--text-light);
  margin-left: 3px;
}

.product-price {
  font-weight: 700;
  color: var(--primary-color);
  font-size: 1.1rem;
}

.product-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.wishlist-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--text-light);
  transition: color 0.2s ease;
}

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

.add-to-cart {
  padding: 8px 15px;
  font-size: 0.85rem;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-top: 50px;
}

.page-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid #ddd;
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.page-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

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

/* Base styles for mobile filter toggle components (hidden on desktop) */
.filter-toggle-btn {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: var(--primary-color, #9e6d4e);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  width: 100%;
  margin-bottom: 20px;
  box-shadow: 0 4px 10px rgba(158, 109, 78, 0.2);
  transition: all 0.3s ease;
}

.filter-toggle-btn:hover {
  background-color: #8c5d41;
  transform: translateY(-1px);
}

.close-sidebar-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--dark-color);
  cursor: pointer;
  padding: 5px;
  order: 2;
  /* Place close button between title and clear btn */
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  z-index: 999;
}


/* Responsive Design */
@media (max-width: 1200px) {
  .shop-container {
    padding: 30px 3%;
  }
}

@media (max-width: 992px) {
  .shop-container {
    flex-direction: column;
    padding: 20px 4%;
  }

  /* Display mobile filter trigger buttons */
  .filter-toggle-btn {
    display: flex;
  }

  .close-sidebar-btn {
    display: block;
  }

  /* Hide backdrop by default, show when sidebar active */
  .sidebar-backdrop.active {
    display: block;
  }

  /* Transform sidebar to slide-out drawer */
  .filters-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 290px;
    background-color: var(--white, #ffffff);
    padding: 25px 20px;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
    position: fixed;
    /* Keep stuck even if main page scrolls */
  }

  .filters-sidebar.active {
    transform: translateX(0);
  }

  .sidebar-header {
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 12px;
    margin-bottom: 20px;
  }

  .filter-group {
    flex: none;
    width: 100%;
  }

  .shop-header {
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
  }

  .shop-controls {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
  }

  .search-bar {
    max-width: 100%;
    flex: 1;
  }
}

@media (max-width: 576px) {
  .shop-container {
    padding: 15px 3%;
  }

  .shop-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .search-bar {
    width: 100%;
    max-width: 100%;
    border-radius: 8px;
    border: 1px solid #d9c4b3;
    background: var(--white, #ffffff);
  }

  .search-bar input {
    padding: 10px 15px 10px 0;
    font-size: 0.95rem;
  }

  .sort-dropdown {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
  }

  .sort-dropdown label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-color, #7a6a62);
    white-space: nowrap;
  }

  .custom-select {
    flex: 1;
    width: 100%;
  }

  .custom-select-trigger {
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #d9c4b3;
    font-size: 0.92rem;
    box-shadow: 0 1px 3px rgba(158, 109, 78, 0.05);
  }

  .custom-option {
    padding: 12px 14px;
    /* More finger-friendly targets on mobile */
    font-size: 0.92rem;
  }

  /* 2 Products in a row on mobile screen */
  .product-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

  /* Shorter height for mobile cards to remain proportioned */
  .product-image {
    height: 150px !important;
  }

  .product-info {
    padding: 10px;
  }

  /* Wrap names to 2 lines instead of clipping */
  .product-name {
    font-size: 0.85rem;
    line-height: 1.3;
    height: 2.6em;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 6px;
  }

  .product-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 10px;
  }

  .product-rating {
    font-size: 0.65rem;
    gap: 1px;
  }

  .product-rating span {
    margin-left: 2px;
  }

  .product-pricing {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px;
    margin: 0;
  }

  .offer-price {
    font-size: 0.95rem !important;
  }

  .mrp {
    font-size: 0.75rem !important;
    margin-left: 2px !important;
  }

  .discount {
    font-size: 0.7rem !important;
    margin-left: 2px !important;
    display: block;
    width: 100%;
    color: #28a745;
  }

  .product-actions {
    gap: 6px;
  }

  .wishlist-btn {
    font-size: 1rem;
  }

  .add-to-cart {
    padding: 6px 10px;
    font-size: 0.75rem;
    border-radius: 4px;
    flex: 1;
    text-align: center;
  }

  .out-of-stock-message {
    font-size: 0.75rem;
    margin-top: 4px;
  }
}

.product-card.inactive {
  opacity: 0.5;
  pointer-events: none;
  /* disable all interactions */
  position: relative;
}

.product-card.inactive::after {
  content: "Inactive";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 6px 15px;
  border-radius: 5px;
  font-weight: bold;
  font-size: 14px;
  z-index: 2;
}

.product-card.inactive .product-image::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.5);
}

.no-products-message {
  text-align: center;
  width: 100%;
  color: #777;
  font-size: 1.2rem;
  padding: 40px 20px;
}

.out-of-stock-message {
  color: red;
  font-weight: bold;
  margin-top: 8px;
}

.grayscale img {
  filter: grayscale(100%);
  opacity: 0.6;
  pointer-events: none;
}

.loading.active {
  display: block;
}

.product-card.out-of-stock {
  opacity: 0.7;
}

.discount {
  color: green;
  font-weight: bold;
  margin-left: 10px;
}

.offer-price {
  font-size: 1.2em;
  color: #e60000;
}

.mrp {
  text-decoration: line-through;
  color: #666;
  margin-left: 10px;
}

/* Default heart (not in wishlist) */
.wishlist-btn i.far {
  color: #4d2e2e;
  /* default */
  font-size: 18px;
  transition: color 0.3s ease, transform 0.2s ease;
}

.wishlist-btn.active i.fas {
  color: #e3c67e;
  /* when added to wishlist */
  transform: scale(1.2);
}

.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #333;
  color: white;
  padding: 12px 20px;
  border-radius: 4px;
  z-index: 9999;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast.success {
  background: #28a745;
}

.toast.error {
  background: #dc3545;
}

.toast.info {
  background: #17a2b8;
}