/**
 * Sali WooCommerce Buttons Widget Styling
 */

.sali-woo-buttons-container,
.sali-woo-buttons-container button,
.sali-woo-buttons-container input {
    font-family: 'Poppins', sans-serif !important;
}

.sali-woo-buttons-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-bottom: 20px;
    box-sizing: border-box;
}

.sali-woo-buttons-container * {
    box-sizing: border-box;
}

/* Variations & Quantity Rows */
.sali-woo-variations-wrapper,
.sali-woo-buttons-container .sali-woo-variations-wrapper.variations {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 8px !important;
    margin-bottom: 8px !important;
    background: transparent !important;
    border: none !important;
}

.sali-woo-var-row,
.sali-woo-qty-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.sali-woo-var-label,
.sali-woo-qty-label {
    font-size: 16px;
    font-weight: 500;
    color: #222222;
    margin-right: 15px;
    width: 80px;
    flex-shrink: 0;
}

.sali-woo-var-selector {
    position: relative;
    display: flex;
    align-items: center;
    background-color: #ffffff;
    border: 1px solid #cccccc !important;
    border-radius: 6px !important;
    width: 100%;
    max-width: 250px;
    height: 38px;
    overflow: hidden;
    transition: border-color 0.2s ease;
    box-shadow: none !important;
}

.sali-woo-var-selector:hover,
.sali-woo-var-selector:focus-within {
    border-color: #b3b3b3 !important;
}

.sali-woo-var-selector select {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    padding: 0 35px 0 12px !important;
    font-size: 15px !important;
    font-weight: 500 !important;
    color: #222222 !important;
    cursor: pointer !important;
    box-shadow: none !important;
}

.sali-woo-var-arrow {
    position: absolute;
    right: 12px;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sali-woo-var-arrow svg {
    width: 16px;
    height: 16px;
    color: #666666;
}

/* If swatches are active from sali-woo-variations, override the selector box */
.sali-woo-var-selector.sali-has-swatches,
.sali-woo-var-selector:has(.sali-swatches-container),
.sali-woo-var-selector:has(.sali-swatches-list) {
    border: none !important;
    background: transparent !important;
    width: auto !important;
    max-width: none !important;
    height: auto !important;
    overflow: visible !important;
}

.sali-woo-var-selector.sali-has-swatches .sali-woo-var-arrow,
.sali-woo-var-selector:has(.sali-swatches-container) .sali-woo-var-arrow {
    display: none !important;
}

/* Hide duplicate variations price and stock under the dropdown */
.sali-woo-buttons-container .single_variation_wrap,
.sali-woo-buttons-container .woocommerce-variation,
.sali-woo-buttons-container .woocommerce-variation-price,
.sali-woo-buttons-container .woocommerce-variation-availability {
    display: none !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0 !important;
    visibility: hidden !important;
    overflow: hidden !important;
}

/* Swatches Override to prevent theme styles from breaking layout */
.sali-woo-buttons-container .sali-swatches-container {
    width: 100% !important;
    margin-bottom: 0 !important;
}

.sali-woo-buttons-container .sali-swatches-list {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    width: 100% !important;
}

.sali-woo-buttons-container .sali-swatch-item {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 4px !important;
    padding: 6px 12px !important;
    min-height: 38px !important;
    width: auto !important;
    height: auto !important;
    box-sizing: border-box !important;
    cursor: pointer !important;
    margin: 0 !important;
}

.sali-woo-buttons-container .sali-swatch-item.sali-selected {
    border-color: #d50000 !important; /* Rich red matching Beli Sekarang */
    color: #d50000 !important;
}

.sali-woo-buttons-container .sali-swatch-img {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    max-width: 32px !important;
    max-height: 32px !important;
    object-fit: cover !important;
    display: inline-block !important;
    margin-right: 8px !important;
    border: 1px solid #edf2f7 !important;
    border-radius: 3px !important;
    float: none !important;
}

.sali-woo-buttons-container .sali-swatch-text {
    font-size: 13px !important;
    font-weight: 500 !important;
    line-height: 1.2 !important;
    display: inline-block !important;
}

.sali-woo-qty-selector {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #ffffff !important;
    border: 1px solid #cccccc !important;
    border-radius: 6px !important;
    padding: 0 4px !important;
    width: 110px !important;
    height: 38px !important;
    overflow: hidden !important;
    transition: border-color 0.2s ease;
    box-shadow: none !important;
}

.sali-woo-qty-selector:hover,
.sali-woo-qty-selector:focus-within {
    border-color: #b3b3b3 !important;
}

.sali-woo-qty-btn {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    font-size: 16px !important;
    font-weight: 400 !important;
    color: #666666 !important;
    cursor: pointer !important;
    width: 30px !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    user-select: none !important;
    transition: color 0.2s ease, background-color 0.2s ease;
    border-radius: 4px !important;
}

.sali-woo-qty-btn:hover {
    color: #111111 !important;
    background-color: #f5f5f5 !important;
}

.sali-woo-qty-btn:active {
    background-color: #e8e8e8 !important;
}

.sali-woo-buttons-container .sali-woo-qty-selector input.sali-woo-qty-input,
.sali-woo-qty-selector input,
.sali-woo-qty-selector input.sali-woo-qty-input,
.sali-woo-qty-input {
    width: 40px !important;
    height: 100% !important;
    border: 0px solid transparent !important;
    border-width: 0px !important;
    border-style: none !important;
    outline: none !important;
    box-shadow: none !important;
    text-align: center !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    color: #222222 !important;
    background: transparent !important;
    background-color: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    -moz-appearance: textfield !important;
}

.sali-woo-qty-input::-webkit-outer-spin-button,
.sali-woo-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}

