

/* === Overlay === */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto; /* Allow vertical scroll */
    background-color: var(--overlay-bg, rgba(0, 0, 0, 0.6));
    z-index: 999;
    justify-content: center;
    align-items: flex-start; /* Align content at top */
    padding: 2rem 1rem; /* Add padding so it doesn’t touch screen edges */
    box-sizing: border-box;
}



/* === Overlay Layout === */
.overlay-content {
  background: white;
  padding: 2rem;
  border-radius: var(--border-radius);
  width: 80%;
  max-width: 1000px;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  justify-content: space-between;
  box-sizing: border-box;
  position: relative;
}


/* === Left Side: Image + Carousel === */
#overlay-left {
  flex: 1;
  max-width: 50%;
  min-width: 0; /* Prevents overflowing */
  position: relative;
  display: flex;
  justify-content: center; /* Center the image horizontally */
  align-items: center;     /* Center vertically if needed */
  padding: 1rem;           /* Add some padding so image isn’t flush to edges */
}

#overlay-right {
  flex: 1;
  max-width: 50%;
  min-width: 0; /* Prevents overflowing */
  padding-left: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start; /* Align content to the left */
  text-align: left;        /* Ensure text is left-aligned */
}


#overlay-image {
  width: 100%;
  max-width: 100%;             /* Ensure it doesn't exceed container */
  max-height: 300px;           /* Limit height */
  height: auto;
  object-fit: contain;         /* Keep aspect ratio */
  border-radius: var(--border-radius, 8px); /* Use fallback if custom property is missing */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); /* Subtle shadow */
  display: block;
}


#overlay-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    text-align: left; /* Ensure the title is left-aligned */
}

#overlay-price {
    font-size: 1.25rem;
    color: var(--price-color, #d30000);
    font-weight: bold;
    margin-bottom: 1rem;
    text-align: left; /* Ensure the price is left-aligned */
}

#overlay-description {
    font-size: 1rem;
    color: var(--text-color, #000000);
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

/* === Add to Cart Button === */
#add-to-cart-button {
    padding: 0.75rem 1.5rem;
    background-color: var(--success-color, #007bff);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-bottom: 1rem;
}

#add-to-cart-button:hover {
    background-color: var(--primary-hover, #0056b3);
}

/* === Close Button === */
.close-button {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
}


.close-button:hover {
    color: #000;
}





/* Specific positions for prev/next */
#prev-button {
    left: 10px;
}

#next-button {
    right: 10px;
}





#overlay-main {
  display: flex;
  gap: 2rem;
  justify-content: space-between;
  flex-wrap: nowrap; /* Prevent wrapping unless absolutely needed */
}



#recommended-section {
    border-top: 1px solid #eee;
    padding-top: 1rem;
}

#recommended-section h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    text-align: left;
}





/* === Carousel Styles === */
.carousel {
    position: relative;
    width: 100%;
    height: auto;
    overflow: visible;
}

.carousel img {
    width: 100%;
    display: block;
    height: auto;
}

/* Shared carousel button styles */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    font-size: 2rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
    z-index: 5;
    border-radius: 50%;
}


.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  z-index: 5; /* Kept highest value */
  cursor: pointer;
  text-align: center;
  vertical-align: middle;
  font-family: 'Arial', sans-serif;
}

.carousel-btn span {
    position: relative;
    top: -1px; /* Adjust ±1px to fine-tune centering */
}

.carousel-btn:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.carousel-btn.prev {
    left: -20px;
}

.carousel-btn.next {
    right: -20px;
}

.recommended-products {
    display: flex;
    gap: 16px;
    margin-top: 10px;
}
.recommended-item {
  width: 120px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px;
  box-sizing: border-box;
}

.recommended-item h4 {
  max-height: 3em; /* roughly 2 lines */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  line-height: 1.5em;
  margin-top: 2px;   /* reduce space above */
  margin-bottom: 2px; /* reduce space below */
}




.recommended-price-and-button {
  display: flex;
  flex-direction: column; /* stack price and button vertically */
  align-items: left;    /* horizontally center items */
  gap: 1px;               /* spacing between price and button */
  margin-top: auto;       /* keep it pinned at bottom if needed */
}




/* Optional: make price and button smaller/fitting */
.recommended-price {
  margin: 0;
  font-weight: bold;
  color: var(--danger-color);
}

.recommended-add-to-cart {
  padding: 4px 8px;
  font-size: 0.9rem;
  cursor: pointer;
  background-color: var(--primary-color); /* or use a hex like #007bff */
  color: white; /* this was incorrect as 'var(white )' */
  border: none;
  border-radius: 4px;
}

.recommended-item img {
    width: 100%;
    height: auto;
    border-radius: 6px;
}

/* Make overlay scrollable on small screens */
@media (max-width: 768px) {
  .overlay {
    align-items: flex-start; /* Align to top */
    overflow-y: auto;        /* Allow scrolling if needed */
    padding: 2rem 1rem;      /* Add space so content isn't flush to edges */
  }

  .overlay-content {
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    height: auto;
  }

  #overlay-main {
    flex-direction: column;
    gap: 1rem;
  }

  #overlay-left,
  #overlay-right {
    max-width: 100%;
    padding: 0;
  }

  #overlay-right {
    padding-top: 1rem;
    padding-left: 0;
  }

  .close-button {
    position: sticky;
    top: 0.5rem;
    z-index: 999;
  }
}
