/*!
 * Copyright 2023 Progress Software Corporation and/or one of its subsidiaries or affiliates. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
.k-badge {
    padding: 0;
    border-width: @kendo-badge-border-width;
    border-style: solid;
    border-color: transparent;
    box-sizing: border-box;
    color: inherit;
    background-color: transparent;
    font: inherit;
    text-align: center;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
}
.k-badge > * {
    color: inherit;
}

// Links
a.k-badge,
.k-badge > a {
    text-decoration: none;
}
a.k-badge:hover,
.k-badge > a:hover {
    text-decoration: underline;
}


// Icon
.k-badge-icon {
    max-width: 1em;
    max-height: 1em;
    font-size: inherit;
}
.k-badge-icon.k-svg-icon svg {
    fill: currentColor;
}


// Badge sizes
.k-badge-sm {
    padding: @kendo-badge-padding-y-sm @kendo-badge-padding-x-sm;
    font-size: @kendo-badge-font-size-sm;
    line-height: @kendo-badge-line-height-sm;
    min-width: @kendo-badge-min-width-sm;

    &:empty {
        padding: @kendo-badge-padding-y-sm;
        min-width: auto;
    }
}
.k-badge-md {
    padding: @kendo-badge-padding-y-md @kendo-badge-padding-x-md;
    font-size: @kendo-badge-font-size-md;
    line-height: @kendo-badge-line-height-md;
    min-width: @kendo-badge-min-width-md;

    &:empty {
        padding: @kendo-badge-padding-y-md;
        min-width: auto;
    }
}
.k-badge-lg {
    padding: @kendo-badge-padding-y-lg @kendo-badge-padding-x-lg;
    font-size: @kendo-badge-font-size-lg;
    line-height: @kendo-badge-line-height-lg;
    min-width: @kendo-badge-min-width-lg;

    &:empty {
        padding: @kendo-badge-padding-y-lg;
        min-width: auto;
    }
}


// Badge position
.k-badge-container {
    position: relative;
    overflow: visible;
}

@badge-positions: {
    inside: null;
    edge: 50;
    outside: 100;
}
each( @badge-positions, {
    @placement: @key;
    @translate: @value;

    .k-badge-@{placement} {
        position: absolute;
        z-index: 9999;

        &.k-top-start {
            & when not (@translate = null) {
                transform: translate( (-1% * @translate), (-1% * @translate) );
            }
        }
        &.k-top-end {
            & when not (@translate = null) {
                transform: translate( (1% * @translate), (-1% * @translate) );
            }
        }
        &.k-bottom-start {
            & when not (@translate = null) {
                transform: translate( (-1% * @translate), (1% * @translate) );
            }
        }
        &.k-bottom-end {
            & when not (@translate = null) {
                transform: translate( (1% * @translate), (1% * @translate) );
            }
        }
    }

    .k-rtl .k-badge-@{placement},
    [dir="rtl"].k-badge-@{placement},
    [dir="rtl"] .k-badge-@{placement} {
        &.k-top-start {
            & when not (@translate = null) {
                transform: translate( (1% * @translate), (-1% * @translate) );
            }
        }
        &.k-top-end {
            & when not (@translate = null) {
                transform: translate( (-1% * @translate), (-1% * @translate) );
            }
        }
        &.k-bottom-start {
            & when not (@translate = null) {
                transform: translate( (1% * @translate), (1% * @translate) );
            }
        }
        &.k-bottom-end {
            & when not (@translate = null) {
                transform: translate( (-1% * @translate), (1% * @translate) );
            }
        }
    }
});
