/**
 * DigiCommerce Add to Cart Block Styles
 */

.wp-block-digicommerce-add-to-cart {
    margin: 0 0 var(--wp--preset--spacing--50) 0;
    padding: 0;
}

.digicommerce-add-to-cart {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Variations */
.variation-prices {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.variation-label {
    font-size: 1rem;
    font-weight: 700;
    color: #333333;
    margin: 0 0 1rem 0;
}

.variations-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.variation-option {
    display: flex;
    align-items: center;
    justify-content: center;

    input[type='radio'] {
        position: absolute;
        margin: -1px;
        height: 1px;
        width: 1px;
        overflow: hidden;
        white-space: nowrap;
        border: 0;
        padding: 0;
        clip: rect(0, 0, 0, 0);

        + label {
            background-color: #f8f9fa;
            color: #333333;
            margin: 0;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 0.5rem;
            border-radius: 0.25rem;
            padding: 1rem;
            text-align: center;
            font-size: 0.85rem;
            font-weight: 400;
            cursor: pointer;
            transition: all 300ms ease-in-out;
            min-width: 120px;

            &::before,
            &::after {
                display: none;
            }

            &:hover {
                background-color: #333333;
                color: white;
            }

            .variation-name {
                line-height: 1;
                font-weight: 700;
            }

            .variation-pricing {
                line-height: 1;
                display: flex;
                align-items: center;
                gap: 0.25rem;

                .price-wrapper {
                    display: inline-flex;
                    align-items: baseline;

                    .price-symbol {
                        font-size: 0.875em;
                    }

                    .price {
                        font-weight: 500;
                    }

                    &.variation-sale-price {
                        color: #28a745;
                        font-weight: 600;
                    }

                    &.variation-regular-price {
                        color: rgba(0, 0, 0, 0.5);
                        text-decoration: line-through;
                        font-size: 0.875rem;
                        transition: all 300ms ease-in-out;
                    }

                    &.variation-price {
                        color: #28a745;
                        font-weight: 600;
                    }
                }
            }
        }

        &:hover + label,
        &:checked + label {
            background-color: #333333;
            color: white;

            .variation-pricing {
                .price-wrapper.variation-regular-price {
                    color: rgba(255, 255, 255, 0.5);
                }

                .price-wrapper.variation-sale-price,
                .price-wrapper.variation-price {
                    color: #90ee90;
                }
            }
        }

        &:focus + label {
            outline: 2px solid #007cba;
            outline-offset: 2px;
        }
    }
}

/* Button */
.add-to-cart-button {
    width: 100%;
    border-radius: 0.375rem;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    text-decoration: none;
    min-height: 44px;

    &:focus {
        outline: none;
    }

    &:disabled,
    &.button-disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .variations-container {
        flex-direction: column;
        gap: 0.5rem;
    }

    .variation-option {
        width: 100%;

        input[type='radio'] + label {
            flex-direction: row;
            justify-content: space-between;
            align-items: center;
            min-width: auto;
        }
    }
}

/* RTL Support */
[dir='rtl'] {
    .variation-option {
        input[type='radio'] + label {
            .variation-pricing {
                flex-direction: row-reverse;
            }
        }
    }
}
