/* Product Gallery Layout Fixes */

/* Main Layout Grid - Enforcing Desktop Side-by-Side */
.avira-product-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: start;
}

@media (min-width: 768px) {
    .avira-product-layout {
        grid-template-columns: 45% 55%;
        /* Custom split: Image slightly narrower */
        gap: 3rem;
    }
}

@media (min-width: 1024px) {
    .avira-product-layout {
        grid-template-columns: 42% 58%;
        /* Even narrower image on large screens */
        gap: 4rem;
    }
}

/* Gallery Internals - Force Vertical Layout (Thumbnails below) */
.woocommerce-product-gallery {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    position: relative;
}

.woocommerce-product-gallery .flex-viewport {
    width: 100% !important;
    margin-bottom: 15px;
    order: 1;
    /* Ensure main image is first */
}

.woocommerce-product-gallery .flex-control-thumbs {
    display: flex !important;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 0;
    width: 100%;
    padding: 0;
    order: 2;
    /* Thumbnails second */
}

.woocommerce-product-gallery .flex-control-thumbs li {
    width: 60px !important;
    /* Mini-format as requested */
    height: auto;
    flex-shrink: 0;
    list-style: none;
    cursor: pointer;
    margin-bottom: 0 !important;
}

.woocommerce-product-gallery .flex-control-thumbs li img {
    width: 100%;
    height: auto;
    opacity: 0.5;
    transition: all 0.2s ease;
    border-radius: 4px;
    border: 1px solid transparent;
}

.woocommerce-product-gallery .flex-control-thumbs li img.flex-active,
.woocommerce-product-gallery .flex-control-thumbs li img:hover {
    opacity: 1;
    border-color: #d4af37;
    /* Avira Gold */
}

/* Ensure main image fills container */
.woocommerce-product-gallery__image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    /* Soft rounding */
}

/* Single product — golden border on gallery */
.avira-gallery {
    border: 2px solid transparent !important;
    background-image:
        linear-gradient(white, white),
        linear-gradient(135deg, #D4AF37 0%, #B76E79 50%, #D4AF37 100%) !important;
    background-origin: border-box !important;
    background-clip: padding-box, border-box !important;
    transition: box-shadow 0.3s ease;
}

.avira-gallery:hover {
    box-shadow:
        0 0 20px rgba(212, 175, 55, 0.4),
        0 0 40px rgba(183, 110, 121, 0.2);
}

/* Single product — golden border on specs box */
.avira-attributes-box {
    border: 2px solid transparent !important;
    background-image:
        linear-gradient(white, white),
        linear-gradient(135deg, #D4AF37 0%, #B76E79 50%, #D4AF37 100%) !important;
    background-origin: border-box !important;
    background-clip: padding-box, border-box !important;
    transition: box-shadow 0.3s ease;
}

.avira-attributes-box:hover {
    box-shadow:
        0 0 16px rgba(212, 175, 55, 0.35),
        0 0 30px rgba(183, 110, 121, 0.15);
}

/* Single product — golden border on price cards */
.price-card {
    border: 2px solid transparent !important;
    background-image:
        linear-gradient(white, white),
        linear-gradient(135deg, #D4AF37 0%, #B76E79 50%, #D4AF37 100%) !important;
    background-origin: border-box !important;
    background-clip: padding-box, border-box !important;
    transition: box-shadow 0.3s ease;
}

.price-card:hover {
    box-shadow:
        0 0 16px rgba(212, 175, 55, 0.35),
        0 0 30px rgba(183, 110, 121, 0.15);
}

/* Override WooCommerce's default float layout so CSS Grid controls the product section */
@media (min-width: 768px) {
    .woocommerce .product .woocommerce-product-gallery,
    .woocommerce .product .summary.entry-summary {
        width: 100% !important;
        max-width: 100% !important;
        float: none !important;
    }
}

/* WooCommerce Variation Swatches Custom Styling (Avira Brand) */
ul.variable-items-wrapper {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    margin-bottom: 0.5rem !important;
}

li.variable-item.button-variable-item {
    border: 1px solid #e5e7eb !important;
    border-radius: 4px !important;
    padding: 6px 12px !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    color: #374151 !important;
    background-color: #fff !important;
    cursor: pointer !important;
    transition: all 0.2s ease-in-out !important;
    box-shadow: none !important;
}

li.variable-item.button-variable-item:hover {
    border-color: #111827 !important;
    /* Tailwind Gray-900 */
    color: #111827 !important;
}

li.variable-item.button-variable-item.selected {
    border-color: #111827 !important;
    background-color: #111827 !important;
    color: #ffffff !important;
}

/* Hide default WooCommerce variation select if it's there */
.variations select {
    display: none !important;
}

/* Related products — match front page card style */
.related li.product {
    border: 2px solid transparent;
    background-image:
        linear-gradient(white, white),
        linear-gradient(135deg, #D4AF37 0%, #B76E79 50%, #D4AF37 100%);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    border-radius: 0.75rem;
    overflow: hidden;
    padding: 0;
    transition: box-shadow 0.3s ease;
}

.related li.product:hover {
    box-shadow:
        0 0 20px rgba(212, 175, 55, 0.4),
        0 0 40px rgba(183, 110, 121, 0.2);
}

/* Related products card inner padding */
.related li.product a.woocommerce-loop-product__link {
    display: block;
    padding: 12px 12px 0;
}

.related li.product img {
    border-radius: 0.5rem;
    width: 100%;
    height: auto;
    display: block;
}

.related li.product .woocommerce-loop-product__title {
    padding: 10px 12px 2px;
    font-size: 0.875rem;
    font-weight: 600;
}

.related li.product .price {
    padding: 0 12px 10px;
    display: block;
    font-size: 0.8rem;
    color: #6b7280;
}

/* Add to cart button — avira purple style */
.related li.product .button.add_to_cart_button {
    display: block;
    width: calc(100% - 24px);
    margin: 0 12px 12px;
    padding: 10px;
    background-color: #6d3b9e;
    color: #ffffff !important;
    border: none;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-decoration: none;
}

.related li.product .button.add_to_cart_button:hover {
    background-color: #5a2e87;
}

/* Per-colour swatch backgrounds */
li.variable-item.button-variable-item-1b-natural-black {
    background-color: #1a1a1a !important;
    border-color: #1a1a1a !important;
    color: #ffffff !important;
}
li.variable-item.button-variable-item-1b-natural-black:hover,
li.variable-item.button-variable-item-1b-natural-black.selected {
    background-color: #000000 !important;
    border-color: #000000 !important;
    color: #ffffff !important;
}

li.variable-item.button-variable-item-burgundy {
    background-color: #800020 !important;
    border-color: #800020 !important;
    color: #ffffff !important;
}
li.variable-item.button-variable-item-burgundy:hover,
li.variable-item.button-variable-item-burgundy.selected {
    background-color: #5c0017 !important;
    border-color: #5c0017 !important;
    color: #ffffff !important;
}