/* Swatch Override — loads AFTER Smart Variations plugin */

.wcsvfs-swatches {
    overflow: visible !important;
    padding: 0 !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
}

.wcsvfs-swatches .swatch-image {
    width: 90px !important;
    height: auto !important;
    border-radius: 6px !important;
    border: 2px solid #e5e5e5 !important;
    margin: 0 !important;
    margin-right: 0 !important;
    opacity: 1 !important;
    overflow: visible !important;
    cursor: pointer !important;
    transition: border-color .2s, transform .2s, box-shadow .2s !important;
    position: relative !important;
    display: inline-flex !important;
    flex-direction: column !important;
    align-items: center !important;
    line-height: normal !important;
    padding: 4px !important;
    background: #fff !important;
    text-align: center !important;
}

.wcsvfs-swatches .swatch-image img {
    width: 80px !important;
    height: 80px !important;
    object-fit: cover !important;
    display: block !important;
    border: none !important;
    border-radius: 4px !important;
}

/* Show label below image */
.wcsvfs-swatches .swatch-image::before {
    content: attr(title);
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: #666;
    margin-top: 4px;
    line-height: 1.2;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    order: 2;
}

.wcsvfs-swatches .swatch-image:hover {
    border-color: #4d5356 !important;
    transform: scale(1.05) !important;
    z-index: 2 !important;
    box-shadow: 0 4px 12px rgba(0,0,0,.15) !important;
    opacity: 1 !important;
}

.wcsvfs-swatches .swatch-image.selected {
    border-color: #55a668 !important;
    box-shadow: 0 0 0 2px #55a668 !important;
    opacity: 1 !important;
}

.wcsvfs-swatches .swatch-image.selected::before {
    color: #393e41;
    font-weight: 600;
}

.wcsvfs-swatches .swatch-image.selected:hover {
    box-shadow: 0 0 0 2px #55a668, 0 4px 12px rgba(0,0,0,.15) !important;
}

/* Disabled */
.wcsvfs-swatches .swatch-image.disabled {
    opacity: .3 !important;
}

/* Variations table — match WAPF container */
table.variations {
    border: none !important;
    background: #faf8f5 !important;
    border-radius: 8px !important;
    padding: 16px 20px !important;
    margin-bottom: 8px !important;
}

table.variations tbody {
    display: block !important;
}

table.variations tr {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
}

table.variations th.label {
    text-align: left !important;
    padding: 0 0 8px !important;
}

table.variations th.label label {
    font-weight: 600 !important;
    font-size: 15px !important;
    color: #393e41 !important;
}

table.variations td.value {
    width: 100% !important;
    padding: 0 !important;
}

/* Hide Wissen */
.reset_variations {
    display: none !important;
}

@media (max-width: 599px) {
    .wcsvfs-swatches .swatch-image {
        width: 84px !important;
    }
    .wcsvfs-swatches .swatch-image img {
        width: 74px !important;
        height: 74px !important;
    }
}

/* Swatch hover lightbox */
.wcsvfs-swatches .swatch-image:hover::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 200px;
    background-image: var(--swatch-bg);
    background-size: cover;
    background-position: center;
    border-radius: 8px;
    box-shadow: 0 16px 48px rgba(0,0,0,.3);
    z-index: 9999;
    pointer-events: none;
    animation: swatchZoomIn .15s ease-out;
}

@keyframes swatchZoomIn {
    from { opacity: 0; transform: translateX(-50%) scale(.8); }
    to { opacity: 1; transform: translateX(-50%) scale(1); }
}

/* Overlay behind lightbox */
.wcsvfs-swatches .swatch-image:hover::before {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 220px);
    left: 50%;
    transform: translateX(-50%);
    background: #393e41;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    padding: 6px 16px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 10000;
    pointer-events: none;
    animation: swatchZoomIn .15s ease-out;
    order: unset;
    display: block;
    max-width: none;
    overflow: visible;
    text-overflow: unset;
    margin-top: 0;
    line-height: normal;
}

/* Qty + Button side by side — inside variation add to cart */
.woocommerce-variation-add-to-cart.variations_button {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 10px !important;
}

.woocommerce-variation-add-to-cart .wapf {
    flex: 0 0 100% !important;
    width: 100% !important;
}

.woocommerce-variation-add-to-cart .quantity {
    flex: 0 0 auto !important;
}

.woocommerce-variation-add-to-cart .single_add_to_cart_button {
    flex: 1 !important;
}

/* Sticky bottom bar on product page */
.curtainshop-sticky-bar { 
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #393e41;
    border-top: none;
    box-shadow: 0 -4px 20px rgba(0,0,0,.2);
    padding: 12px 20px;
    z-index: 99;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.curtainshop-sticky-bar.is-visible {
    display: flex;
}

.curtainshop-sticky-bar__info {
    display: flex;justify-content: center;
    align-items: center;
    gap: 8px;
    flex: 1;text-align: center;
    min-width: 0;
}

.curtainshop-sticky-bar__name {
    font-family: 'Kanit', sans-serif;
    font-weight: 600;
    font-size: 18px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.curtainshop-sticky-bar__price {
    font-weight: 700;
    font-size: 22px;
    color: #55a668;
    white-space: nowrap;
}

.curtainshop-sticky-bar__btn {
    background: #55a668;
    color: #393e41;
    border: none;
    border-radius: 6px;
    font-family: 'Kanit', sans-serif;
    font-weight: 600;
    font-size: 15px;
    padding: 12px 28px;
    cursor: pointer;
    transition: background .2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.curtainshop-sticky-bar__btn:hover {
    background: #478f58;
}

@media (max-width: 599px) {
    .curtainshop-sticky-bar { 
        padding: 10px 16px;
        gap: 10px;
    }
    .curtainshop-sticky-bar__name {
        display: none;
    }
    .curtainshop-sticky-bar__price {
        font-size: 16px;
    }
    .curtainshop-sticky-bar__btn {
        padding: 10px 20px;
        font-size: 14px;
    }
}

/* Hide original totals, qty, and add to cart — use sticky bar instead */
.single-product .wapf-product-totals,
.single-product .woocommerce-variation-add-to-cart .quantity,
.single-product .woocommerce-variation-add-to-cart .single_add_to_cart_button {
    display: none !important;
}

/* Also hide for simple products */
.single-product form.cart > .quantity,
.single-product form.cart > .single_add_to_cart_button {
    display: none !important;
}

/* Keep sticky bar always visible on product page */
.curtainshop-sticky-bar { 
    display: flex !important;
}

/* Sticky bar actions row */
.curtainshop-sticky-bar__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.curtainshop-sticky-bar__qty {
    width: 56px;
    padding: 10px 4px;
    text-align: center;
    border: 1.5px solid rgba(255,255,255,.3);
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    color: #393e41;
    background: #fff;
    -moz-appearance: textfield;
}

.curtainshop-sticky-bar__qty::-webkit-outer-spin-button,
.curtainshop-sticky-bar__qty::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Fix lightbox visibility - overflow visible on hover */
.wcsvfs-swatches .swatch-image:hover {
    overflow: visible !important;
}

.wcsvfs-swatches .swatch-image img {
    border-radius: 4px !important;
}
