/*
 * Swatch style (spec 5.1, 7.4). Every value is a custom property the
 * settings print on .swatch-control; the fallbacks are 3.1.19's look, which
 * the attribute term list in the admin also uses. The layout is in
 * swatches-structure.css.
 *
 * The border, padding and background keep a swatch the same outer size in
 * every state: padding is 2px plus the default border width, less the
 * state's border width. These rules declare what 3.1.19's declared, so
 * merchant CSS keeps working on an upgraded store. Hover widths, hover and
 * selected backgrounds and text colours are rules WC_Swatches_Style::css()
 * prints when they are set.
 */
/* Shapes. Square sets no radius, so the theme's own stays. */
.swatch-control.swatch-shape-rounded {
    --wcsw-radius: 6px;
}

.swatch-control.swatch-shape-round {
    --wcsw-radius: 999px;
}

.swatch-shape-rounded .swatch-wrapper,
.swatch-shape-round .swatch-wrapper {
    border-radius:var(--wcsw-radius);
}

.swatch-shape-rounded .swatch-wrapper .swatch-anchor,
.swatch-shape-rounded .swatch-wrapper .swatch-anchor img,
.swatch-shape-round .swatch-wrapper .swatch-anchor,
.swatch-shape-round .swatch-wrapper .swatch-anchor img {
    border-radius:max(0px, calc(var(--wcsw-radius) - 3px));
}

.swatch-wrapper {
    padding:2px;
    background:var(--wcsw-background, #fff);
    border:var(--wcsw-border-width, 1px) solid var(--wcsw-border-color, #ccc);
}

.swatch-wrapper:hover {
    border-color:var(--wcsw-hover-border-color, #000);
}

/* An unavailable swatch shows no hover. */
.swatch-wrapper.disabled:hover {
    border-color:var(--wcsw-border-color, #ccc);
}

/* Button swatches: the term name, at least as wide as a swatch. */
.swatch-wrapper.swatch-type-button .swatch-anchor {
    box-sizing: border-box;
    padding: 0 6px;
    text-align: center;
    white-space: nowrap;
    text-decoration: none;
    color: inherit;
    font-size: var(--wcsw-font-size, inherit);
}

.swatch-control.swatch-highlighted .swatch-wrapper.swatch-type-button .swatch-anchor {
    font-size: var(--wcsw-highlight-font-size, var(--wcsw-font-size, inherit));
}

div.swatch-wrapper.selected  {
    border:var(--wcsw-selected-border-width, 2px) solid var(--wcsw-selected-border-color, green);
    padding:max(0px, calc(var(--wcsw-border-width, 1px) + 2px - var(--wcsw-selected-border-width, 2px)));
}

/* The tick on a selected colour or image swatch, when a tick colour is set. */
.swatch-has-tick .swatch-wrapper .swatch-anchor {
    position: relative;
}

.swatch-has-tick div.swatch-wrapper.selected:not(.swatch-type-button) .swatch-anchor::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--wcsw-tick) center / 70% no-repeat;
    pointer-events: none;
}


div.swatch-wrapper.disabled, div.swatch-wrapper.disabled a, .radio-select .disabled {

    cursor: not-allowed;

    /* Required for IE 5, 6, 7 */
    zoom:1;
    /* Theoretically for IE 8 & 9 (more valid) */
    -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
    /* This works in IE 8 & 9 too */
    /* ... but also 5, 6, 7 */
    filter: alpha(opacity=50);
    /* Older than Firefox 0.9 */
    -moz-opacity:0.5;
    /* Safari 1.x (pre WebKit!) */
    -khtml-opacity: 0.5;
    /* Modern!
    /* Firefox 0.9+, Safari 2?, Chrome any?
    /* Opera 9+, IE 9+ */
    opacity: 0.5;
}

.radio-select .disabled input, .radio-select .disabled label {
	cursor: not-allowed;
}

/*
 * Unavailable options (spec 8.2). Grey out is 3.1.19's look above. Blur and
 * blur with cross follow the picker's data-unavailable; Hide is in
 * swatches-structure.css.
 */
.swatch-control[data-unavailable^="blur"] div.swatch-wrapper.disabled {
    opacity: 1;
    position: relative;
    overflow: hidden;
}

.swatch-control[data-unavailable^="blur"] div.swatch-wrapper.disabled a {
    opacity: 0.6;
    filter: blur(2px);
}

.swatch-control[data-unavailable="blur_cross"] div.swatch-wrapper.disabled::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--wcsw-cross) center / 100% no-repeat;
    pointer-events: none;
}

