/* Shop Hero Section */
.shop-hero {
  background: linear-gradient(135deg, #051937, #004d7a);
  padding: 5rem 0 3rem;
  color: white;
  position: relative;
  overflow: visible;
  z-index: 100;
}

.shop-hero::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.3;
  pointer-events: none;
  z-index: 0;
}

.shop-title {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  font-weight: bold;
}

.shop-hero-image {
  position: relative;
  height: 100%;
}

.shop-hero-image img {
  max-height: 300px;
  position: absolute;
  right: -30px;
  bottom: -80px;
}

/* Search Container Styles */
.search-container {
  max-width: 450px;
  position: relative;
  z-index: 99999;
  isolation: isolate;
}

.search-form {
  position: relative;
  z-index: 99999;
}

.search-form .input-group {
  position: relative;
  z-index: 99999;
}

.search-input {
  position: relative;
  z-index: 99999;
}

.search-button {
  position: relative;
  z-index: 99999;
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100000;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  max-height: 400px;
  overflow-y: auto;
  margin-top: 0.5rem;
  animation: fadeIn 0.2s ease-out;
  isolation: isolate;
}

.search-result-item {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid #eee;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background-color: #f8f9fa;
}

.search-result-image {
  width: 60px;
  height: 60px;
  margin-right: 15px;
  flex-shrink: 0;
}

.search-result-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 4px;
}

.search-result-info {
  flex-grow: 1;
}

.search-result-name {
  font-weight: 500;
  margin-bottom: 4px;
  color: #2d3748;
}

.search-result-price {
  color: #3182ce;
  font-weight: 600;
  margin-bottom: 2px;
}

.search-result-category {
  font-size: 0.85rem;
  color: #718096;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Product Grid - Improved Layout */
.products-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 2.5rem;
  position: relative;
  z-index: 0;
}

/* Product Card - Enhanced Design */
.product-card {
  background-color: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  border: 1px solid rgba(0,0,0,0.05);
  margin-right: 0;
  z-index: 0;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 15px rgba(0,0,0,0.12);
}

/* Badge Styling - Changed to horizontal layout */
.product-card__badges {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  display: flex;
  flex-direction: row;
  gap: 5px;
  flex-wrap: wrap;
  max-width: 90%;
}

.product-card__badge {
  display: inline-block;
  padding: 0.25rem 0.4rem;
  font-size: 0.65rem;
  font-weight: 600;
  color: white;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  position: relative;
  z-index: 1;
}

.product-card__badge--new {
  background-color: #2ecc71;
}

.product-card__badge--featured {
  background-color: #3498db;
}

.product-card__badge--sale {
  background-color: #e74c3c;
}

/* Image Container - Full size without padding */
.product-card__image-container {
  position: relative;
  padding-top: 100%; /* 1:1 Aspect ratio */
  overflow: hidden;
  display: block;
  background-color: #f8f9fa;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.product-card__image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain; /* Keep this to maintain aspect ratio */
  padding: 0; /* Removed padding to make image take full container size */
  transition: transform 0.4s ease;
}

.product-card:hover .product-card__image {
  transform: scale(1.08);
}

.product-card__no-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #adb5bd;
  font-size: 2rem;
}

/* Card Content - Optimized for height */
.product-card__body {
  padding: 0.75rem; /* Reduced from 1.25rem */
  display: flex;
  flex-direction: column;
  flex-grow: 0; /* Changed to prevent body from taking too much space */
  gap: 0.5rem;
}

/* Title - Optimized space */
.product-card__title {
  font-size: 0.9rem; /* Slightly smaller */
  font-weight: 500;
  margin: 0;
  line-height: 1.3;
  height: 2.34rem; /* Exactly 2 lines */
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  text-overflow: ellipsis;
}

.product-card__title a {
  color: #2d3748;
  text-decoration: none;
}

.product-card__title a:hover {
  color: #3182ce;
}

