/**
 * Tri-state boolean control: TRUE | FALSE | not set.
 * Four display states: set true (green check), set false (red cross),
 * not set default true (gray check), not set default false (gray cross).
 */


.advset-tristate-container {
    display: grid;
    grid-template-columns: max-content max-content max-content;
    gap: 0.375rem;
    align-items: center;
    justify-content: start;
}

.advset-tristate-fieldset {
    display: contents;
    position: relative;
}

.advset-tristate-legend {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
    padding: 0;
    font: inherit;
}

.advset-tristate-about-link {
    grid-column: 3;
    grid-row: 1;
    margin: 0;
    padding: 0;
    font: inherit;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23999"><title>help-circle-outline</title><path d="M11,18H13V16H11V18M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,6A4,4 0 0,0 8,10H10A2,2 0 0,1 12,8A2,2 0 0,1 14,10C14,12 11,11.75 11,15H13C13,12.75 16,12.5 16,10A4,4 0 0,0 12,6Z" /></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    width: 1rem;
    height: 1rem;
    cursor: pointer;
    user-select: none;
    position: relative;
    margin: 0 !important;
    font: inherit;
    overflow: hidden;
    text-indent: -500vw;
}

.advset-tristate-about-link:hover {
    text-decoration: underline;
}

.advset-tristate-about-link:visited {
    color: inherit;
}

.advset-tristate-input {
    position: absolute;
    opacity: 0;
    z-index: -1;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: visible;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    pointer-events: none;
}

td fieldset.advset-tristate-fieldset label {
    grid-column: 1 / 3;
    grid-row: 1;
    cursor: pointer;
    user-select: none;
    position: relative;
    margin: 0 !important;
    font: inherit;
}

.advset-tristate-label {
    opacity: 0;
}

.advset-tristate-input:checked + .advset-tristate-label + .advset-tristate-input + .advset-tristate-label,
.advset-tristate-label:first-of-type:has(~ .advset-tristate-input:last-of-type:checked) {
    z-index: 1;
}

.advset-tristate-icon {
    grid-column: 1;
    grid-row: 1;
}



.advset-tristate-icon {
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    width: 1.5rem;
    height: 1.5rem;
}

.advset-tristate-fieldset[data-advset-default="true"] .advset-tristate-input[value="null"]:checked ~ .advset-tristate-icon {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23999"><title>checkbox-outline</title><path d="M19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5A2,2 0 0,0 19,3M19,5V19H5V5H19M10,17L6,13L7.41,11.58L10,14.17L16.59,7.58L18,9" /></svg>');
}

.advset-tristate-fieldset[data-advset-default="false"] .advset-tristate-input[value="null"]:checked ~ .advset-tristate-icon {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23999"><title>close-box-outline</title><path d="M19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5A2,2 0 0,0 19,3M19,19H5V5H19V19M17,8.4L13.4,12L17,15.6L15.6,17L12,13.4L8.4,17L7,15.6L10.6,12L7,8.4L8.4,7L12,10.6L15.6,7L17,8.4Z" /></svg>');
}

.advset-tristate-input[value="true"]:checked ~ .advset-tristate-icon {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%2300a32a"><title>checkbox-marked</title><path d="M10,17L5,12L6.41,10.58L10,14.17L17.59,6.58L19,8M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z" /></svg>');
}

.advset-tristate-input[value="false"]:checked ~ .advset-tristate-icon {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23d63638"><title>close-box</title><path d="M19,3H16.3H7.7H5A2,2 0 0,0 3,5V7.7V16.4V19A2,2 0 0,0 5,21H7.7H16.4H19A2,2 0 0,0 21,19V16.3V7.7V5A2,2 0 0,0 19,3M15.6,17L12,13.4L8.4,17L7,15.6L10.6,12L7,8.4L8.4,7L12,10.6L15.6,7L17,8.4L13.4,12L17,15.6L15.6,17Z" /></svg>');
}
