/* Shop by Category Frontend Styles */
.sbc-shop-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.sbc-header {
  text-align: center;
  margin-bottom: 40px;
}

.sbc-header h2 {
  font-size: 2.5rem;
  color: #2c3e50;
  margin-bottom: 10px;
  font-weight: 700;
  letter-spacing: .2px;
}

.sbc-header p {
  font-size: 1.1rem;
  color: #7f8c8d;
  margin: 0;
}

/* Tabs */
.sbc-tabs {
  display: flex;
  justify-content: center;
  margin-bottom: 40px;
  border-bottom: 2px solid #ecf0f1;
  flex-wrap: wrap;
  gap: 5px;
}

.sbc-tab-btn {
  background: white;
  border: none;
  padding: 15px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #7f8c8d;
  cursor: pointer;
  transition: all 0.3s ease;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  justify-content: center;
}

.sbc-tab-btn:hover {
  color: #2c3e50;
  background-color: #f8f9fa;
}

.sbc-tab-btn.active {
  background-color: #fffacd;
  color: #2c3e50;
  border-bottom-color: #f0e68c;
}

.sbc-category-icon-img {
  width: 24px;
  height: 24px;
  object-fit: cover;
  border-radius: 4px;
}

.sbc-category-icon-emoji {
  font-size: 1.2rem;
  display: inline-block;
}

.sbc-no-products {
  text-align: center;
  padding: 60px 20px;
  color: #7f8c8d;
  background: #f8f9fa;
  border-radius: 12px;
  border: 2px dashed #dee2e6;
}

.sbc-no-products p {
  font-size: 1.1rem;
  margin: 0;
}

.sbc-no-products a {
  color: #e67e22;
  text-decoration: none;
  font-weight: 600;
}

.sbc-no-products a:hover {
  text-decoration: underline;
}

.sbc-combo-filters {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.sbc-filter-btn {
  background: #f8f9fa;
  border: 2px solid #e9ecef;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #6c757d;
  cursor: pointer;
  transition: all 0.3s ease;
}

.sbc-filter-btn:hover {
  background: #e9ecef;
  color: #495057;
}

.sbc-filter-btn.active {
  background: #fffacd;
  border-color: #f0e68c;
  color: #2c3e50;
}

/* Content */
.sbc-category-content {
  display: none;
}

.sbc-category-content.active {
  display: block;
}

.sbc-category-header {
  text-align: center;
  margin-bottom: 30px;
}

.sbc-category-header h3 {
  font-size: 2rem;
  color: #2c3e50;
  margin-bottom: 10px;
  font-weight: 600;
  font-size: 1.5rem;
}

.sbc-category-header p {
  font-size: 1rem;
  color: #7f8c8d;
  margin: 0;
}

/* Fixed desktop 4-column grid by removing conflicting auto-fit rule */
.sbc-products-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-top: 30px;
  justify-content: center;
}

.sbc-products-grid.single-product {
  grid-template-columns: 1fr;
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
}

.sbc-products-grid.two-products {
  grid-template-columns: repeat(2, 1fr);
  max-width: 650px;
  margin-left: auto;
  margin-right: auto;
}

/* Redesigned product card with improved hover overlay system */
.sbc-product-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  width: 100%;
  height: 320px;
  cursor: pointer;
  border-radius: 14px;
}

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

/* Added missing desktop hover rule to show overlay */
.sbc-product-card:hover .sbc-product-info {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Fixed image display to prevent cropping */
.sbc-product-image {
  height: 100%;
  width: 100%;
  overflow: hidden;
  position: relative;
}

.sbc-product-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: white;
  transition: transform 0.3s ease;
  padding: 10px;
}

.sbc-placeholder-image {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}

.sbc-placeholder-image .sbc-category-icon-img {
  width: 60px;
  height: 60px;
}

.sbc-placeholder-image .sbc-category-icon-emoji {
  font-size: 3rem;
}

/* Enhanced discount badge */
.sbc-discount-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: white;
  padding: 4px 8px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  z-index: 5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}

/* Completely redesigned hover overlay with beautiful gradient and better typography */
.sbc-product-info {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.3) 40%,
    rgba(255, 255, 255, 0.65) 100%
  );
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #2c3e50;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 20px 15px 15px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  box-sizing: border-box;
}

