/* Global swatches settings */

.df-swatches-container {
    display: flex;
    flex-flow: wrap;
    padding: 0;
    position: relative;
    box-sizing: border-box;
    grid-gap: 8px;
    width: fit-content;
}

.df-swatches-container * {
    box-sizing: border-box;
}

.df-swatches-option {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-transition: 200ms;
    transition: 200ms;
    text-align: center;
    white-space: nowrap;
    line-height: 1.3;
    cursor: pointer;
    border: 1px solid #fff;
    background: #fff;
    padding: 1px;
    user-select: none; /* supported by Chrome and Opera */
    -webkit-user-select: none; /* Safari */
    -khtml-user-select: none; /* Konqueror HTML */
    -moz-user-select: none; /* Firefox */
    -ms-user-select: none; /* Internet Explorer/Edge */
}

.df-label-option,
.df-image-option {
    border: 1px solid #00000020;
}

.df-swatches-option .df-swatch-inner {
    display: flex;
    width: calc(100% - 2px);
    height: calc(100% - 2px);
    border-radius: inherit;
    -webkit-transition: 200ms;
    transition: 200ms;
    align-items: center;
    justify-content: center;
    color: #000000;
}

.df-swatches-option:not( .df-label-option, .df-image-option ) .df-swatch-inner {
    border: 1px solid #00000020;
}

