// Target the WooCommerce filter wrapper class
.woocommerce-filters-filter.archm-archived-data-filter-wrapper {
    // Match WooCommerce's filter styling - no extra margin needed as flex handles spacing
    display: flex;
    flex-direction: column;
    align-items: flex-start;

    .archm-archived-data-filter {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 0;

        .components-base-control {
            margin-bottom: 0;
            width: 100%;
        }

        // Apply WooCommerce filters label styling (matches "Show:" label)
        .woocommerce-filters-label {
            padding: 0px 12px;
            display: block;
            font-weight: 500;
            color: #1e1e1e;
            font-size: 13px;
            line-height: 1.5;
        }

        // Apply WooCommerce dropdown button labels styling
        .woocommerce-dropdown-button_labels {
            // Match .woocommerce-dropdown-button_labels styling from screenshot
            // Change padding from 0px to 8px for top/bottom (as shown in screenshot)
            text-align: left;
            padding: 0px 12px; // Top/bottom: 8px (not 0px), Left/right: 12px
            min-height: 48px;
            display: flex;
            align-items: center;
            width: 100%;
            justify-content: space-around;

            .components-base-control {
                width: 100%;
                margin-bottom: 0;
            }

            // Style the select input to match WooCommerce dropdowns
            .components-select-control__input {
                min-width: 280px;
                width: 100%;
                padding: 8px 12px;
                min-height: 48px;
                border: 1px solid #757575;
                border-radius: 2px;
                font-size: 13px;
                line-height: 1.5;
                background-color: #fff;
                color: #1e1e1e;
                cursor: pointer;

                &:focus {
                    border-color: #0073aa;
                    box-shadow: 0 0 0 1px #0073aa;
                    outline: 2px solid transparent;
                }

                &:hover {
                    border-color: #1e1e1e;
                }

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

            // Backfill loader overlay
            .archm-filter-wrapper {
                position: relative;
                width: 100%;

                .archm-backfill-loader-overlay {
                    position: absolute;
                    top: 0;
                    left: 0;
                    right: 0;
                    bottom: 0;
                    background-color: rgba(255, 255, 255, 0.98);
                    display: flex;
                    align-items: center;
                    justify-content: flex-start;
                    z-index: 10;
                    border-radius: 2px;
                    padding: 0;
                    min-height: 48px;
                    border: 1px solid #757575;
                    border-radius: 2px;

                    .archm-backfill-loader-content {
                        display: flex;
                        align-items: center;
                        gap: 12px;
                        width: 100%;
                        padding: 8px 12px;

                        .archm-backfill-spinner {
                            flex-shrink: 0;
                            width: 20px;
                            height: 20px;
                            display: flex;
                            align-items: center;
                            justify-content: center;

                            .archm-spinner-svg {
                                width: 20px;
                                height: 20px;
                                color: #0073aa;

                                .archm-spinner-circle {
                                    stroke: #0073aa;
                                    stroke-width: 2;
                                    fill: none;
                                    stroke-linecap: round;
                                    stroke-dasharray: 31.416;
                                    stroke-dashoffset: 31.416;
                                    animation: archm-spinner-dash 2s ease-in-out infinite;
                                }
                            }
                        }

                        .archm-backfill-text {
                            display: flex;
                            flex-direction: column;
                            gap: 0;
                            flex: 1;
                            align-items: flex-start;

                            .archm-backfill-message {
                                font-size: 13px;
                                line-height: 1.5;
                                color: #1e1e1e;
                                font-weight: 400;
                                margin: 0;
                                padding: 0;
                            }

                            .archm-backfill-percentage {
                                font-size: 13px;
                                line-height: 1.5;
                                color: #757575;
                                font-weight: 500;
                                margin: 0;
                                padding: 0;
                            }
                        }
                    }
                }
            }
        }
    }
}

@keyframes archm-spinner-dash {
    0% {
        stroke-dasharray: 0 31.416;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 15.708 15.708;
        stroke-dashoffset: -7.854;
    }
    100% {
        stroke-dasharray: 31.416 0;
        stroke-dashoffset: -31.416;
    }
}

// Ensure proper integration with WooCommerce filters flex container
// Note: Double underscore (__) is the correct BEM naming convention
.woocommerce-filters__basic-filters {
    .woocommerce-filters-filter.archm-archived-data-filter-wrapper {
        // Flex container handles spacing automatically
        // Match the structure of other filters
        // Use CSS order to ensure consistent positioning (always appears last)
        // This prevents position changes when WooCommerce re-renders filters
        order: 999;
    }
}

// Responsive adjustments
@media (max-width: 782px) {
    .archm-archived-data-filter-wrapper {
        display: block;
        margin-left: 0;
        margin-top: 12px;
        width: 100%;

        .archm-archived-data-filter {
            width: 100%;

            .components-select-control__input {
                width: 100%;
                min-width: auto;
            }
        }
    }
}

