/**
 * Units Selector Styles
 */

.digiblocks-units-wrapper {
    position: relative;
    display: inline-block;
}

.digiblocks-units-switcher {
    display: flex;
    align-items: center;
    gap: 2px;
    min-width: 33px;
    height: 20px;
    padding: 0 2px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 2px;
    cursor: pointer;
    font-size: 10px;
    color: #2c3338;
    text-transform: uppercase;
    transition: all 0.15s ease-in-out;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;

    &:hover {
        border-color: #949494;
    }

    &:focus,
    &.is-open {
        border-color: var(--wp-admin-theme-color, #3858e9);
        outline: none;
    }
}

.digiblocks-units-switcher__label {
    line-height: 1;
}

.digiblocks-units-switcher__icon {
    width: 11px;
    height: 11px;
    font-size: 11px;
    line-height: 1;
    transition: transform 0.2s ease;

    .is-open & {
        transform: rotate(180deg);
    }
}

.digiblocks-units-choices {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    min-width: 32px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 2px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.digiblocks-units-choice {
    position: relative;

    input[type="radio"] {
        position: absolute;
        opacity: 0;
        width: 0;
        height: 0;
        margin: 0;
        padding: 0;

        &:checked + .digiblocks-units-choices-label {
            background: var(--wp-admin-theme-color, #3858e9);
            color: #fff;

            svg {
                fill: #fff;
            }
        }
    }
}

.digiblocks-units-choices-label {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 0 5px;
    font-size: 10px;
    text-transform: uppercase;
    color: #2c3338;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;

    &:hover {
        background: #f0f0f0;
    }

    span {
        line-height: 1;
    }
}
