/* --- General Product Page Styles --- */
h1 {
    text-align: center;
    color: var(--text-color-primary);
    font-size: 2.5em;
    font-weight: 900;
    margin-bottom: 40px;
    letter-spacing: 1px;
}
 
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    align-items: start;
    padding: 0 15px;
}
@media (min-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 columns on tablets */
    }
}

@media (min-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr); /* 3 columns on larger screens */
    }
}

@media (min-width: 1280px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr); /* 4 columns on large desktops */
    }
}


.product-item {
    background: transparent;
    max-width: 2000px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    padding: 30px;
    text-align: left;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    transition: transform 0.3s ease;
}

.product-item:hover {
    transform: translateY(-5px);
}

.product-item h3 {
    color: var(--text-color-primary);
    font-size: 1.5em;
    font-weight: 700;
    margin-bottom: 15px;
}

.product-image {
    width: 52%;
    max-width: 2px;
    height: auto;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 20px;
}

.product-item p {
    color: var(--text-color-secondary);
    font-size: 1em;
    margin: 5px 0;
}

/* --- Toggle Button Styles --- */
.product-toggle-nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
}

.toggle-btn {
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    background-color: transparent;
    color: var(--text-color-primary);
    cursor: pointer;
    border-radius: 20px;
    font-weight: bold;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.toggle-btn.active {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    font-weight: bold;
}

.toggle-btn:hover:not(.active) {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-color-primary);
}

.toggle-content {
    margin-top: 20px;
    text-align: left; /* Align text to the left for better readability */
    width: 100%;
}

.toggle-content p {
    color: var(--text-color-primary);
    line-height: 1.6;
}

.toggle-content.hidden {
    display: none;
}

/* --- Add to Cart Button Style --- */
.btn-add-to-cart {
    display: block; /* Make the button a block element to span the width */
    width: 100%;
    margin-top: auto; /* Push the button to the bottom */
    padding: 15px 30px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1.1em;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.btn-add-to-cart:hover {
    background-color: #2564ebe1;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 123, 255, 0.4);
}

.product-viewer {
    position: relative;
    width: 100%;
    max-width: 800px;
    height: 500px; /* Fixed size so other products don’t shift */
    overflow: hidden;
    cursor: grab;
    margin-bottom: 20px;
    border-radius: 80px;
    background-color: var(--background-color-secondary);
}
.product-viewer.zoomed {
    width: 100%; 
    max-width: 800px; 
    height: 500px;
    overflow: visible; 
    cursor: zoom-out;
}
.product-viewer:active {
    cursor: grabbing;
}

.product-viewer .viewer-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
    user-select: none; 
}

.product-viewer.zoomed .viewer-image {
    transform: scale(2); /* Zoom image without changing container size */
    cursor: zoom-out;
}

.product-viewer.zoomed {

    cursor: zoom-out;
    
}
/* Zoom overlay / lightbox (no layout shift) */
.zoom-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  z-index: 10000;
  padding: 20px;
}

.zoom-overlay.open {
  display: flex;
}

.zoom-overlay .zoomed-container {
  max-width: 90vw;
  max-height: 90vh;
  width: min(900px, 90vw);
  height: auto;
  border-radius: 20px;
  overflow: hidden;
  background: var(--background-color-secondary);
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
}

.zoom-overlay .zoomed-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  cursor: zoom-out;
}


/* --- New Styles for Grouping Elements --- */

/* This wrapper aligns the quantity selector and the "Add to Cart" button */
.product-actions {
    display: flex;
    align-items: center; /* Vertically aligns items in the center */
    gap: 10px; /* Adds space between the quantity selector and the button */
    margin-top: 20px;
    width: 100%; /* Makes the container span the full width */
}

/* --- Cleaned-up Quantity Selector Style --- */

/* Container for the quantity selector */
.quantity-selector {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
    flex-shrink: 0; /* Prevents the quantity selector from shrinking */
    background-color: #fff;
}

.quantity-selector .btn-quantity {
    background-color: transparent;
    color: rgb(14, 14, 14);
    font-size: 1.2rem;
    padding: 8px 15px;
    cursor: pointer;
    border: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.quantity-selector .btn-quantity:hover {
    background-color: #f0f0f0;
    color: #000;
}

.quantity-selector .decrease-quantity,
.quantity-selector .increase-quantity {
    /* Style for the buttons' borders to separate them from the input */
    border-right: 1px solid #ddd;
}
/* The last button should not have a border */
.quantity-selector .increase-quantity {
    border-left: 1px solid #ddd;
    border-right: none;
}

.quantity-selector .visible-quantity-input {
    width: 50px;
    text-align: center;
    border: none;
    padding: 8px 0;
    font-size: 1rem;
    color: #333;
    -moz-appearance: textfield;
}

.quantity-selector .visible-quantity-input::-webkit-outer-spin-button,
.quantity-selector .visible-quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* --- Refined Add to Cart Button Style --- */



.product-image-section {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.image-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.6);
    border: none;
    font-size: 2rem;
    cursor: pointer;
    z-index: 10;
    padding: 10px;
    border-radius: 50%;
    line-height: 1;
    transition: background-color 0.3s ease;
}

.image-arrow:hover {
    background-color: rgba(255, 255, 255, 0.9);
}

.prev-image {
    left: 10px;
}

.next-image {
    right: 10px;
}

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    opacity: 0.9;
    z-index: 9999;
}
