@import "components/variables";
@import "components/bs-buttons";

form .form-row div.frontend-button-group.frontend-button-group-block {
    display: flex;
    flex-wrap: wrap;

    label {
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        flex-basis: calc(25% - 6px);
        @media (min-width: 820px) {
            flex-basis: calc(20% - 6px);
        }
    }
}

form .form-row div.frontend-button-group {
    label.btn-grp {
        margin: 3px;

        &:not(.btn) {
            padding: 4px 7px;
        }

        text-transform: none;
        text-align: center !important;
        outline: 2px solid transparent;
        outline-offset: 2px;
        width: auto !important;
        font-weight: normal !important;
        display: inline-block;
    }

    input[property="color"] + label.btn-grp[style="--fe-value: ;"] {
        color: $body-fg !important;
    }

    input[property="color"][value="transparent"] + label.btn-grp {
        color: $body-fg !important;
    }

    input[property="text"] + label.btn-grp {
        color: $body-fg !important;
    }

    input[type="radio"]:checked + label.btn-grp,
    input[type="checkbox"]:checked + label.btn-grp {
        outline-color: $color-primary;
        border-radius: 0;
        border: none;
    }

    input[property="icon"] + label.btn-grp {
        margin-left: 0.5rem;
        margin-right: 0.5rem;
    }

    input[property="text"]:checked + label.btn-grp,
    input[property="icon"]:checked + label.btn-grp {
        background: $color-secondary;
    }

    input[property="opacity"] + label.btn-grp {
        width: 3.5em !important;
        padding-inline-start: 0 !important;
        padding-inline-end: 0 !important;
        color: $body-fg !important;
        overflow: hidden;
        white-space: nowrap;
        background: rgba(var(--bs-secondary-rgb), calc(var(--fe-value) / 100));
    }

    input[property="link-size"][value="btn-lg"] + label.btn-grp {
        padding: 0.5rem 1rem !important;
        font-size: 1.25rem;
        border-radius: 0.3rem;
    }

    input[property="link-size"][value="btn-sm"] + label.btn-grp {
        padding: 0.25rem 0.5rem !important;
        font-size: 0.875rem;
        border-radius: 0.2rem;
    }

    input[property="list_state"] + label.btn-grp[style="--fe-value: ;"] {
        color: $body-fg !important;
    }

    input[property="list_state"][value="active"] + label.btn-grp {
        background: var(--bs-primary);
        color: white;
    }

    input[property="list_state"][value="disabled"] + label.btn-grp {
        color: var(--bs-gray-600) !important;
        background: white;
    }

    input[property="shadow"] + label.btn-grp {
        margin-inline-end: 1em;
        width: 3.5em !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        background: var(--bs-secondary);
        color: white !important;
        text-align: center !important;
        border: var(--bs-secondary) 1px solid !important;
        overflow: hidden;
        white-space: nowrap;
    }

    input[property="shadow"][value="lg"] + label.btn-grp {
        box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175) !important;
    }

    input[property="shadow"][value="reg"] + label.btn-grp {
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
    }

    input[property="shadow"][value="sm"] + label.btn-grp {
        box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
    }

    input[property="nav-design"][value="light"] + label.btn-grp {
        background: var(--bs-light);
        color: var(--bs-gray-900) !important;
    }

    input[property="nav-design"][value="dark"] + label.btn-grp {
        background: var(--bs-dark);
        color: var(--bs-white) !important;
    }

    .btn-white {
        background: white;
        color: $body-fg !important;
    }

    .btn-light {
        color: black !important;
    }

    .btn-dark {
        color: white !important;
    }

    .btn-transparent {
        color: var(--dca-black, var(--body-fg, #000));
    }
}

body:not(.djangocms-admin-style) .frontend-button-group .optgroup {
    clear: both;  // Bug in django 3.2?
}
