body.has-sidebar .main {
  margin-top: 104px !important; /* 60px (main header) + 44px (sub-header) */
  padding: 20px 20px 20px 244px; /* Add left padding to offset sidebar width (220px + 24px gap) */
  width: 100%; /* Remove max-width for true fluid layout */
  margin-left: 0;
  margin-right: 0;
  box-sizing: border-box;
  overflow-x: hidden; /* Prevent horizontal scroll */
  margin-bottom: 100px; /* Consistent margin between main content and footer */
}

/* Default main content styling for pages without sidebar */
.main {
  margin-top: 104px !important;
  padding: 20px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
  margin-bottom: 100px;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* Use auto-fit for responsive columns */
  gap: 0; /* Remove all gaps between containers */
  align-items: stretch; /* Ensure all items have same height */
  justify-items: stretch; /* Ensure all items have same width */
  width: 100%;
  min-width: 0; /* Allow grid items to shrink */
}

/* When products grid contains only coming-soon message, center it */
.products-grid.showing-coming-soon {
  display: block;
  text-align: center;
  width: 100%;
  margin: 0;
  padding: 80px 0;
}

/* Fix for screen rotation */
@media screen and (orientation: portrait) {
  .main {
    padding: 20px;
    margin-top: 104px !important; /* Adjusted for new sub-header height */
  }
}

@media screen and (orientation: landscape) and (max-height: 500px) {
  .main {
    margin-top: 80px;
    padding: 15px 15px 15px 180px;
  }
}

/* For very large screens, we can allow smaller minimum width */
@media (min-width: 1800px) {
  .products-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }
}

/* For medium screens, maintain optimized sizing */
@media (max-width: 1200px) and (min-width: 900px) {
  .products-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

.footer {
  position: relative;
  z-index: 10;
  left: 0;
  width: 100%;
}

@media (max-width: 899px) {
  .products-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
}

/* Landscape orientation with more nuanced width controls */
@media (orientation: landscape) and (min-width: 1400px) {
  .products-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }
}

@media (orientation: landscape) and (min-width: 1000px) and (max-width: 1399px) {
  .products-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

/* Portrait orientation - ensure containers have adequate width */
@media (orientation: portrait) {
  .products-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
  }
}

@media (max-width: 800px) {
  body.has-sidebar .main {
    padding-left: 20px;
    padding-right: 20px;
    width: 100%;
  }
  
  body.has-sidebar .departments-sidebar {
    display: none;
  }
  
  .products-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); /* Wider for mobile grid */
  }.product-container {
    height: 430px; /* Increased to ensure add to cart button fits */
    min-height: 430px;
    width: 100%;
    box-sizing: border-box;
  }
}

@media (max-width: 450px) {
  .products-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); /* Wider minimum width for small screens */
  }  .product-container {
    padding: 15px; /* Slightly reduce padding on very small screens */
    height: 400px; /* Increased for full visibility of add to cart button */    min-height: 400px;
    width: 100%;
    box-sizing: border-box;
  }.product-name {
    height: 90px; /* Adjust name container height for mobile - 4 lines */
  }
}

.product-container {
  padding-top: 40px;
  padding-bottom: 25px;
  padding-left: 25px;
  padding-right: 25px;

  border: 1px solid rgb(231, 231, 231);

  display: flex;
  flex-direction: column;
    /* Ensure uniform container heights and consistent sizing */
  min-height: 450px; /* Increased to ensure add to cart button is fully visible */
  height: 450px; /* Increased to ensure add to cart button is fully visible */
  width: 100%; /* Ensure consistent width */
  box-sizing: border-box; /* Include padding and border in size calculations */
  position: relative;
}

.product-image-container {
  display: flex;
  justify-content: center;
  align-items: center;

  height: 180px;
  margin-bottom: 20px;
}

.product-image-link {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  text-decoration: none;
  cursor: pointer;
}

.product-image-link:hover .product-image {
  transform: scale(1.05);
  transition: transform 0.2s;
}

.product-image {
  /* Images will overflow their container by default. To
    prevent this, we set max-width and max-height to 100%
    so they stay inside their container. */
  max-width: 100%;
  max-height: 100%;
  transition: transform 0.2s;
}

.product-name {
  height: 4.5em; /* Match the 3-line text height */
  margin-bottom: 5px;
  /* Ensure consistent text display */
  display: flex;
  align-items: flex-start;
  line-height: 1.5;
}

.product-link {
  text-decoration: none;
  color: inherit;
}

.product-link:hover {
  color: rgb(1, 124, 182);
  text-decoration: underline;
}

.product-rating {
  display: flex;
  align-items: center;
  margin: 5px 0;
}

.product-rating-stars {
  color: #FFA41C;
  font-size: 16px;
  margin-right: 6px;
  letter-spacing: 1px;
  height: 18px;
  width: auto;
  max-width: 90px;
}