.swatch-control.radio-select[data-unavailable^="blur"] li.disabled label {
    filter: blur(1px);
}

.swatch-control.radio-select[data-unavailable="blur_cross"] li.disabled label {
    text-decoration: line-through;
}

/* Remaining stock (spec 8.3). */
.swatch-wrapper .swatch-stock-left {
    padding: 1px 4px;
    border-radius: 2px;
    background: #b32d2e;
    color: #fff;
    font-size: 10px;
    line-height: 12px;
}

.radio-select .swatch-stock-left {
    color: #b32d2e;
    font-size: 0.875em;
}

/* An option that stays clickable keeps the pointer. */
div.swatch-wrapper.disabled.swatch-clickable,
div.swatch-wrapper.disabled.swatch-clickable a,
.radio-select li.disabled.out-of-stock,
.radio-select li.disabled.out-of-stock input,
.radio-select li.disabled.out-of-stock label {
    cursor: pointer;
}

/*---------------------------------------------------------------------------------------------
        Admin Table
---------------------------------------------------------------------------------------------*/
table.wcsap_input {
    border: 0 none;
}

table.wcsap_input tbody tr td {
    padding: 10px;
}

table.wcsap_input tr.field_save {

}

table.wcsap_input tbody tr:last-child td {
    border-bottom: 0 none;
}

table.wcsap_input tbody tr td.label {
    width: 24%;
    vertical-align: top;
    border-right: #ebebeb solid 1px;
}

table.wcsap_input td.label ul.hl {
    margin: 20px 0 0;
}
table.wcsap_input td.label ul.hl li {
    margin: 0 3px 0 0;

}

table.wcsap_input td.label ul.hl li a.wcsap-button {
    font-size: 12px;
    padding: 6px 10px;
    font-weight: normal;
}

table.wcsap_input tbody tr td.label label{
    display: block;
    font-size: 12px;
    font-weight: bold;
    padding: 0;
    margin: 0;
    color: #333;

}

table.wcsap_input tbody tr td.label label span.required {
    color: #f00;
    display: inline;
    margin-right: 5px;
}


table.wcsap_input tbody tr td.label p{
    display: block;
    font-size: 12px;
    padding: 6px 0 !important;
    margin: 0 !important;
    font-style: normal;
    line-height: 16px;
    color: #666;
}

table.wcsap_input input[type=text],
table.wcsap_input textarea,
table.wcsap_input select{
    width: 99.95%;
    padding: 5px;
    outline: none;
}

table.wcsap_input select {
    padding: 5px 8px
}

table.wcsap_input input[type=text]:focus,
table.wcsap_input textarea:focus,
table.wcsap_input select:focus {
    border-color:#98B6CB;
}

/*---------------------------------------------------------------------------------------------
        Table
---------------------------------------------------------------------------------------------*/
table.widefat.wcsap {
    border: 0 none;
    background: transparent none;
}

table.widefat.wcsap td {
    border: 0 none;
}

.wcsap,
.wcsap tr,
.wcsap tr td {
    vertical-align: top;
}

.wcsap tr th span {
    color: #666;
    font-size: 10px;
    line-height: 1.2;
    font-weight: normal;
    text-shadow: 0 1px 0 #FFFFFF;
}

.wcsap tr td.field_preview,
.wcsap tr th.field_preview  {
    text-indent: 32px;
    width:25%;
}

.wcsap tr td.field_label,
.wcsap tr th.field_label  {
    width: 25%;
}

.wcsap tr td.field_name,
.wcsap tr th.field_name  {
    width: 25%;
}

.wcsap tr td.field_type,
.wcsap tr th.field_type  {
    width: 25%;
}

.wcsap tr td {
    background: transparent;
    padding: 8px 8px 8px 10px;
    position: relative;
    font-size: 12px;
}



.wcsap tr td.attribute_swatch_label,
.wcsap tr th.attribute_swatch_label  {
    width: 50%;
}

.wcsap tr td.attribute_swatch_type,
.wcsap tr th.attribute_swatch_type  {
    width: 50%;
    text-align: right;
}