/* Enhanced pricing display with better contrast and modern styling */
.sbc-product-pricing {
  display: block;
}

.sbc-product-pricing .sbc-regular-price {
  display: block;
  margin: 0 0 4px;
  opacity: 0.95;
  color: #1f2937;
  text-decoration: line-through;
  text-decoration-color: #ef4444;
  text-decoration-thickness: 3px;
  text-underline-offset: 2px;
  text-shadow: none;
}

.sbc-product-pricing .sbc-sale-price {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  color: #27ae60;
  margin-bottom: 5px;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.sbc-product-price {
  font-size: 1.5rem;
  font-weight: 800;
  color: #2c3e50;
  margin-bottom: 10px;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.sbc-product-stock {
  margin-bottom: 15px;
}

.sbc-in-stock {
  color: #27ae60;
  font-size: 0.9rem;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.sbc-out-of-stock {
  color: #e74c3c;
  font-size: 0.9rem;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

/* Enhanced add to cart button with modern gradient design */
.sbc-add-to-cart {
  width: 100%;
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: white;
  border: none;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sbc-add-to-cart:hover:not(:disabled) {
  background: linear-gradient(135deg, #2980b9, #1f5f8b);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(31, 95, 139, 0.4);
}

.sbc-add-to-cart:disabled {
  background: linear-gradient(135deg, #bdc3c7, #95a5a6);
  cursor: not-allowed;
  box-shadow: none;
}

/* actions layout and Read More button */
.sbc-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: stretch;
  margin-top: 8px;
}

.sbc-read-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  border: 2px solid #e9ecef;
  color: #2c3e50;
  background: #ffffff;
  text-decoration: none;
  transition: all .25s ease;
}

.sbc-read-more:hover {
  border-color: #3498db;
  color: #1f5f8b;
  box-shadow: 0 4px 14px rgba(31, 95, 139, 0.15);
}

/* Introductory price badge styling (A2 Ghee section only uses it) */
.sbc-intro-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  font-size: 0.78rem;
  font-weight: 800;
  color: #92400e;
  background: rgba(253, 230, 138, 0.85);
  border: 1px solid #f59e0b;
  border-radius: 9999px;
  padding: 4px 10px;
  margin: 2px 0 8px 0;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.85);
}

/* Ensure good contrast when shown on the semi-transparent overlay */
.sbc-product-info .sbc-intro-badge {
  backdrop-filter: saturate(1.2);
  -webkit-backdrop-filter: saturate(1.2);
}

/* Mobile: slightly larger pill for touch readability */
@media (max-width: 768px) {
  .sbc-shop-container {
    padding: 15px;
    /* Improved mobile layout to prevent full-screen occupation and allow better scrolling */
    max-height: none;
    overflow: visible;
  }

  .sbc-header h2 {
    font-size: 2rem;
  }

  /* Mobile tabs in 2x2 grid layout to prevent text cropping */
  .sbc-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 12px;
    justify-content: center;
    padding-bottom: 0;
    max-width: 400px;
    margin: 0 auto 40px;
  }

  .sbc-tab-btn {
    padding: 12px 8px;
    font-size: 0.85rem;
    flex: none;
    min-width: 0;
    text-align: center;
    border-radius: 12px;
    border: 2px solid #e9ecef;
    border-bottom: 2px solid #e9ecef;
    background: #f8f9fa;
  }

  .sbc-tab-btn:hover {
    color: #2c3e50;
    background-color: #f8f9fa;
  }

  .sbc-tab-btn.active {
    background-color: #fffacd;
    border-color: #f0e68c;
  }

  .sbc-products-grid {
    grid-template-columns: 1fr;
    gap: 25px; /* Reduced gap to prevent excessive spacing that causes scrolling issues */
    max-width: 100%;
    margin: 30px auto 0;
    /* Ensure grid doesn't occupy full viewport height */
    min-height: auto;
  }

  .sbc-products-grid.single-product,
  .sbc-products-grid.two-products {
    grid-template-columns: 1fr;
    max-width: 100%;
  }

  /* Improved mobile overlay positioning to not interfere with scrolling */
  .sbc-product-info {
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(
      180deg,
      rgba(255, 255, 255, 0) 0%,
      rgba(255, 255, 255, 0.4) 40%,
      rgba(255, 255, 255, 0.75) 100%
    );
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #2c3e50;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* Faster transition for better responsiveness */
    box-sizing: border-box;
    z-index: 10;
    pointer-events: none; /* Prevent overlay from blocking scroll gestures when hidden */
    /* Ensure overlay doesn't interfere with document scrolling */
    touch-action: none;
  }

  /* Enable pointer events and touch action only when overlay is active */
  .sbc-product-card.active .sbc-product-info {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
    touch-action: auto; /* Allow normal touch interactions when overlay is visible */
  }

  /* Ensure buttons are always clickable with higher z-index */
  .sbc-product-info .sbc-add-to-cart,
  .sbc-product-info .sbc-read-more {
    position: relative;
    z-index: 15;
    pointer-events: auto;
    touch-action: manipulation; /* Improve touch responsiveness */
  }

  .sbc-product-card {
    height: 280px; /* Slightly reduced height to fit more content on screen */
    /* Ensure cards don't interfere with scrolling */
    touch-action: pan-y; /* Allow vertical scrolling */
  }

  /* Mobile combo filters without scrollbar */
  .sbc-combo-filters {
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0;
  }

  .sbc-filter-btn {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 8px 12px;
    font-size: 0.8rem;
  }

  /* Enhanced actions layout with better touch targets */
  .sbc-actions {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 6px;
    position: relative;
    z-index: 15; /* Ensure actions are above overlay */
  }

  .sbc-read-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px 10px; /* Increased padding for better touch targets */
    border-radius: 8px;
    font-size: 0.85rem; /* Slightly larger font for better readability */
    font-weight: 700;
    border: 2px solid #e9ecef;
    color: #2c3e50;
    background: #ffffff;
    text-decoration: none;
    transition: all .25s ease;
    position: relative;
    z-index: 15;
    touch-action: manipulation; /* Improve touch responsiveness */
    min-height: 44px; /* Ensure minimum touch target size */
  }

  .sbc-read-more:hover {
    border-color: #3498db;
    color: #1f5f8b;
    box-shadow: 0 4px 14px rgba(31, 95, 139, 0.15);
  }

  .sbc-add-to-cart {
    width: 100%;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 12px 10px; /* Increased padding for better touch targets */
    border-radius: 8px;
    font-size: 0.85rem; /* Slightly larger font for better readability */
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    z-index: 15;
    touch-action: manipulation; /* Improve touch responsiveness */
    min-height: 44px; /* Ensure minimum touch target size */
  }
}

/* Tablet breakpoint for 2-column grid */
@media (max-width: 1024px) and (min-width: 769px) {
  .sbc-products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
  }

  .sbc-product-card {
    height: 350px;
  }
}