.product-rating-count {
  color: #007185;
  cursor: pointer;
  font-size: 14px;
}

.product-rating-count:hover {
  text-decoration: underline;
}

.product-price {
  font-weight: 700;
  margin-bottom: 10px;
}

.product-quantity-container {
  margin-bottom: 17px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.product-quantity-container select {
  flex: 0 0 auto;
}

.product-spacer {
  flex: 1;
  min-height: 10px; /* Ensure a minimum height for the spacer */
}

.added-to-cart {
  color: rgb(6, 125, 98);
  font-size: 16px;

  /* Move to left and above the button */
  display: inline-block;
  position: static;
  width: auto;
  margin: 0 0 0 12px;
  text-align: left;
  vertical-align: middle;
  opacity: 0;
  z-index: auto;
}

.added-to-cart img {
  height: 20px;
  margin-right: 5px;
}

.add-to-cart-button,
.continue-shopping-button {
  width: 100%;
  padding: 8px;
  border-radius: 50px;
  background-color: #232F3E;
  color: #fff;
  border: none;
  font-weight: 700;
  font-size: 16px;
  transition: background-color 0.2s;
  text-decoration: none; /* Remove underline for anchor tags */
  text-align: center; /* Center the text */
  display: inline-block; /* Ensure proper block behavior for anchor tags */
}

.add-to-cart-button:hover,
.continue-shopping-button:hover {
  background-color: #1A252F;
}

.product-quantity-section {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 10px;
  height: 35px;
}

.product-quantity-container {
  margin-bottom: 0;
}

.added-message {
  display: none;
  color: green;
  font-weight: bold;
  padding: 3px 8px;
  margin-left: 10px;
  animation: fadeIn 0.5s;
}

.page-header {
  margin: 20px 0;
  text-align: center;
  font-size: 28px;
  font-weight: bold;
  color: #232F3E;
  border-bottom: 3px solid #FF9900;
  padding-bottom: 15px;
  background: linear-gradient(135deg, #232F3E 0%, #37475A 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 4px rgba(0,0,0,0.1);
  animation: fadeInHeader 0.5s ease-out;
}

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

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Loading animation styles */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #FF9900;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-container p {
  color: #565959;
  font-size: 16px;
  margin: 0;
}

/* Smooth transitions for submenu */
.submenu {
  transition: all 0.3s ease-in-out;
  transform-origin: top;
}

.submenu.active {
  animation: slideDown 0.3s ease-out;
}

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

/* Product grid fade-in animation */
.js-prodcts-grid {
  transition: opacity 0.3s ease-in-out;
}

.products-grid-loading {
  opacity: 0.5;
}

/* Hover effects for department links */
.department-link {
  transition: background-color 0.2s ease, color 0.2s ease;
}

.department-link:hover {
  background-color: #f0f0f0;
  color: #FF9900;
}

/* Selected menu item styling */
/* .department-link.selected-brand {
  background-color: #FF9900;
  color: white;
  font-weight: bold;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(255, 153, 0, 0.3);
} */

/* Breadcrumb navigation styling */
.breadcrumb-nav {
  display: flex;
  align-items: center;
  padding: 10px 0;
  margin-bottom: 15px;
  font-size: 14px;
}

.breadcrumb-link {
  color: #37475A;
  text-decoration: none;
}

.breadcrumb-link:hover {
  text-decoration: underline;
  color: #c45500;
}

.breadcrumb-separator {
  margin: 0 8px;
  color: #555;
}

.breadcrumb-current {
  color: #333;
  font-weight: 500;
}

.coming-soon {
  width: 100%;
  max-width: 600px;
  padding: 40px;
  text-align: center;
  background-color: #f8f8f8;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  margin: 0 auto;
  display: block;
}

.coming-soon h2 {
  font-size: 24px;
  color: #232F3E;
  margin-bottom: 15px;
}

.coming-soon p {
  font-size: 16px;
  color: #555;
}

/* Responsive design for coming-soon message */
@media (max-width: 768px) {
  .products-grid.showing-coming-soon {
    padding: 60px 0;
  }
  
  .coming-soon {
    max-width: 90%;
    padding: 30px 20px;
  }
  
  .coming-soon h2 {
    font-size: 20px;
    margin-bottom: 12px;
  }
  
  .coming-soon p {
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .products-grid.showing-coming-soon {
    padding: 40px 0;
  }
}

/* Search Results Styles */
.search-no-results {
  width: 100%;
  max-width: 600px;
  padding: 40px;
  text-align: center;
  background-color: #f8f8f8;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  margin: 40px auto;
}

.search-no-results h2 {
  font-size: 24px;
  color: #232F3E;
  margin-bottom: 15px;
}

.search-no-results p {
  font-size: 16px;
  color: #555;
  margin-bottom: 25px;
}

.search-suggestions {
  margin-top: 25px;
}

.search-suggestions h3 {
  font-size: 18px;
  color: #232F3E;
  margin-bottom: 15px;
}

.suggestion-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.suggestion-links a {
  padding: 8px 16px;
  background-color: #FF9900;
  color: white;
  text-decoration: none;
  border-radius: 4px;
  font-size: 14px;
  transition: background-color 0.2s ease;
}

.suggestion-links a:hover {
  background-color: #e68900;
}

.search-results-info {
  padding: 15px 0;
  font-size: 16px;
  color: #666;
  border-bottom: 1px solid #e0e0e0;
  margin-bottom: 20px;
}

.search-message {
  animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Product container styling for mixed search results */
.product-container[data-product-type="printer"] {
  border-left: 4px solid #4CAF50;
}

.product-container[data-product-type="printhead"] {
  border-left: 4px solid #2196F3;
}

.product-container[data-product-type="printsparepart"] {
  border-left: 4px solid #FF9800;
}

.product-container[data-product-type="upgradingkit"] {
  border-left: 4px solid #9C27B0;
}

/* Responsive design for search results */
@media (max-width: 768px) {
  .search-no-results {
    max-width: 90%;
    padding: 30px 20px;
  }
  
  .search-no-results h2 {
    font-size: 20px;
    margin-bottom: 12px;
  }
  
  .search-no-results p {
    font-size: 14px;
  }
  
  .suggestion-links {
    flex-direction: column;
    align-items: center;
  }
  
  .suggestion-links a {
    width: 100%;
    max-width: 200px;
    text-align: center;
  }
  
  .search-results-info {
    font-size: 14px;
    padding: 10px 0;
  }
}

/* Mobile main content adjustments for fixed header */
@media (max-width: 768px) {
  .main,
  body.has-sidebar .main {
    margin-top: 104px !important; /* 60px header + 44px sub-header */
    padding-top: 20px !important;
  }
}

@media (max-width: 480px) {
  .main,
  body.has-sidebar .main {
    margin-top: 104px !important; /* 60px header + 44px sub-header */
    padding-top: 15px !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
  }
}

@media (max-width: 320px) {
  .main,
  body.has-sidebar .main {
    margin-top: 99px !important; /* 55px header + 44px sub-header */
    padding-top: 15px !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
  }
}

/* Pagination Styles - Full width like page header */
.pagination-wrapper {
  width: 100%;
  margin: 40px 0 20px 0;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.pagination-container {
  width: 100%;
  max-width: 1000px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  padding: 25px 20px;
  background-color: #fafafa;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.pagination-info {
  font-size: 16px;
  color: #555;
  font-weight: 500;
  text-align: center;
  margin-bottom: 5px;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.pagination-btn {
  padding: 10px 15px;
  border: 1px solid #ddd;
  background-color: #fff;
  color: #333;
  cursor: pointer;
  border-radius: 5px;
  font-size: 14px;
  font-weight: 500;
  min-width: 45px;
  text-align: center;
  transition: all 0.3s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.pagination-btn:hover {
  background-color: #f8f8f8;
  border-color: #bbb;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.pagination-btn.active {
  background-color: #FF9900;
  color: white;
  border-color: #FF9900;
  box-shadow: 0 2px 6px rgba(255, 153, 0, 0.3);
}

.pagination-btn:disabled {
  background-color: #f5f5f5;
  color: #999;
  cursor: not-allowed;
  border-color: #ddd;
  box-shadow: none;
}

.pagination-ellipsis {
  padding: 10px 8px;
  color: #666;
  font-size: 14px;
  font-weight: 500;
}

/* Mobile responsive pagination */
@media (max-width: 768px) {
  .pagination-wrapper {
    margin: 30px 0 15px 0;
  }
  
  .pagination-container {
    padding: 20px 15px;
    gap: 12px;
  }
  
  .pagination-controls {
    gap: 6px;
  }
  
  .pagination-btn {
    padding: 8px 12px;
    font-size: 13px;
    min-width: 40px;
  }
  
  .pagination-info {
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .pagination-wrapper {
    margin: 20px 0 10px 0;
  }
  
  .pagination-container {
    padding: 15px 10px;
    gap: 10px;
  }
  
  .pagination-controls {
    gap: 4px;
  }
  
  .pagination-btn {
    padding: 6px 10px;
    font-size: 12px;
    min-width: 35px;
  }
  
  .pagination-info {
    font-size: 13px;
  }
}

/* Mobile-specific styles for quantity container layout */
@media (max-width: 480px) {
  .product-quantity-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }
  
  .added-message {
    font-size: 12px;
    align-self: center;
  }
}

@media (max-width: 768px) and (min-width: 481px) {
  .product-quantity-container {
    gap: 8px;
  }
  
  .added-message {
    font-size: 13px;
  }
}
