/* Modal styling */
/* Prevent page scrolling when modal is open */
body.modal-open {
  overflow: hidden;
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  /* Semi-transparent background */
  justify-content: center;
  align-items: center;
}

.modal-content {
  max-width: 80%;
  max-height: 80%;
  object-fit: contain;
  /* Maintain aspect ratio without stretching */
  border-radius: 8px;
  transition: all 0.5s;
}

@media (min-width: 768px) {
  .modal-content {
    cursor: zoom-in;
    /* Set cursor style for desktop zoom */
  }
}

.modal-content img {
  max-width: 100%;
  max-height: 100%;
  transform-origin: center center;
  transition: all 0.5s;
}

.close {
  position: absolute;
  top: 15px;
  right: 35px;
  color: #fff;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.5s;
}

.close:hover,
.close:focus {
  color: #ccc;
  text-decoration: none;
  cursor: pointer;
}

/* Search Section Styling */
#search-section {
  display: flex;
  justify-content: center;
  align-items: center;
}

.search-container {
  text-align: center;
  width: 100%;
}

.search-container b {
  display: block;
  font-size: 1.25rem;
  color: #333;
}

.search-form {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 !important;
}

.search-form input {
  flex: 1;
  max-width: 500px;
  padding: 12px 24px;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 1.75rem;
  outline: none;
  transition: all 0.3s ease-in-out;
}

.search-form input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 8px rgba(0, 123, 255, 0.25);
}

.search-form .btn {
  padding: 14px 24px;
  font-size: 1rem;
  border-radius: 1.75rem;
  background-color: var(--primary-color);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.search-form .btn:hover {
  background-color: var(--secondary-color);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .search-form {
    flex-direction: row;
    gap: 5px;
  }

  .search-form input {
    width: 100%;
    padding: 12px 20px;
  }

  .search-form .btn {
    font-size: 1.2rem;
    position: relative;
  }
}

/* Product Details Layout */
.product-details {
  display: flex;
  gap: 20px;
  width: 100%;
  align-items: flex-start;
  justify-content: center;
  margin-top: 20px;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.product-description {
  justify-content: center;
  text-align: left;
  margin: 20px 10px;
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
  padding: 20px;
  background-color: #fff;
  border-radius: 1.75rem;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Product Image Styling */
.product-image {
  flex: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 100%;
}

#main-image {
  max-height: 400px;
  width: auto;
  border-radius: 10px;
  object-fit: contain;
  transition: all 0.5s;
  transition: opacity 0.5s ease-in-out;
}

#main-image:hover {
  transform: scale(1.05);
  transition: all 0.5s;
}

/* Thumbnail styling positioned directly under the main image */
.image-thumbnails {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 10px;
}

.thumbnail {
  width: 60px;
  height: 60px;
  border-radius: 4px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.5s;
}

.thumbnail:hover {
  border-color: var(--primary-color);
}

.thumbnail.active {
  border-color: var(--secondary-color);
}

/* Product Info Styling */
.product-info {
  flex: 1;
  max-width: 50%;
  padding: 20px;
  background-color: #fff;
  border-radius: 1.75rem;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Responsive Adjustments for Tablet View */
@media (min-width: 769px) and (max-width: 1024px) {
  .product-details {
    flex-direction: row;
    align-items: flex-start;
    gap: 20px;
  }

  .product-image {
    max-width: 60%;
    text-align: center;
  }

  .product-info {
    max-width: 40%;
    padding: 20px;
  }

  #main-image {
    height: auto;
    width: 100%;
    max-height: 300px;
    object-fit: contain;
  }

  .price-section {
    display: flex;
    justify-content: flex-start;
    align-items: baseline;
  }
}

/* Adjustments for Desktop View */
@media (min-width: 1025px) {
  .product-details {
    flex-direction: row;
    align-items: flex-start;
    gap: 20px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
  }

  .product-image {
    max-width: 50%;
    text-align: center;
  }

  .product-info {
    max-width: 40%;
    padding: 20px;
    margin-top: 0;
  }

  #main-image {
    height: auto;
    width: 100%;
    max-height: 400px;
    object-fit: contain;
  }

  .price-section {
    display: flex;
    justify-content: flex-start;
    align-items: baseline;
  }
}

/* Adjustments for Mobile View */
@media (max-width: 768px) {
  .product-details {
    flex-direction: column;
    align-items: center;
    text-align: center !important;
  }

  .product-image,
  .product-info,
  .product-description {
    width: 100%;
    max-width: 100%;
  }

  .product-info {
    margin-top: 20px;
    padding: 15px;
  }

  #main-image {
    height: 200px;
    width: auto;
  }

  .price-section {
    display: flex;
    justify-content: center;
    align-items: baseline;
  }
}

/* Original price if a promotion exists */
.original-price {
  font-size: 1.25rem;
  margin-right: 10px;
}

/* Discounted price */
.discounted-price {
  font-size: 1.75rem;
}

.color-selection {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-top: 20px;
}

.color-box {
  display: inline-block;
  cursor: pointer;
  position: relative;
}

