/* Modern Product Page Styles */

.product-page {
    max-width: 1200px;
    margin: 0 auto;
}

.product-layout {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 60px;
    align-items: start;
}

/* Gallery */
.product-gallery {
    background: #fafafa;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
    max-width: 100%;
}

    .product-gallery #mainImage {
        width: 100%;
        /* Use aspect-ratio instead of just height for modern browsers */
        aspect-ratio: 1 / 1; /* Makes it a perfect square, or use 4/3 */
        height: auto; /* Let aspect-ratio determine height based on 100% width */
        max-height: 480px; /* Cap the height for desktop */
        /* Crucial: prevents distortion and ensures the image fills the area */
        object-fit: contain; /* Use 'cover' if you want it to fill the box entirely */
        background-color: #fff; /* Adds a clean background for transparent/contain images */

        border-radius: 12px;
        display: block;
    }

        .product-gallery #mainImage:hover {
/*            transform: scale(1.02);*/
        }

.thumbnails {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

    .thumbnails img {
        width: 70px;
        height: 70px;
        object-fit: cover;
        border-radius: 8px;
        cursor: pointer;
        opacity: 0.6;
        border: 2px solid transparent;
        transition: 0.3s;
    }

        .thumbnails img:hover {
            opacity: 1;
            transform: translateY(-2px);
        }

        .thumbnails img.active {
            opacity: 1;
            border-color: #2563eb;
        }

/* Info */
.product-info {
    background: #ffffff;
    padding: 32px;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
}

    .product-info h1 {
        font-size: 2rem;
        font-weight: 700;
        margin-bottom: 10px;
    }

.price {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2563eb;
    margin-bottom: 8px;
}

.stock {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.in-stock {
    color: #16a34a;
}

.out-of-stock {
    color: #dc2626;
}

/* Variants */
.variants {
    margin: 24px 0;
}

    .variants label {
        display: block;
        font-weight: 600;
        margin-bottom: 10px;
    }

.variant-btn {
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    margin: 6px 6px 0 0;
    cursor: pointer;
    transition: 0.25s ease;
    font-weight: 500;
}

    .variant-btn:hover {
        background: #eef2ff;
    }

    .variant-btn.active {
        background: #2563eb;
        color: white;
        border-color: #2563eb;
    }

    .variant-btn.disabled {
        opacity: 0.4;
        cursor: not-allowed;
    }

/* Quantity */
.quantity {
    margin: 20px 0;
}

    .quantity label {
        font-weight: 600;
        display: block;
        margin-bottom: 6px;
    }

    .quantity input {
        width: 120px;
        padding: 10px 12px;
        border-radius: 10px;
        border: 1px solid #e5e7eb;
        font-size: 1rem;
    }

/* Add to cart */
.add-to-cart {
    background-color: #2563eb;
    color: #fff;
}

    .add-to-cart:hover:not(:disabled) {
        background-color: transparent;
        color: #2563eb;
        border-color: #2563eb;
    }


/* Warranty */
.warranty {
    margin-top: 24px;
    padding: 14px;
    border-radius: 10px;
    background: #f8fafc;
    font-size: 0.95rem;
}

/* Description */
.product-description {
    margin-top: 50px;
    background: #ffffff;
    padding: 32px;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
}

    .product-description h3 {
        font-size: 1.4rem;
        margin-bottom: 12px;
    }

    .product-description p {
        line-height: 1.7;
        color: #374151;
    }

/* Responsive */
@media (max-width: 900px) {
    .product-layout {
        display: block; /* Switch from grid to block to prevent column expansion */
        width: 100%;
    }

    .product-gallery {
        padding: 12px;
        margin-bottom: 20px;
    }

        .product-gallery #mainImage {
            /* On mobile, we strictly limit the height to keep it on one screen */
            max-height: 350px;
            aspect-ratio: 1 / 1;
        }
}

/* Shared product buttons */
.product-btn {
    width: 100%;
    padding: 14px;
    border-radius: 30px;
    font-size: 1.05rem;
    font-weight: 600;
    border: 2px solid transparent;
    cursor: pointer;
    transition: 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

    /* Disabled state */
    .product-btn:disabled,
    .product-btn.disabled {
        opacity: 0.5;
        cursor: not-allowed;
        box-shadow: none;
        transform: none;
    }



.btn-whatsapp {
    margin-top: 10px;
    background-color: #25D366;
    color: #ffffff;
}

    .btn-whatsapp:hover:not(:disabled) {
        background-color: transparent;
        color: #25D366;
        border-color: #25D366;
    }



.page-loader {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.85);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e5e7eb;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Gallery Thumbnails Container */
.thumbnails {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    /* 1. Constrain to parent width */
    width: 100%;
    max-width: 100%;
    /* 2. Enable internal horizontal scroll */
    overflow-x: auto;
    overflow-y: hidden;
    /* 3. Keep items in a single line */
    white-space: nowrap;
    /* 4. Smooth scrolling on mobile devices */
    -webkit-overflow-scrolling: touch;
    /* Optional: Space for the scrollbar so it doesn't touch the images */
    padding-bottom: 8px;
}

    /* Thumbnail Images */
    .thumbnails img {
        /* 5. Prevent flexbox from squishing the images */
        flex: 0 0 70px;
        width: 70px;
        height: 70px;
        object-fit: cover;
        border-radius: 8px;
        cursor: pointer;
        opacity: 0.6;
        border: 2px solid transparent;
        transition: 0.3s;
    }

    /* Optional: Clean Modern Scrollbar for Chrome/Safari/Edge */
    .thumbnails::-webkit-scrollbar {
        height: 6px;
    }

    .thumbnails::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 10px;
    }

    .thumbnails::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 10px;
    }

        .thumbnails::-webkit-scrollbar-thumb:hover {
            background: #94a3b8;
        }

/* Optional: Support for Firefox thin scrollbar */
.thumbnails {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f1f1;
}

/* Responsive adjustment for small screens */
@media (max-width: 480px) {
    .thumbnails img {
        flex: 0 0 60px; /* Slightly smaller thumbnails on very small phones */
        width: 60px;
        height: 60px;
    }
}