/* Large desktop breakpoint for better 4-column spacing */
@media (min-width: 1200px) {
  .sbc-products-grid {
    gap: 30px;
  }
}

@media (max-width: 480px) {
  .sbc-tab-btn {
    padding: 10px 6px;
    font-size: 0.75rem;
  }

  .sbc-products-grid {
    max-width: 100%;
    margin: 30px 0 0;
    gap: 30px; /* Added specific gap for smaller screens */
  }

  .sbc-product-info {
    padding: 10px; /* Further reduced padding for very small screens */
  }

  .sbc-product-info h4 {
    font-size: 0.95rem; /* Further reduced font size for small screens */
  }
}

.sbc-product-pricing del,
.sbc-product-info del {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  color: #111827;
  text-decoration: line-through;
  text-decoration-color: #ef4444;
  text-decoration-thickness: 3px;
  text-underline-offset: 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  text-shadow: none;
}

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

/* Combo specific styles */
.sbc-combo-card {
  border: 2px solid #f39c12;
}

.sbc-intro-badge {
  position: relative;
  z-index: 4;
  background: #fde68a;
  border: 1px solid #f59e0b;
  color: #7c2d12;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  font-weight: 800;
}

.sbc-product-info .sbc-intro-badge {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

#honey .sbc-product-pricing .sbc-regular-price {
  visibility: visible !important;
  opacity: 1 !important;
}