/* Color Swatch Styling */
.color-swatch {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  transition: all 0.5s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Available Color - Black border */
.color-swatch:not(.unavailable) {
  border: 2px solid #000;
  opacity: 1;
}

/* Selected color indication */
.color-swatch.selected {
  border: 3px solid var(--primary-color);
  transform: scale(1.1);
}

/* Unavailable color indication (different storage or color not matching) */
.color-swatch.unavailable {
  border: 2px dashed gray;
  opacity: 0.8;
}

/* Tooltip Styling */
.color-box:hover .tooltip {
  visibility: visible;
  opacity: 1;
}

.tooltip {
  visibility: hidden;
  opacity: 0;
  background-color: #333;
  color: #fff;
  text-align: center;
  border-radius: 4px;
  padding: 5px;
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 12px;
  transition: all 0.5s;
  z-index: 1;
}

.storage-selection {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-top: 20px;
}

/* Storage Option Styling */
.storage-box {
  display: inline-block;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--secondary-color) !important;
  transition: all 0.5s;
  background-color: #f8f9fa;
}

/* Available Storage - Black border */
.storage-box:not(.unavailable) {
  border: 2px solid #000;
  opacity: 1;
}

/* Selected storage indication */
.storage-box.selected {
  border: 3px solid var(--primary-color);
  transform: scale(1.05);
}

/* Unavailable storage indication (different storage size) */
.storage-box.unavailable {
  border: 2px dashed gray;
  opacity: 0.8;
}

.quantity-selection {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-top: 20px;
}

@media (max-width: 768px) {
  .color-selection {
    align-items: center;
  }

  .storage-selection {
    align-items: center;
  }

  .quantity-selection {
    align-items: center;
  }
}

.stock-message {
  font-weight: bold;
  font-size: 1rem;
  padding: 5px 0;
}

.stock-message.in-stock {
  color: #28a745;
}

.stock-message.low-stock {
  color: #ff9800;
  animation: pulse 1.5s infinite;
}

.stock-message.out-of-stock {
  color: #dc3545;
  text-transform: uppercase;
}

.quantity-control {
  display: flex;
  align-items: center;
  border: 1px solid #ccc;
  border-radius: 20px;
  margin-top: 10px;
  padding: 5px;
  width: 120px;
  justify-content: space-between;
  background-color: #f9f9f9;
}

.qty-btn {
  background: none;
  border: none;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  outline: none;
  color: #333;
  padding: 0 10px;
  /* Add padding for better spacing */
  transition: all 0.5s;
}

.qty-btn:hover {
  color: #555;
}

.quantity {
  font-size: 18px;
  font-weight: bold;
  text-align: center;
  width: 30px;
  /* Ensure a consistent width */
}

/* Animation for low stock */
@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }
}

.btn[disabled] {
  background-color: grey;
  cursor: not-allowed;
}

/* Buttons */
.btn {
  background-color: var(--primary-color);
  color: #fff;
  padding: 12px 24px;
  font-size: 16px;
  border: none;
  border-radius: 1.75rem;
  cursor: pointer;
  transition: all 0.5s;
  margin-top: 15px;
}

.btn:hover {
  background-color: var(--secondary-color);
}

a.btn {
  text-decoration: none;
  display: inline-block;
  padding: 10px 20px;
  margin-top: 10px;
}

/* Related Products Section */
.related-products {
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* Container for related product cards */
.related-product-container {
  display: flex;
  overflow-x: auto;
  scroll-behavior: smooth;
  position: relative;
  padding: 0 0.5rem 1rem;
  gap: 1.25rem;
  -webkit-overflow-scrolling: touch;
  transition: transform 0.5s ease;
}

.related-product-container::-webkit-scrollbar {
  display: none;
}

/* Related product box style */
.related-productbox {
  background-color: var(--white);
  border: 1px solid var(--complementary-light);
  padding: 1.25rem;
  border-radius: 1.75rem;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.5s ease;
  margin: 1rem 0 0;
  flex: 0 0 auto;
  width: 17rem;
  text-align: center;
  position: relative;
  z-index: 1;
}

.related-productbox hr {
  opacity: 10%;
}

.related-productbox:hover {
  transform: translateY(-0.5rem);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
  transition: all 0.5s ease;
}

/* Promotion tag */
.related-promotion-tag {
  position: absolute;
  top: 0.625rem;
  right: 0.625rem;
  z-index: 3;
  background-color: var(--primary-color);
  color: var(--white);
  padding: 0.5rem 0.75rem;
  font-weight: bold;
  font-size: 0.9rem;
  border-radius: 1.75rem;
}

/* Product image container */
.related-product-image-container {
  width: 100%;
  height: 200px;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #ffffff;
  margin-bottom: 15px;
  border-radius: 0.625rem;
}

.related-product-image-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 0.625rem;
}

/* Product title with ellipsis */
.related-product-title {
  font-size: 0.9rem;
  font-weight: bold;
  margin-bottom: 0.625rem;
  color: var(--secondary-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Price section */
.related-price-section {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 10px;
  font-weight: bold;
}

/* Original price if a promotion exists */
.related-original-price {
  font-size: 1rem;
  color: var(--text-color-secondary);
  text-decoration: line-through;
}

/* Discounted price */
.related-discounted-price {
  font-size: 1.4rem;
  font-weight: bold;
  color: var(--primary-color);
}


@media (max-width: 768px) {
  .related-product-container {
    gap: 0.5rem;
  }

  .related-productbox {
    width: 250px;
  }

  .related-scroll-arrow {
    display: none;
  }
}
