body {
  font-family: Roboto, Arial;
  color: rgb(33, 33, 33);
  /* The <body> element has a default margin of 8px
     on all sides. This removes the default margins. */
  margin: 0;
  width: 100%;
  min-height: 100vh;
  overflow-x: hidden; /* Prevent horizontal scrolling */
  display: flex;
  flex-direction: column;
}

/* Fix for orientation changes */
html {
  height: 100%;
  width: 100%;
  overflow-x: hidden;
}

@media screen and (orientation: portrait) {
  html,
  body {
    width: 100%;
    overflow-x: hidden;
  }

  /* Force proper fitting on small mobile screens */
}
* {
  @media screen and (orientation: portrait) {
    *,
    *::before,
    *::after {
      max-width: 100%;
      box-sizing: border-box;
    }
  }
  html,
  body {
    width: 100%;
    overflow-x: hidden;
  }
}

/* <p> elements have a default margin on the top
   and bottom. This removes the default margins. */
p {
  margin: 0;
}

/* Consolidated no-sidebar styles - used across multiple page types */
body.no-sidebar .main {
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  box-sizing: border-box;
  padding-left: 30px;
  padding-right: 30px;
}

@media (max-width: 480px) {
  body.no-sidebar .main {
    padding-left: 10px;
    padding-right: 10px;
  }
}

/* General styles for all pages */
html,
body {
  overflow-x: hidden; /* Prevent horizontal scroll from footer */
}

/* Global image sizing constraint */
img {
  max-width: 100%;
  height: auto;
}

/* Global button styles */
button {
  cursor: pointer;
  font-family: Roboto, Arial;
  transition: background-color 0.2s;
}

select {
  cursor: pointer;
}

input,
select {
  font-family: Roboto, Arial;
}

/* Primary button style */
.button-primary {
  color: #fff;
  background-color: #232f3e;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  font-weight: 700;
  padding: 8px 16px;
  font-size: 16px;
  transition: background-color 0.2s;
}

.button-primary:hover {
  background-color: #1a252f;
}

.button-primary:active {
  background-color: #232f3e;
  box-shadow: none;
}

.main {
  flex: 1;
}

/* Secondary button style - a variation of the primary theme */
.button-secondary {
  color: #232f3e;
  background-color: white;
  border: 2px solid #232f3e;
  border-radius: 50px;
  cursor: pointer;
  font-weight: 700;
  padding: 8px 16px;
  font-size: 16px;
  transition: all 0.2s;
}

.button-secondary:hover {
  color: white;
  background-color: #232f3e;
}

/* These styles will limit text to 2 lines. Anything
   beyond 2 lines will be replaced with "..."
   You can find this code by using an A.I. tool or by
   searching in Google.
   https://css-tricks.com/almanac/properties/l/line-clamp/ */
.limit-text-to-2-lines {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* These styles will limit text to 3 lines and ensure consistent height */
.limit-text-to-3-lines {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 60px; /* Ensures consistent height for 3 lines */
}

/* A/B Testing Button Variants */
.button-blue {
  background-color: #007185;
}

.button-blue:hover {
  background-color: #005a6b;
}

.button-green {
  background-color: #28a745;
}

.button-green:hover {
  background-color: #218838;
}

.button-orange {
  background-color: #ff9500;
}

.button-orange:hover {
  background-color: #e6850e;
}

/* A/B Testing Layout Variants */
.layout-variant-a .products-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.layout-variant-b .products-grid {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
}

.layout-variant-b .product-container {
  padding: 15px;
}

.link-primary {
  color: rgb(1, 124, 182);
  cursor: pointer;
}

.link-primary:hover {
  color: rgb(196, 80, 0);
}

/* Styles for dropdown selectors. */
select {
  color: rgb(33, 33, 33);
  background-color: rgb(240, 240, 240);
  border: 1px solid rgb(213, 217, 217);
  border-radius: 8px;
  padding: 3px 5px;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(213, 217, 217, 0.5);
}

input,
select {
  font-family: Roboto, Arial;
}

/* Enhanced UI feedback styles */
@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

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

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

/* Cart quantity indicator improvements */
.js-cart-quantity {
  transition: all 0.3s ease;
  display: flex !important; /* Always show the cart quantity */
}

.js-cart-quantity.has-items {
  background-color: #f44336;
  color: white;
  animation: pulse 0.5s ease;
}

/* Button loading and disabled states */
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

button.loading {
  position: relative;
  color: transparent;
}

button.loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid #fff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s linear infinite;
}

/* Notification styles */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 4px;
  z-index: 10000;
  font-family: Roboto, Arial;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  max-width: 300px;
  word-wrap: break-word;
}

.notification.show {
  transform: translateX(0);
}

.notification.success {
  background-color: #4caf50;
  color: white;
}

.notification.error {
  background-color: #f44336;
  color: white;
}

.notification.warning {
  background-color: #ff9800;
  color: white;
}

.notification.info {
  background-color: #2196f3;
  color: white;
}

/* Loading spinner for images */
.image-loading {
  position: relative;
  background-color: #f5f5f5;
}

.image-loading::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #ddd;
  border-top-color: #666;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Improved error states */
.error-state {
  padding: 20px;
  text-align: center;
  color: #666;
  background-color: #f9f9f9;
  border-radius: 8px;
  margin: 20px 0;
}

.error-state h3 {
  color: #f44336;
  margin-bottom: 10px;
}

.error-state button {
  margin-top: 10px;
  padding: 8px 16px;
  background-color: #2196f3;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.error-state button:hover {
  background-color: #1976d2;
}

/* Accessibility improvements */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus improvements */
button:focus,
input:focus,
select:focus {
  outline: 2px solid #2196f3;
  outline-offset: 2px;
}

/* Mobile responsiveness improvements */
@media (max-width: 768px) {
  .notification {
    left: 10px;
    right: 10px;
    transform: translateY(-100%);
    max-width: none;
  }

  .notification.show {
    transform: translateY(0);
  }
}