.df-swatches-option:not( .df-swatches-disabled, .df-swatches-out-of-stock ):hover {
    border-color: var(--df-swatches-border-color-hover, #00000090);
    box-sizing: border-box;
}

.df-image-option {
    background-repeat: no-repeat;
    background-position: center;
}

.df-label-option {
    font-size: var(--df-swatches-font-size, 12px);
    border-width: var(--df-swatches-border-width, 1px);
    padding: 5px 10px;
}

.df-selected-swatch {
    border-color: var(--df-swatches-border-color, #000) !important;
    border-width: var(--df-swatches-border-width, 1px);
    box-sizing: border-box;
}

.df-swatches-hide,
.df-swatches-hide-disable {
    display: none;
}

.df-hidden-select {
    display: none !important;
}

/*.df-swatches-blur-disable::before,*/
/*.df-swatches-blur::before {*/
/*    content: "";*/
/*    width: 100%;*/
/*    height: 100%;*/
/*    position: absolute;*/
/*    top: 0;*/
/*    left: 0;*/
/*    background-color: #fff;*/
/*    opacity: 0.4;*/
/*    -webkit-transition: all 200ms;*/
/*    transition: all 200ms;*/
/*}*/

.df-swatches-blur-disable::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background-image: linear-gradient(to top left, transparent calc(50% - 1px), #000 50%, transparent calc(50% + 1px));
    opacity: 0;
    transition: opacity .2s ease;
    z-index: 2;
}

.df-swatches-blur-disable {
    opacity: .4;
    cursor: default;
    --wd-swatch-brd-color: var(--brdcolor-gray-500);
}

.df-swatches-blur-disable::before {
    opacity: 1
}

/*.df-swatches-blur-disable::after {*/
/*	content: "";*/
/*	position: absolute;*/
/*	inset: 0;*/
/*	background: linear-gradient(*/
/*			to top right,*/
/*			transparent calc(50% - 1px),*/
/*			currentColor calc(50% - 1px),*/
/*			currentColor calc(50% + 1px),*/
/*			transparent calc(50% + 1px)*/
/*	);*/
/*	pointer-events: none;*/
/*}*/

.df-swatches-blur-cross-disable::before,
.df-swatches-hide-disable::before,
.df-swatches-blur-cross::before {
    font-family: Dashicons;
    content: "\f335";
    color: rgba(204, 69, 69, 1);
    font-size: 1.8em;
    -webkit-transition: all 200ms;
    transition: all 200ms;
    position: absolute;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.7);
}

/* Swatches tooltip css */
.df-tooltip {
    position: absolute;
    min-width: 10px;
    min-height: 10px;
    width: max-content;
    padding: 0.2em 0.5em;
    content: "";
    background: #000;
    color: #fff;
    border-radius: 5px;
    font-size: 0.8em;
    left: 50%;
    transform: translateX(-50%) translateY(-50%);
    display: none;
    border: 1px solid;
}

.df-tooltip::before {
    content: "";
    position: absolute;
    width: 9px;
    height: 9px;
    bottom: -5px;
    left: calc(50% - 4px);
    transform: rotate(45deg);
    background: #000;
    border-top-left-radius: 10px;
    z-index: -1;
    border-right: 1px solid;
    border-bottom: 1px solid;
}

.df-tooltip-preview {
    min-width: 60px;
    min-height: 60px;
    display: block;
    background-color: #fff;
    background-position: center;
}

.df-tooltip-label {
    padding: 0.1em;
    display: flex;
    justify-content: center;
    font-size: var(--df-swatches-tooltip-font-size, 12px);
}

/*  Shop page settings */
table.df-shop-variations {
    width: 100%;
}

table.df-shop-variations,
.df-shop-variations tbody,
.df-shop-variations td,
.df-shop-variations tr {
    margin: 0;
    padding: 3px 0;
    border: 0;
}

.df-shop-variations td.label {
    text-align: left;
}

.df-shop-variations tr td {
    display: flex;
}

.df_shop_align_center table tr td {
    justify-content: center;
}

.df_shop_align_right table tr td {
    justify-content: flex-end;
}

.df-shop-variations .reset_variations {
    display: none !important;
}

.df-shop-variations {
    margin-bottom: auto;
    padding: 0;
}

.df-shop-variations .df-swatches-container {
    padding: 0;
}

.df-shop-variations,
.df-shop-variations td {
    border: none;
}

.df-shop-variations .df-more-link {
    font-size: 12px;
    margin-left: 4px;
    position: absolute;
    left: 100%;
    white-space: nowrap;
    pointer-events: all;
}

.df-original-price,
.df-original-thumbnail {
    display: none;
}

/* Filters css */
.df-filters {
    display: flex;
    flex-wrap: wrap;
}

.df-filters li {
    display: inline-flex;
}

.df-filters li a {
    display: inline-flex;
    align-items: center;
    flex-direction: row-reverse;
    outline: none;
}

.df-filters li.chosen a {
    background-color: #eee;
    margin: 0 0.2em;
    border-radius: none;
    padding: 2px 3px !important;
}

.df-filters li.chosen a::before {
    font-family: Dashicons !important;
    content: "\f158" !important;
    display: inline-flex;
    margin-right: 0.3em !important;
    font-size: 15px;
    color: #999 !important;
}

.df-filters li.chosen .df-swatches-container {
    display: inline-flex;
}

.df-filters li .df-swatches-container .df-swatches-option {
    margin: 3px;
}

/* Product page css*/

.df-product-container .df-swatches-option:first-child {
    margin-left: 0;
}

.df-selected-label {
    content: " : ";
    font-weight: 300;
}

.df-selected-label::before {
    content: " : ";
}

.df-label-none table.variations tr th.label {
    display: none !important;
}

.df-label-inline table.variations td {
    display: table-cell !important;
}

.df-product-page table.variations .label label {
    font-size: var(--df-swatches-label-font-size, "inherit");
}

/* Astra theme compatibility css */
.theme-astra table.variations td.value {
    padding: 5px 0 !important;
}

.theme-astra.df-product-page tr th.label {
    padding-left: 0;
    padding-top: 6px !important;
}

.theme-astra.df-label-stacked tr th.label {
    padding-left: 0;
}

.theme-astra.df-label-stacked tr td.value {
    padding: 6px 0 !important;
}

/* Twenty twenty two theme compatibility css */
.theme-twentytwentytwo.df-product-page:not( .df-label-stacked ) table.variations td.value .df-product-container {
    display: inline-flex;
}

.theme-twentytwentytwo.df-label-stacked table.variations th,
.theme-twentytwentytwo.df-label-stacked table.variations td {
    display: flex;
}

.theme-twentytwentytwo table.variations tr {
    margin-bottom: 0.5rem !important;
}

/* Twenty twenty one theme compatibility css */
.theme-twentytwentyone.df-product-page:not( .df-label-stacked ) table.variations td.value .df-product-container {
    display: inline-flex;
}

.theme-twentytwentyone.df-label-stacked table.variations th,
.theme-twentytwentyone.df-label-stacked table.variations td {
    display: flex;
}

.theme-twentytwentyone table.variations tr {
    margin-bottom: 0.5rem !important;
}

/* Twenty twenty theme compatibility css */
.theme-twentytwenty table.variations {
    overflow-y: auto;
}

.theme-twentytwenty.df-product-page:not( .df-label-stacked ) table.variations td.value .df-product-container {
    display: inline-flex;
}

.df-label-stacked table.variations th,
.df-label-stacked table.variations td {
    display: flex;
}

.df-swatches-option.swatch-circle {
    min-width: 30px;
    min-height: 30px;
    border-radius: 100%;
}

.single-product-page .df-swatches-option.swatch-circle {
    min-width: 40px;
    min-height: 40px;
    border-radius: 100%;
}

.df-swatches-option.swatch-square {
    min-width: 24px;
    min-height: 24px;
    border-radius: 0px;
}

.df-swatches-option.swatch-rounded {
    min-width: 24px;
    min-height: 24px;
    border-radius: 3px;
}

@media (max-width: 768px) {
    .woocommerce-shop, .archive, .post-type-archive-product {
        /* Ensure product card is relative */
        .product, .product-grid-item, li.product {
            position: relative !important;
        }

        /* Constrain the form wrapper entirely inside the card width */
        .df_variations_form, .df-shop-variations {
            display: flex !important;
            align-items: center !important;
            flex-wrap: nowrap !important;
            gap: 6px !important;
            width: 100% !important;
            max-width: 100% !important;
            overflow: hidden !important; /* Clips anything trying to escape the card */
            box-sizing: border-box !important;
        }

        /* Collapsed state */
        .df-swatches-container:not(.df-swatches-expanded) {
            display: flex !important;
            flex-wrap: nowrap !important;
            overflow: hidden !important;
            gap: 4px !important;
        }

        .df-swatches-container:not(.df-swatches-expanded) .df-swatches-option {
            flex: 0 0 30px !important;
            width: 30px !important;
            height: 30px !important;
            min-width: 30px !important;
            min-height: 30px !important;
        }

        .df-swatches-container:not(.df-swatches-expanded) .df-swatches-option:nth-child(n+5) {
            display: none !important;
        }

        /* Expanded state: scrolling constrained strictly within the wrapper */
        .df-swatches-container.df-swatches-expanded {
            display: flex !important;
            flex-wrap: nowrap !important;
            overflow-x: auto !important;
            overflow-y: hidden !important;
            -webkit-overflow-scrolling: touch !important;
            min-width: 0 !important;
            flex: 1 1 auto !important;
            max-width: calc(100% - 40px) !important;
            gap: 6px !important;
            padding-bottom: 4px !important;
        }

        .df-swatches-container.df-swatches-expanded .df-swatches-option {
            flex: 0 0 30px !important;
            width: 30px !important;
            height: 30px !important;
            min-width: 30px !important;
            min-height: 30px !important;
        }

        /* "+ X" button */
        .df-swatches-more-btn {
            flex: 0 0 auto !important;
            display: inline-flex !important;
            align-items: center !important;
            justify-content: center !important;
            font-size: 16px !important;
            font-weight: 600 !important;
            color: #333 !important;
            background: #fff !important;
            padding: 0 4px !important;
            border-radius: 0px !important;
            cursor: pointer !important;
            border: none !important;
            white-space: nowrap !important;
            height: 30px !important;
            min-height: 30px;
        }
    }
}

.wd-product-img-link.df-image-loading img{
    opacity: 0.45;
}

.df-image-loading {
    position: relative;
}

.df-image-loading img {
    opacity: 0.45;
    transition: opacity 0.2s ease;
}

.df-image-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 26px;
    height: 26px;
    margin: -13px 0 0 -13px;
    border: 2px solid rgba(0, 0, 0, 0.15);
    border-top-color: #333;
    border-radius: 50%;
    animation: df-spin 0.6s linear infinite;
    z-index: 10;
    pointer-events: none;
}

@keyframes df-spin {
    to {
        transform: rotate(360deg);
    }
}
