/*
 * Components shared by more than one frontend page (product page, add services view).
 */

/* Switch (on / off), markup: <label class="nwc-switch"><input type="checkbox"><span class="nwc-slider"></span></label> */

.nwc-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;

    input {
        opacity: 0;
        width: 0;
        height: 0;
    }
}

.nwc-slider {
    position: absolute;
    inset: 0;
    cursor: pointer;
    background-color: rgb(var(--neutral-l20));
    border-radius: 999px;
    transition: 0.3s;

    &::before {
        content: "";
        position: absolute;
        left: 3px;
        bottom: 3px;
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background-color: #fff;
        transition: 0.3s;
        display: flex;
        align-items: center;
        justify-content: center;
        background-repeat: no-repeat;
        background-position: center;
        background-size: 12px;
        background-image: url("data:image/svg+xml;utf8,\
        <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'>\
        <path d='M6 6L14 14M14 6L6 14' stroke='%23666' stroke-width='2' stroke-linecap='round'/>\
        </svg>");
    }
}

.nwc-switch input:checked + .nwc-slider {
    background-color: rgb(var(--primary-d20));
}

.nwc-switch input:checked + .nwc-slider::before {
    transform: translateX(22px);
    background-image: url("data:image/svg+xml;utf8,\
    <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'>\
    <path d='M5 10L8 13L15 6' stroke='%23025043' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/>\
    </svg>");
}
