
/* Main Product Section */
.product-section {
    display: grid;
    grid-template-columns: 1fr; /* Mobile: 1 column */
    gap: 40px;
    background: var(--color-white);
    padding: 30px;
    border-radius: 24px;
    box-shadow: var(--shadow-soft);
    margin-bottom: 60px;
    margin-top: 0;
}

/* Product Image */
.product-image-wrapper {
    width: 100%;
    border-radius: 16px;
    overflow: hidden;
    grid-row: 1;
}

.main-image {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 16px;
    transition: var(--transition);
}

.main-image:hover {
    transform: scale(1.02);
}

/* Product Info */
.product-title {
    font-size: 2rem;
    color: var(--color-primary);
    margin-bottom: 15px;
}

.product-price {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-accent1);
    margin-bottom: 20px;
}

.product-price span {
    font-size: 1rem;
    color: var(--color-text-muted);
}

.product-description {
    color: var(--color-text-muted);
    margin-bottom: 30px;
    font-size: 1rem;
    overflow-wrap: break-word;
    line-height: 1.9;
    direction: rtl;
    text-align: right;
}

.product-description p {
    margin: 0 0 1rem;
}

.product-description p:last-child {
    margin-bottom: 0;
}

.product-description ul,
.product-description ol {
    margin: 0.5rem 1.5rem 1rem 0;
    padding-right: 1.5rem;
}

.product-description ul {
    list-style: disc;
}

.product-description ol {
    list-style: decimal;
}

.product-description li {
    margin-bottom: 0.35rem;
}

.product-description strong {
    color: var(--color-text-dark);
    font-weight: 700;
}

.product-description em {
    font-style: italic;
}

/* Product Attributes */
.product-attributes h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--color-secondary);
}

.attributes-list {
    list-style: none;
    margin-bottom: 30px;
}

.attributes-list li {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
    color: var(--color-text-dark);
}

.attributes-list li span:first-child {
    font-weight: bold;
    color: var(--color-text-muted);
}

/* Purchase Area */
.purchase-area {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
}

.quantity-selector {
    display: flex;
    align-items: center;
    border: 2px solid #eee;
    border-radius: 12px;
    overflow: hidden;
    height: 50px;
}

.qty-btn {
    background: var(--color-bg-light);
    border: none;
    width: 40px;
    height: 100%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
}

.qty-btn:hover {
    background: #e0e0e0;
}

.product-specs-section { margin: -30px 0 60px; }
.product-specs-details {
    background: var(--color-white);
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
    padding: 0 24px;
}
.product-specs-details summary {
    cursor: pointer;
    list-style: none;
    padding: 20px 0;
    color: var(--color-primary);
    font-size: 1.15rem;
    font-weight: 700;
}
.product-specs-details summary::-webkit-details-marker { display: none; }
.product-specs-details summary::after { content: "+"; float: left; font-size: 1.4rem; }
.product-specs-details[open] summary::after { content: "−"; }
.product-specs-details .product-attributes { padding-bottom: 16px; }

.qty-btn:disabled,
.btn-add-cart:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    transform: none;
    box-shadow: none;
}

.qty-input {
    width: 50px;
    height: 100%;
    border: none;
    text-align: center;
    font-size: 1.1rem;
    font-weight: bold;
    pointer-events: none;
}

.action-buttons {
    display: flex;
    gap: 15px;
    flex: 1;
}

.btn {
    flex: 1;
    height: 50px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    color: var(--color-white);
}

.btn-add-cart {
    background: var(--gradient-gold);
    color: var(--color-primary);
}

.product-unavailable {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    padding: 0 20px;
    border-radius: 12px;
    background: #f1f1f1;
    color: var(--color-accent1);
    font-weight: 700;
}

.btn-buy-now {
    background: var(--gradient-main);
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

/* Similar Products Section */
.similar-products h2 {
    color: var(--color-primary);
    margin-bottom: 25px;
    font-size: 1.5rem;
}

.horizontal-scroll {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding-bottom: 20px;
    scroll-snap-type: x mandatory;
}

/* Custom Scrollbar for Similar Products */
.horizontal-scroll::-webkit-scrollbar {
    height: 8px;
}
.horizontal-scroll::-webkit-scrollbar-track {
    background: #eee;
    border-radius: 10px;
}
.horizontal-scroll::-webkit-scrollbar-thumb {
    background: var(--color-accent1);
    border-radius: 10px;
}

.product-card {
    min-width: 250px;
    background: var(--color-white);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    transition: var(--transition);
    scroll-snap-align: start;
    cursor: pointer;
}

.product-detail-container { margin-top: 0; }
.product-card { flex: 0 0 250px; }

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover);
}

