/**
 * Bitstech Store — Single Product Layout Variants
 *
 * Three real layout reflows controlled by `bt_product_layout` Customizer setting:
 *   • default   — WooCommerce 50/50 split (gallery left, summary right)
 *   • extended  — Full-width hero gallery on top, summary in centered column below
 *   • fullwidth — 60/40 split with sticky gallery, container expanded to 1600px
 */

/* ═══════════════ DEFAULT LAYOUT ═══════════════
   No overrides — uses WooCommerce template defaults. */

/* ═══════════════ EXTENDED LAYOUT ═══════════════
   Hero-style: gallery occupies full width as a wide showcase, then the
   product summary appears below in a centered, readable column. Best for
   visual products (electronics, fashion, gear). */
.bt-product-layout-extended .product {
    display: block;
}

.bt-product-layout-extended .woocommerce-product-gallery {
    width: 100% !important;
    max-width: 100%;
    float: none !important;
    margin: 0 0 var(--bt-space-2xl, 32px);
}

.bt-product-layout-extended .woocommerce-product-gallery .flex-viewport,
.bt-product-layout-extended .woocommerce-product-gallery .woocommerce-product-gallery__image:first-child img {
    max-height: 600px;
    object-fit: contain;
    background: rgba(var(--bt-primary-rgb, 117, 59, 235), 0.04);
    border-radius: var(--bt-radius-lg, 16px);
}

.bt-product-layout-extended .flex-control-thumbs,
.bt-product-layout-extended .woocommerce-product-gallery__wrapper .woocommerce-product-gallery__image:not(:first-child) {
    /* Display secondary gallery thumbnails in a horizontal row below the hero */
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    list-style: none;
    margin: 16px 0 0;
    padding: 0;
}

.bt-product-layout-extended .flex-control-thumbs li,
.bt-product-layout-extended .woocommerce-product-gallery__wrapper .woocommerce-product-gallery__image:not(:first-child) {
    flex: 0 0 calc(20% - 10px);
    max-width: calc(20% - 10px);
    margin: 0;
}

.bt-product-layout-extended .summary.entry-summary {
    width: 100% !important;
    float: none !important;
    max-width: 880px;
    margin: 0 auto;
    padding-top: var(--bt-space-lg, 24px);
}

.bt-product-layout-extended .woocommerce-tabs,
.bt-product-layout-extended .related.products,
.bt-product-layout-extended .upsells.products {
    width: 100%;
    margin-top: var(--bt-space-2xl, 32px);
}

@media (max-width: 768px) {
    .bt-product-layout-extended .woocommerce-product-gallery .flex-viewport {
        max-height: 360px;
    }
    .bt-product-layout-extended .flex-control-thumbs li {
        flex: 0 0 calc(33.33% - 8px);
        max-width: calc(33.33% - 8px);
    }
}

/* ═══════════════ FULLWIDTH LAYOUT ═══════════════
   Wide container (1600px), 60/40 grid split, sticky gallery. */
.bt-container-wide {
    max-width: 1600px !important;
}

.bt-product-layout-fullwidth .product {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 48px;
    align-items: start;
}

.bt-product-layout-fullwidth .woocommerce-product-gallery {
    width: 100% !important;
    float: none !important;
    position: sticky;
    top: 100px;
}

.bt-product-layout-fullwidth .summary.entry-summary {
    width: 100% !important;
    float: none !important;
    padding: var(--bt-space-md, 16px) var(--bt-space-md, 16px) 0 0;
}

.bt-product-layout-fullwidth .woocommerce-tabs,
.bt-product-layout-fullwidth .related.products,
.bt-product-layout-fullwidth .upsells.products {
    grid-column: 1 / -1;
    margin-top: var(--bt-space-2xl, 32px);
}