/* Price Display - More compact */
.product-card__price {
  margin-top: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.product-card__original-price {
  color: #718096;
  font-size: 0.8rem;
  text-decoration: line-through;
}

.product-card__current-price {
  color: #2d3748;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
}

/* Action Buttons - Side by side */
.product-card__actions {
  margin-top: 0.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr; /* Two equal columns */
  gap: 0.4rem;
}

.product-card__actions .btn {
  font-size: 0.75rem;
  padding: 0.4rem 0.5rem;
  border-radius: 4px;
  white-space: nowrap;
}

/* Button icons alignment */
.product-card__actions .btn i {
  margin-right: 0.15rem;
}

/* Primary button styling */
.product-card__actions .btn-primary {
  background-color: #3182ce;
  border-color: #3182ce;
}

.product-card__actions .btn-primary:hover {
  background-color: #2c5282;
  border-color: #2c5282;
}

/* Secondary button styling */
.product-card__actions .btn-outline-secondary {
  color: #4a5568;
  border-color: #e2e8f0;
}

.product-card__actions .btn-outline-secondary:hover {
  background-color: #edf2f7;
  color: #2d3748;
}

/* Styling for button feedback states */
.product-card__actions .btn .spinner-border-sm,
#quickAddToCartBtn .spinner-border-sm {
    margin-right: 0.4em;
    vertical-align: -0.125em; /* Align spinner better with text */
}

.product-card__actions .btn i.bi,
#quickAddToCartBtn i.bi {
    margin-right: 0.3em;
    vertical-align: -0.1em; /* Adjust icon alignment */
}

.product-card__request-quote {
  font-weight: 600;
  color: var(--color-primary);
  font-style: italic;
}

.add-to-quote-btn {
  background-color: #28a745;
  border-color: #28a745;
  color: white;
}

.add-to-quote-btn:hover {
  background-color: #218838;
  border-color: #1e7e34;
}

/* Responsive adjustments for desktop screens */
@media (min-width: 1200px) {
  .products-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 992px) and (max-width: 1199.98px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 768px) and (max-width: 991.98px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .product-card__title {
    font-size: 0.9rem;
    height: 2.5rem;
  }
  
  .product-card__current-price {
    font-size: 1.1rem;
  }
}

/* The mobile styles will be handled in shop-mobile.css */

/* Filter Sidebar Styles */
.filter-sidebar {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  padding: 1.5rem;
  height: fit-content;
  position: sticky;
  top: 2rem;
  transition: all 0.3s ease;
}

.filter-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e2e8f0;
}

.filter-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
}

.filter-section {
  margin-bottom: 1.5rem;
}

.filter-section:last-child {
  margin-bottom: 0;
}

.filter-section-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.filter-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 200px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 #f1f5f9;
}

.filter-list::-webkit-scrollbar {
  width: 4px;
}

.filter-list::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 2px;
}

.filter-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 2px;
}

.filter-list::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.filter-item {
  margin-bottom: 0.75rem;
}

.filter-item:last-child {
  margin-bottom: 0;
}

.filter-checkbox {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-checkbox:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.filter-checkbox input[type="checkbox"] {
  display: none;
}

.filter-checkbox .checkbox-custom {
  width: 18px;
  height: 18px;
  border: 2px solid #cbd5e1;
  border-radius: 4px;
  margin-right: 0.75rem;
  position: relative;
  transition: all 0.2s ease;
}

.filter-checkbox input[type="checkbox"]:checked + .checkbox-custom {
  background: #0d6efd;
  border-color: #0d6efd;
}

.filter-checkbox input[type="checkbox"]:checked + .checkbox-custom::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.filter-checkbox .filter-label {
  font-size: 0.875rem;
  color: #475569;
  flex-grow: 1;
}

.filter-checkbox .filter-count {
  font-size: 0.75rem;
  color: #94a3b8;
  background: #f1f5f9;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.filter-actions {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}

.filter-actions .btn {
  width: 100%;
  padding: 0.75rem;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.filter-actions .btn-primary {
  background: #0d6efd;
  border-color: #0d6efd;
}

.filter-actions .btn-primary:hover {
  background: #0b5ed7;
  border-color: #0b5ed7;
}

.filter-actions .btn-link {
  color: #64748b;
  text-decoration: none;
  padding: 0.5rem;
  font-size: 0.875rem;
}

.filter-actions .btn-link:hover {
  color: #0d6efd;
  background: transparent;
}

/* Mobile Filter Styles */
@media (max-width: 991.98px) {
  .filter-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 1050;
    transform: translateX(-100%);
    border-radius: 0;
    overflow-y: auto;
  }

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

  .filter-header {
    position: sticky;
    top: 0;
    background: #fff;
    padding: 1rem;
    margin: -1.5rem -1.5rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .filter-header .btn-close {
    padding: 0.5rem;
    margin: -0.5rem;
  }

  .filter-actions {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding: 1rem;
    margin: 0 -1.5rem;
    border-top: 1px solid #e2e8f0;
  }
}

/* Active Filter Tags */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.filter-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  background: #f1f5f9;
  border-radius: 16px;
  font-size: 0.875rem;
  color: #475569;
}

.filter-tag .remove-filter {
  margin-left: 0.5rem;
  color: #64748b;
  cursor: pointer;
  transition: color 0.2s ease;
}

.filter-tag .remove-filter:hover {
  color: #ef4444;
}

/* Animation Classes */
.animate-fade-up {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s, transform 0.6s;
}

.animate-fade-left {
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.6s, transform 0.6s;
}

.animate-fade-up.in-view,
.animate-fade-left.in-view {
  opacity: 1;
  transform: translate(0);
}

.delay-100 {
  transition-delay: 0.1s;
}

.delay-200 {
  transition-delay: 0.2s;
}

.delay-300 {
  transition-delay: 0.3s;
}

/* Loader */
.loader-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

/* Loading Indicator */
#productLoader {
  display: none;
  text-align: center;
  padding: 2rem;
}

#productLoader .spinner-border {
  width: 3rem;
  height: 3rem;
  color: var(--primary-color);
}

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: 4px;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.product-card.skeleton {
  height: 400px;
  margin-bottom: 2rem;
}