.product-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.card-info {
    padding: 15px;
    text-align: center;
}

.card-info h4 {
    color: var(--color-text-dark);
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.card-price {
    color: var(--color-accent1);
    font-weight: bold;
}

/* Responsive Design (Desktop Layout) */
@media (min-width: 768px) {
    .product-section {
        grid-template-columns: 1fr 1fr; /* 2 columns */
    }

    /* Because the page is RTL (Right-to-Left), column 1 is on the right, and column 2 is on the left.
       We want the image on the left, so we assign it to column 2. */
    .product-image-wrapper {
        grid-column: 2;
    }

    .product-info-wrapper {
        grid-column: 1;
    }
}

@media (max-width: 767px) {
  .product-detail-container { margin-top: 0; padding: 0 12px; }
  .product-section { grid-template-columns: 1fr; padding: 16px; gap: 24px; margin-top: 0; }
  .product-image-wrapper { position: static; grid-column: auto; }
  .product-info-wrapper { grid-column: auto; }
  .product-title { font-size: 1.45rem; }
  .product-price { font-size: 1.4rem; }
  .purchase-area { flex-direction: column; align-items: stretch; }
  .quantity-selector { justify-content: center; }
  .action-buttons { width: 100%; }
  .horizontal-scroll { gap: 12px; }
  .product-card { flex-basis: 200px; }
}
                

/* 1. Main Section Layout (Assuming Desktop View) */
.product-section {
  display: grid;
  grid-template-columns: 1fr 1fr; /* Two columns */
  gap: 40px;
  margin-top: 60px;
  /* Optional: position relative if needed for other elements */
}

/* 2. Make the Image Wrapper Sticky */
.product-image-wrapper {
  width: 100%;
  border-radius: 16px;
  
  /* STICKY MAGIC HAPPENS HERE */
  position: sticky;
  top: 20px; /* Distance from the top of the screen when it sticks */
  align-self: start; /* Crucial! Prevents wrapper from stretching to the height of the attributes */
}

/* Main Image Styling */
.main-image {
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 20px;
}

/* 3. Make the Extra Images Scrollable */
.extra-images {
  display: flex;
  gap: 12px;
  
  /* HORIZONTAL SCROLL MAGIC */
  overflow-x: auto; /* Adds a scrollbar only if items overflow */
  padding-bottom: 8px; /* Gives scrollbar some breathing room */
  
  /* Scroll snapping for better user experience (Optional but recommended) */
  scroll-snap-type: x mandatory; 
}

/* Style for each extra thumbnail */
.extra-image-container {
  flex: 0 0 calc(20% - 10px); /* Forces items to stay a certain size, prevents shrinking */
  min-width: 60px; /* Ensures they don't get too small */
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  cursor: pointer;
  scroll-snap-align: start; /* Snaps images neatly when scrolling */
}

.extra-image-container img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
}


/* 1. Target the scrollbar itself to change its thickness */
.extra-images::-webkit-scrollbar {
  height: 6px; /* Makes the horizontal scrollbar thin */
}

/* 2. Style the "track" (the background area the scrollbar moves in) */
.extra-images::-webkit-scrollbar-track {
  background: #f4f4f4; 
  border-radius: 10px; /* Rounded edges */
}

/* 3. Style the "thumb" (the draggable part) */
.extra-images::-webkit-scrollbar-thumb {
  background: #cccccc; 
  border-radius: 10px;
}

/* 4. Change color when the user hovers over the scrollbar */
.extra-images::-webkit-scrollbar-thumb:hover {
  background: #999999; 
}

/* For Firefox (Firefox uses a different syntax for custom scrollbars) */
.extra-images {
  scrollbar-width: thin;
  scrollbar-color: #cccccc #f4f4f4; /* thumb-color track-color */
}
