@use "../globals/" as *;
@use "../util/" as *;

.badge-group {
    position: relative;
    //display: inline-block;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem ;
    margin-top:.25rem;

    .badge-content {
        top: 0;
        left: 0;
        flex: 0 1;
        width: 100%;
        height: 100%;
        display: flex;
        pointer-events: none; 
        position: absolute;
        opacity: 1; 
        transition: $transition;

        &.badge {

            &-top {
                align-items: flex-start;

                &.left {
                    justify-content: flex-start;
                }

                &.center {
                    justify-content: center;
                }

                &.right {
                    justify-content: flex-end;
                }
            }

            &-center {
                align-items: center;

                &.left {
                    justify-content: flex-start;
                }

                &.center {
                    justify-content: center
                }

                &.right {
                    justify-content: flex-end;
                }
            } 

            &-bottom {
                align-items: flex-end;

                &.left {
                    justify-content: flex-start;
                }

                &.center {
                    justify-content: center;
                }

                &.right {
                    justify-content: flex-end;
                }
            }
        }
    }
}

.badge { 
    border-radius: 12px;
    font-size: $font-size-sm;
    height: 22px;
    letter-spacing: 0;
    min-width: 22px;
    padding: 4px 6px; 
    pointer-events: auto;
   
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
    text-indent: 0;
    top: auto;
    transition: .3s cubic-bezier(.25,.8,.5,1);
    white-space: nowrap;
  
    &.bg-core {
      color: var(--text-core);
      background-color: var(--bg-core-primary-lighten);
    }

    &.badge-outline {
        border-color: var(--bg-core-primary-light);
        border-style: solid;
        border-width: 2px;
        padding: 3px 4px;

        &.badge-icon {
            padding: 4px 6px;

            & .icon-badge {
                margin-left: -4px;
                margin-inline-start: -4px;
                margin-inline-end: unset;
                margin-top: -4px;
            }
        }
    }

    &.badge-icon {
        width: 20px;
        height: 20px;

        & .icon-badge {
            color: inherit;
            font-size: 12px;
            margin-left: -2px;
            margin-inline-start: -2px;
            margin-inline-end: unset;
        }
    }

    &.badge-dot {
        border-radius: 50%;
        height: 9px;
        min-width: 0;
        padding: 0;
        width: 9px;
    }

    &.badge {

        &-top {
            &.left {
                inset: auto calc(100% - 4px) calc(100% - 4px) auto;

                &.badge-overlap {
                    inset: auto calc(100% - 12px) calc(100% - 12px) auto;
                }
            }

            &.center {
                bottom: calc(100% - 4px);

                &.badge-overlap {
                    bottom: calc(100% - 12px);
                }
            }

            &.right {
                inset: auto auto calc(100% - 4px) calc(100% - 4px);

                &.badge-overlap {
                    inset: auto auto calc(100% - 12px) calc(100% - 12px);
                }
            }
        }

        &-center {
            &.left {
                right: calc(100% - 4px);

                &.badge-overlap {
                    right: calc(100% - 12px);
                }
            }

            &.center {
            }

            &.right {
                left: calc(100% - 4px);

                &.badge-overlap {
                    left: calc(100% - 12px);
                }
            }
        }

        &-bottom {
            &.left {
                inset: calc(100% - 4px) calc(100% - 4px) auto auto;

                &.badge-overlap {
                    inset: calc(100% - 12px) calc(100% - 12px) auto auto;
                }
            }

            &.center {
                top: calc(100% - 4px);

                &.badge-overlap {
                    top: calc(100% - 12px);
                }
            }

            &.right {
                inset: calc(100% - 4px) auto auto calc(100% - 4px);

                &.badge-overlap {
                    inset: calc(100% - 12px) auto auto calc(100% - 12px);
                }
            }
        }
    }
}

.badge-label {
    border-radius: $base-border-radius;
    font-size: $font-size-sm;
    //color: var(--text-core-hc);
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 20px;
    height: 20px;
    letter-spacing: 0;
    padding: 12px 10px;
    pointer-events: auto;
    text-indent: 0;
    white-space: nowrap;
    background-color:   transparent;
    transition: .3s cubic-bezier(.25,.8,.5,1);
    position: relative;
    isolation: isolate;
      
    &.bg-core {
        color: var(--text-core);
        background-color: var(--bg-core-primary-lighten);
      }
}