.product-card.skeleton .product-card__image-container {
  height: 200px;
  background-color: #f0f0f0;
}

.product-card.skeleton .product-card__body {
  padding: 1rem;
}

.product-card.skeleton .product-card__title {
  height: 24px;
  width: 80%;
  margin-bottom: 0.5rem;
}

.product-card.skeleton .product-card__price {
  height: 20px;
  width: 40%;
  margin-bottom: 1rem;
}

.product-card.skeleton .product-card__actions {
  display: flex;
  gap: 0.5rem;
}

.product-card.skeleton .product-card__actions button {
  height: 36px;
  width: 120px;
}

/* Lazy Loading Placeholder */
.product-card__image.lazy {
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

.product-card__image.lazy.loaded {
  opacity: 1;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
  .product-card.skeleton {
    height: 300px;
  }
  
  .product-card.skeleton .product-card__image-container {
    height: 150px;
  }
  
  .product-card.skeleton .product-card__actions button {
    width: 100px;
  }
}

/*--------------------------------------------------------------
# Quick View Modal Styles
--------------------------------------------------------------*/
.quick-view-dialog {
  /* Optional: Increase max-width for larger modals on desktop */
  /* max-width: 900px; */ 
}

.quick-view-content-wrapper {
  border-radius: 0.5rem; /* Softer edges */
}

.quick-view-loader {
  min-height: 300px; /* Ensure loader takes up space */
  display: flex;
  align-items: center;
  justify-content: center;
}

.quick-view-carousel {
  border-radius: 0.375rem; /* Match Bootstrap's default */
  overflow: hidden; /* Ensure images stay within bounds */
  background-color: #f8f9fa; /* Light background for image area */
}

.quick-view-image {
  aspect-ratio: 1 / 1; /* Maintain square aspect ratio */
  object-fit: contain; /* Fit image within bounds without stretching */
  max-height: 400px; /* Limit image height */
  margin: auto; /* Center image if aspect ratio doesn't fill width */
}

/* Style carousel controls for better visibility */
.quick-view-carousel .carousel-control-prev-icon,
.quick-view-carousel .carousel-control-next-icon {
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
  background-size: 50% 50%;
}

/* Optional: Style carousel indicators */
.quick-view-carousel .carousel-indicators button {
  background-color: rgba(0, 0, 0, 0.5);
  border: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin: 0 5px;
}

.quick-view-carousel .carousel-indicators .active {
  background-color: var(--bs-primary); /* Use Bootstrap primary color */
}

.quick-view-price-section {
  line-height: 1.2;
}

#quickViewAvailability {
  font-size: 0.8rem;
  padding: 0.3em 0.6em;
}

.quick-view-quantity-selector .form-control {
  /* Prevent browser default spinners */
  -moz-appearance: textfield;
}
.quick-view-quantity-selector input[type=number]::-webkit-inner-spin-button, 
.quick-view-quantity-selector input[type=number]::-webkit-outer-spin-button { 
  -webkit-appearance: none; 
  margin: 0; 
}

/* Responsive adjustments */
@media (max-width: 991.98px) {
  .quick-view-carousel {
    margin-bottom: 1.5rem; /* Add space below image on mobile */
  }
  .quick-view-image {
    max-height: 300px; /* Slightly smaller image on mobile */
  }
}

@media (max-width: 575.98px) {
  .quick-view-dialog .modal-body {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .quick-view-dialog .modal-header {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .quick-view-quantity-selector .input-group {
    max-width: 100%; /* Allow quantity input to take full width */
  }
  .quick-view-content .d-sm-flex {
    flex-direction: column; /* Stack buttons vertically */
  }
}