/* Buy Now Row */
.sali-woo-buy-row {
    width: 100%;
    margin-bottom: 5px;
}

.sali-woo-btn-buy {
    width: 100%;
    background-color: #d50000;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    transition: background-color 0.2s ease, transform 0.1s ease, opacity 0.2s ease;
}

.sali-woo-btn-buy:hover {
    background-color: #b20000;
}

.sali-woo-btn-buy:active {
    transform: scale(0.995);
}

.sali-woo-btn-buy.loading {
    opacity: 0.75;
    cursor: not-allowed;
}

/* Action Row Buttons */
.sali-woo-actions-row {
    display: flex;
    width: 100%;
    gap: 12px;
}

.sali-woo-actions-row button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    border: 1px solid #dcdcdc;
    border-radius: 8px;
    padding: 12px 10px;
    font-size: 15px;
    font-weight: 500;
    color: #222222;
    cursor: pointer;
    outline: none;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
    height: 46px;
}

.sali-woo-actions-row button:hover {
    background-color: #fafafa;
    border-color: #b3b3b3;
    color: #111111;
}

.sali-woo-actions-row button:active {
    background-color: #f0f0f0;
}

.sali-woo-action-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
}

.sali-woo-action-icon svg {
    width: 18px;
    height: 18px;
    color: #1b4f72;
    stroke: currentColor;
    fill: none;
    transition: transform 0.2s ease, color 0.2s ease, stroke 0.2s ease;
}

/* Cart Plus Icon specific color if any */
.sali-woo-btn-cart:hover .sali-woo-action-icon svg {
    transform: scale(1.05);
    color: #111111;
}

/* Wishlist Active State */
.sali-woo-btn-wishlist.active .sali-woo-action-icon svg {
    color: #d50000;
    stroke: #d50000;
    fill: #d50000;
}

.sali-woo-btn-wishlist.loading {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Share Dropdown Wrapper & Button */
.sali-woo-share-wrapper {
    position: relative;
    flex: 1;
    display: flex;
}

.sali-woo-btn-share {
    width: 100%;
}

/* Share Dropdown Menu */
.sali-woo-share-dropdown {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    width: 190px;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    padding: 6px;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sali-woo-share-dropdown::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: #ffffff transparent transparent transparent;
}

.sali-woo-share-dropdown::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 7px;
    border-style: solid;
    border-color: #e2e8f0 transparent transparent transparent;
    z-index: -1;
}

.sali-woo-share-dropdown.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.sali-share-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    font-size: 14px;
    font-weight: 500;
    color: #334155;
    text-decoration: none !important;
    border-radius: 8px;
    transition: background-color 0.2s ease, color 0.2s ease;
    cursor: pointer;
}

.sali-share-opt:hover {
    background-color: #f1f5f9;
    color: #0f172a;
}

.sali-share-opt svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Share Network Colors on Hover */
.sali-share-opt.share-wa svg {
    color: #25D366;
}
.sali-share-opt.share-fb svg {
    color: #1877F2;
}
.sali-share-opt.share-tw svg {
    color: #000000;
}
.sali-share-opt.share-copy svg {
    color: #64748b;
    fill: none;
    stroke: currentColor;
}

/* Copy Link Toast Alert (Simple overlay or temporary text) */
.sali-share-copy-copied {
    color: #10b981 !important;
}

/* Editor Mock placeholders */
.sali-woo-buttons-editor-placeholder {
    padding: 20px;
    border: 2px dashed #ccc;
    background-color: #fafafa;
    text-align: center;
    color: #666;
    font-size: 14px;
    border-radius: 8px;
}

/* Layout alignment modifier classes if used in Elementor class_prefix */
.elementor-align-left .sali-woo-buttons-container {
    align-items: flex-start;
}
.elementor-align-center .sali-woo-buttons-container {
    align-items: center;
}
.elementor-align-right .sali-woo-buttons-container {
    align-items: flex-end;
}
.elementor-align-justify .sali-woo-buttons-container {
    align-items: stretch;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .sali-woo-actions-row {
        gap: 8px;
    }
    .sali-woo-actions-row button {
        padding: 10px 4px;
        font-size: 13px;
        height: 42px;
    }
    .sali-woo-action-icon {
        margin-right: 5px;
    }
    .sali-woo-action-icon svg {
        width: 16px;
        height: 16px;
    }
}
/* Hide WooCommerce default "View cart" link appended after AJAX add-to-cart */
.sali-woo-buttons-container .added_to_cart {
    display: none !important;
}
/* Styling for disabled out of stock action buttons */
.sali-woo-buttons-container .sali-woo-btn-buy.disabled,
.sali-woo-buttons-container .sali-woo-btn-cart.disabled {
    background-color: #cccccc !important;
    border-color: #cccccc !important;
    color: #666666 !important;
    cursor: not-allowed !important;
    opacity: 0.8 !important;
    pointer-events: none !important;
}
/* Hide WooCommerce notices on single product pages to keep layout clean */
.single-product .woocommerce-notices-wrapper,
.single-product .woocommerce-message,
.single-product .woocommerce-error,
.single-product .woocommerce-info {
    display: none !important;
}