@media (max-width: 1024px) {
    .bt-product-layout-fullwidth .product {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .bt-product-layout-fullwidth .woocommerce-product-gallery {
        position: static;
    }
}

/* ═══════════════ MOBILE STICKY ADD-TO-CART ═══════════════ */
.bt-sticky-atc {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999;
    padding: 10px 16px;
    background: rgba(19, 28, 49, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.bt-sticky-atc__inner {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 100%;
}

.bt-sticky-atc__info {
    flex: 1;
    min-width: 0;
}

.bt-sticky-atc__name {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bt-sticky-atc__price {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--bt-accent, #00e0f0);
}

.bt-sticky-atc__btn {
    flex-shrink: 0;
    padding: 10px 20px;
    border-radius: 8px;
    background: var(--bt-primary, #753beb);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.bt-sticky-atc__btn:hover {
    background: var(--bt-primary-dark, #5a20c8);
}

@media (max-width: 768px) {
    .bt-sticky-atc {
        display: block;
    }
    /* Add bottom padding to body so content isn't hidden behind sticky bar */
    body.single-product {
        padding-bottom: 70px;
    }
}

/* ═══════════════ LIGHT MODE ═══════════════ */
html[data-theme="light"] .bt-sticky-atc {
    background: rgba(255, 255, 255, 0.95);
    border-top-color: #e5e7eb;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .bt-sticky-atc__name {
    color: #1a1f35;
}

html[data-theme="light"] .bt-sticky-atc__price {
    color: var(--bt-primary, #753beb);
}

html[data-theme="light"] .bt-product-layout-extended .woocommerce-product-gallery .flex-viewport,
html[data-theme="light"] .bt-product-layout-extended .woocommerce-product-gallery .woocommerce-product-gallery__image:first-child img {
    background: rgba(var(--bt-primary-rgb, 117, 59, 235), 0.025);
}


/* ═══════════════ SIDEBAR LAYOUT ═══════════════
   Single product page with right (or left) sidebar.
   The sidebar holds widgets: categories, recently-viewed, bestsellers. */
.bt-product-layout-sidebar {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 32px;
    align-items: start;
}

.bt-product-layout-sidebar.bt-product-sidebar-left {
    grid-template-columns: 320px 1fr;
}

.bt-product-layout-sidebar.bt-product-sidebar-left .bt-product-main {
    grid-column: 2;
}

.bt-product-layout-sidebar.bt-product-sidebar-left .bt-product-sidebar {
    grid-column: 1;
    grid-row: 1;
}

.bt-product-layout-sidebar .bt-product-main {
    min-width: 0; /* prevents grid overflow */
}

.bt-product-layout-sidebar .bt-product-sidebar {
    position: sticky;
    top: 100px;
}

.bt-product-layout-sidebar .bt-product-sidebar__widget {
    background: var(--bt-glass-bg, rgba(255, 255, 255, 0.04));
    border: 1px solid var(--bt-border-color, rgba(255, 255, 255, 0.08));
    border-radius: var(--bt-radius-lg, 12px);
    padding: 18px 20px;
    margin-bottom: 16px;
}

.bt-product-layout-sidebar .bt-product-sidebar__title {
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--bt-border-color, rgba(255, 255, 255, 0.08));
    color: var(--bt-text-primary, inherit);
}

.bt-product-layout-sidebar .bt-product-sidebar__cats {
    list-style: none;
    margin: 0;
    padding: 0;
}

.bt-product-layout-sidebar .bt-product-sidebar__cats li {
    margin: 0;
    padding: 6px 0;
    border-bottom: 1px dashed var(--bt-border-color, rgba(255, 255, 255, 0.06));
}

.bt-product-layout-sidebar .bt-product-sidebar__cats li:last-child {
    border-bottom: none;
}

.bt-product-layout-sidebar .bt-product-sidebar__cats a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--bt-text-secondary, inherit);
    text-decoration: none;
    transition: color 0.15s;
}

.bt-product-layout-sidebar .bt-product-sidebar__cats a:hover {
    color: var(--bt-primary, #753beb);
}

.bt-product-layout-sidebar .bt-product-sidebar__cats span {
    font-size: 11px;
    color: var(--bt-text-secondary, #888);
    opacity: 0.7;
}

.bt-product-layout-sidebar .bt-product-sidebar__products {
    list-style: none;
    margin: 0;
    padding: 0;
}

.bt-product-layout-sidebar .bt-product-sidebar__products li {
    padding: 8px 0;
    border-bottom: 1px solid var(--bt-border-color, rgba(255, 255, 255, 0.06));
}

.bt-product-layout-sidebar .bt-product-sidebar__products li:last-child {
    border-bottom: none;
}

.bt-product-layout-sidebar .bt-product-sidebar__products a {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--bt-text-primary, inherit);
}

.bt-product-layout-sidebar .bt-product-sidebar__products img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.bt-product-layout-sidebar .bt-product-sidebar__products-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.bt-product-layout-sidebar .bt-product-sidebar__products-name {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--bt-text-primary, inherit);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bt-product-layout-sidebar .bt-product-sidebar__products-price {
    font-size: 12px;
    font-weight: 700;
    color: var(--bt-primary, #753beb);
}

@media (max-width: 1024px) {
    .bt-product-layout-sidebar,
    .bt-product-layout-sidebar.bt-product-sidebar-left {
        grid-template-columns: 1fr;
    }

    .bt-product-layout-sidebar.bt-product-sidebar-left .bt-product-main,
    .bt-product-layout-sidebar.bt-product-sidebar-left .bt-product-sidebar {
        grid-column: 1;
    }

    .bt-product-layout-sidebar .bt-product-sidebar {
        position: static;
    }
}
