/* ===========================
   PRODUCT PAGE STYLES
=========================== */

/* ===========================
   CSS VARIABLES
=========================== */
:root {
    --primary-color: #007BFF;
    --text-color: #333;
    --bg-color: #fff;
    --border-radius: 8px;
    --transition-speed: 0.3s;
}

/* ===========================
   CONTAINER
=========================== */
.product-page {
    max-width: 1200px;
    margin: auto;
    padding: 2rem;
    color: var(--text-color);
    font-family: sans-serif;
}

.product-page .title,
.product-page .product-name,
.product-page .category,
.product-page .availability {
    text-transform: capitalize;
}

/* ===========================
   LAYOUT
=========================== */
.product-top {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
}

@media (max-width: 900px) {
    .product-top {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* ===========================
   GALLERY
=========================== */
.product-gallery {
    position: relative;
}

/* Main Image */
.main-image {
    width: 100%;
    border-radius: var(--border-radius);
    cursor: zoom-in;
    transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

.main-image:hover {
    transform: scale(1.03); /* subtle hover zoom */
}

/* ===========================
   LIGHTBOX
=========================== */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    animation: fadeIn var(--transition-speed) forwards;
}

.lightbox-overlay img {
    max-width: 90%;
    max-height: 90%;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    cursor: zoom-out;
    transition: transform var(--transition-speed) ease;
}

.lightbox-overlay img:hover {
    transform: scale(1.05);
}

@keyframes fadeIn {
    to { opacity: 1; }
}

/* ===========================
   CAROUSEL
=========================== */
.carousel-wrapper {
    display: flex;
    align-items: center;
    margin-top: 1rem;
}

.carousel {
    display: flex;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE 10+ */
    -webkit-overflow-scrolling: touch; /* iOS */
}

.carousel::-webkit-scrollbar {
    display: none;
}

.carousel img {
    width: 80px;
    margin-right: 0.5rem;
    cursor: pointer;
    border-radius: 4px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border 0.2s ease;
    border: 2px solid transparent;
}

.carousel img:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.carousel img.selected {
    border-color: var(--primary-color);
    transform: scale(1.1);
}

/* Carousel arrows */
.carousel-arrow {
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    z-index: 1;
    transition: background var(--transition-speed) ease;
}

.carousel-arrow:hover {
    background: rgba(0,0,0,0.8);
}

.carousel-arrow.left {
    margin-right: 0.5rem;
}

.carousel-arrow.right {
    margin-left: 0.5rem;
}

/* ===========================
   PRODUCT INFO
=========================== */
.product-info h1 {
    font-size: 2rem;
    text-transform: capitalize;
    margin-bottom: 1rem;
}

.price,
.price-original,
.price-discount {
    font-size: 1.8rem;
    font-weight: bold;
}

.price-original {
    margin-left: 1rem;
    text-decoration: line-through;
    color: #888;
}

.add-to-cart {
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    background: black;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 6px;
    transition: background var(--transition-speed) ease, transform var(--transition-speed) ease;
}

.add-to-cart:hover {
    background: #333;
    transform: scale(1.02);
}

.add-to-cart:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.product-info p,
.product-info select {
    margin-bottom: 1rem;
}

.product-variants {
    padding: 0.5rem;
    font-size: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    border: 1px solid #ccc;
}

.variant-label:empty,
.short-description:empty,
.additional_details:empty {
    display: none;
}

/* ===========================
   RESPONSIVE
=========================== */
@media (max-width: 786px) {
    .carousel img {
        width: 60px;
    }

    .add-to-cart {
        width: 100%;
        padding: 0.75rem;
    }
}

/* ===========================
   ACCESSIBILITY & UX
=========================== */
.add-to-cart:focus,
.product-variants:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.product-info,
.carousel img {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-info:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
