.main {
  margin-top: 60px;
}

.js-products-grid {
  margin-left: 10px;
  display: grid;

  /* - In CSS Grid, 1fr means a column will take up the
       remaining space in the grid.
     - If we write 1fr 1fr ... 1fr; 8 times, this will
       divide the grid into 8 columns, each taking up an
       equal amount of the space.
     - repeat(4, 1fr); is a shortcut for repeating "1fr"
       8 times (instead of typing out "1fr" 8 times).
       repeat(...) is a special property that works with
       display: grid; */
  grid-template-columns: repeat(4, 1fr);
}

/* @media is used to create responsive design (making the
   website look good on any screen size). This @media
   means when the screen width is 2000px or less, we
   will divide the grid into 7 columns instead of 8. */
@media (max-width: 2000px) {
  .products-grid {
    grid-template-columns: repeat(7, 1fr);
  }
}

/* This @media means when the screen width is 1600px or
   less, we will divide the grid into 6 columns. */
@media (max-width: 1600px) {
  .products-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

@media (max-width: 1300px) {
  .products-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (max-width: 1000px) {
  .products-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

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

@media (max-width: 575px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 450px) {
  .products-grid {
    grid-template-columns: 1fr;
  }
}

.product-container {
  margin-left: 30px;
  padding-top: 30px;
  padding-bottom: 25px;
  padding-left: 25px;
  padding-right: 25px;
  display: flex;
  flex-direction: column;
}

.product-image-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 300px;
  margin-bottom: 20px;
}

.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. */
  width: 250px;
  height: 250px;
  margin-right: 170px;
  transition: 5s;
}

.product-image:hover {
  width: 300px;
  height: 300px;
  transition: 5s;
}

.product-name {
  height: 40px;
  margin-bottom: 5px;
  font-size: 20px;
  margin-left: 10px;
}

.product-rating-container {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  margin-left: 10px;
}

.product-rating-stars {
  width: 100px;
  margin-right: 6px;
}

.product-rating-count {
  color: rgb(1, 124, 182);
  cursor: pointer;
  margin-top: 3px;
}

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

.product-quantity-container {
  margin-bottom: 17px;
}

.product-spacer {
  flex: 1;
}

.added-to-cart {
  color: rgb(6, 125, 98);
  font-size: 16px;
  display: flex;
  align-items: center;
  margin-bottom: 8px;

  /* At first, the "Added to cart" message will
     be invisible. Use JavaScript to change the
     opacity and make it visible. */
  opacity: 0;
}

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

.add-to-cart-button {
  width: 100%;
  padding: 8px;
  border-radius: 50px;
}

/* ===== Mobile fixes for iPhone 14 (390px) ===== */
@media (max-width: 480px) {
  /* Fix 2: Reduce 'Generative AI Artwork' section header font size */
  .amazon-header-middle-section ± p,
  body > p,
  p[style*="font-size: 40px"] {
    font-size: 28px !important;
    margin-top: -55px !important;
    line-height: 1.0 !important;
    white-space: normal !important;
    text-align: center !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    margin-left: 0 !important;
    padding: 0 10px !important;
    box-sizing: border-box !important;
  }

  /* Fix for 'Featured Products' not being overlapped */
  p[style*="font-size: 23px"] {
    margin-top: 10px !important;
  }

  /* Fix 4: Single column product grid on mobile */
  .products-grid,
  .js-products-grid {
    grid-template-columns: 1fr !important;
  }

  /* Fix for product container width */
  .product-container {
    margin-left: 0 !important;
    margin-right: 0 !important;
    max-width: 100% !important;
  }
}
