.dp-swatches-container {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin-top: 5px;
    margin-bottom: 15px;
    position: relative;
    overflow: hidden;
    /* Force bounds containment */
}

/* CRITICAL: Convert WooCommerce variation tables to flexbox explicitly to override Shoptimizer's infinite-width table cells */
.variations_form table.variations,
.variations_form table.variations tbody {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
}

.variations_form table.variations tr {
    display: flex !important;
    flex-direction: column !important;
    /* Stack vertically on smaller screens or by default if space is tight */
    width: 100% !important;
    max-width: 100% !important;
    margin-bottom: 10px;
}


.variations_form table.variations th.label {
    display: block !important;
    width: auto !important;
    flex: 0 0 max-content !important;
    padding-right: 15px !important;
    text-align: left;
}

.variations_form table.variations td.value {
    display: block !important;
    flex: 1 !important;
    min-width: 0 !important;
    /* Absolute vital for preventing flex expansion */
    max-width: 100% !important;
    width: 100% !important;
}

.dp-scroll-left,
.dp-scroll-right {
    background: #fff;
    border: 1px solid #ddd;
    color: #555;
    padding: 10px 8px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dp-scroll-left:hover,
.dp-scroll-right:hover {
    background: #f5f5f5;
}

.dp-swatches-wrapper {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 12px;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
    padding: 2px 0;
    flex: 1;
    min-width: 0;
    /* CRITICAL: prevents flex item from exceeding container width in tables */
}

.dp-swatches-wrapper::-webkit-scrollbar {
    display: none;
}

.dp-swatch {
    cursor: pointer;
    border: 1px solid #e0e0e0;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    background: #fff;
    flex-shrink: 0;
}

.dp-swatch:hover {
    border-color: #999;
}

.dp-swatch.selected {
    border-color: #111;
    /* border-width: 2px; */
    padding: 7px;
    /* compensate for border width */
}

.dp-swatch-image-wrap {
    margin-bottom: 6px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
    background: #fcfcfc;
}

.dp-swatch-image-wrap img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.dp-swatch-label {
    font-size: 13px;
    text-align: center;
    line-height: 1.2;
    color: #555;
}

.dp-swatch.selected .dp-swatch-label {
    /* font-weight: 600; */
    color: #111;
}

td.value .reset_variations_wrap {
    display: none !important;
}

/* Hide the default woocommerce variation wrapper for dynamic pricing products */
body.is-dynamic-pricing-product .woocommerce-variation.single_variation {
    display: none !important;
}

/* Initially hide the elementor price widget until JS calculates the first price */
body.is-dynamic-pricing-product #my-product-summary .elementor-widget-woocommerce-product-price {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

/* Dynamic Pricing Attributes Table Styling */
.dp-selected-attributes-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    margin-bottom: 20px;
    font-size: 14px;
    border: 1px solid #e5e5e5;
}

.dp-selected-attributes-table th,
.dp-selected-attributes-table td {
    padding: 10px 15px;
    border: 1px solid #e5e5e5;
    text-align: left;
    vertical-align: middle;
}

.dp-selected-attributes-table th {
    background-color: #f9f9f9;
    font-weight: 600;
    color: #333;
    width: 50%;
}

.dp-selected-attributes-table td {
    color: #666;
    background-color: #fff;
}