/*---------------------------------------------------------------------------------------------
        Fields Header
---------------------------------------------------------------------------------------------*/
.fields_header {
    -moz-border-radius: 3px 3px 0 0;
    -webkit-border-radius: 3px 3px 0 0;
    -khtml-border-radius: 3px 3px 0 0;
    border-radius: 3px 3px 0 0;
    border: #DFDFDF solid 1px;
    border-bottom: 0 none;
}


/*---------------------------------------------------------------------------------------------
        Field Meta
---------------------------------------------------------------------------------------------*/

#swatches .wcsap_field_meta {
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

#swatches .field .wcsap_field_meta {
    border: #DFDFDF solid 1px;
    border-top: 0 none;
}

#swatches .field .wcsap_field_meta strong {
    display: block;
    padding-bottom: 6px;
    font-size: 1rem;
}

#swatches .field .wcsap_field_meta .row_options {
    font-size: 12px;
    line-height: 12px;
    visibility: hidden;
}

#swatches .field .wcsap_field_meta:hover .row_options {
    visibility: visible;
}

#swatches .field.form_open > .wcsap_field_meta {
    background-color: #f6f7f7;
    border: #dcdcde solid 1px;
    border-top: 0 none;
}

#swatches .fields .field .wcsap_field_meta .circle {
    width: 20px;
    height: 20px;
    text-align: center;
    font-size: 11px;
    line-height: 20px;
    display: block;
    float: left;
    margin: 7px 0 0 7px;
    text-indent: 0;
    background: url(../images/sprite.png) 0 -350px no-repeat;
}

#swatches .fields .field:nth-child(2n) .wcsap_field_meta .circle {
    background-position: 0 -400px;

}

#swatches .field.form_open > .wcsap_field_meta .circle {
    background-position: 0 -300px !important;
}


.fields {
    position: relative;
    background: #FCFCFC;
    box-shadow: inset 0 0 0 1px #DFDFDF;
}

.fields .field {
    position: relative;
    overflow: hidden;
    background: #F9F9F9;
}


/*---------------------------------------------------------------------------------------------
        Field Options
---------------------------------------------------------------------------------------------*/
.field_options {
    background: #DFDFDF;
    position: relative;
    overflow: hidden;
}

.field_options .field_option {
    display: none;
    position: relative;
    overflow: hidden;
    padding: 6px;
}

.field_options .field_option.open {
    display: block;
}

.field_options .field_option table {
    border: #CCCCCC solid 1px;
    border-radius: 5px;
}


.field_save td {
    line-height: 25px;
}




/*---------------------------------------------------------------------------------------------
        Field Form
---------------------------------------------------------------------------------------------*/
.field_form {
    border: #dcdcde solid 1px;
    border-top: 0 none;
    background: #fff;
    padding: 10px;
    clear: both;
    vertical-align: top;
}

.field_form table.wcsap_input {
    border: #dcdcde solid 1px;
    position: relative;
    overflow: hidden;
}

.field_form table.wcsap_input tr.field_label td {
    border-top: 0 none;
}

.field_form table.wcsap_input td {
    background: transparent;
    border-bottom-color: #DFDFDF;
    border-top-color: #FFFFFF;
}

.field_form_mask {
    display: none;
    width: 100%;
    position: relative;
    overflow: hidden;
    clear: both;
}


table.wcsap_input .field_option_color input.woo-color {
    width: 92.95%;
    padding: 5px;
    outline: none;
    margin-left: 5px;
}

/* Display limit "+N" button (spec 9). */
.swatch-more {
    display: inline-block;
    margin: 0 0 5px;
    padding: 0 6px;
    border: 1px solid currentColor;
    background: none;
    color: inherit;
    font-size: 0.875em;
    line-height: 1.75;
    cursor: pointer;
}

/* Selected value after the attribute name (spec 9). */
.swatch-selected-value {
    display: inline-grid;
    font-weight: normal;
}

/* One grid cell for the value and every option's text, so the label is as wide as the longest (#144). */
.swatch-selected-value > span {
    grid-area: 1 / 1;
}

.swatch-selected-value-size {
    visibility: hidden;
}

/* Loading indicator (spec 9). */
.swatches-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: wcsw-spin 0.8s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
    .swatches-spinner {
        animation: none;
    }
}
