@import '../abstracts/variables';

.avatar {
    display: flex;
    overflow: hidden;
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    line-height: 1;
    user-select: none;
    border-radius: 50%;
    justify-content: center;
    color: var(--palette-white);
    background-color: var(--palette-grey-light);

    &.avatar-small {
        width: 24px;
        height: 24px;
        font-size: .875rem;
    }

    &.avatar-medium {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    &.avatar-large {
        width: 56px;
        height: 56px;
        font-size: 1.75rem;
    }
}


.avatar-rounded {
    border-radius: var(--default-borderradius);
}

.avatar-square {
    border-radius: 0;
}

.avatar-img {
    color: transparent;
    width: 100%;
    height: 100%;
    object-fit: cover;
    text-align: center;
    text-indent: 10000px;
}

.avatar-fallback {
    width: 75%;
    height: 75%;
}

.avatar-outlined {
    color: var(--palette-text-primary);
    background-color: unset;
    border: 1px solid var(--palette-text-primary);

    @each $color in $palette-colors {
        &.avatar-outlined-#{$color} {
            color: var(--palette-#{$color});
            border: 1px solid var(--palette-#{$color});
        }
    }
}

.avatar-filled {
    color: var(--palette-white);
    background-color: var(--palette-grey-light);

    @each $color in $palette-colors {
        &.avatar-filled-#{$color} {
            background-color: var(--palette-#{$color});
        }
    }
}


.avatar-group {
    display: flex;

    .avatar:first-child {
        margin-inline-start: 0px !important;
    }

    &.avatar-group-outlined {
        &.avatar-group-outlined-transparent {
            .avatar:not(.avatar-outlined) {
                border-color: transparent;
            }
        }

        &.avatar-group-outlined-surface {
            .avatar:not(.avatar-outlined) {
                border-color: var(--palette-surface);
            }
        }

        @each $color in $palette-colors {
            &.avatar-group-outlined-#{$color} {
                .avatar:not(.avatar-outlined) {
                    border-color: var(--palette-#{$color});
                }
            }
        }

        .avatar {
            border: 2px solid;

            &.avatar-small {
                width: 28px;
                height: 28px;
            }

            &.avatar-medium {
                width: 44px;
                height: 44px;
            }

            &.avatar-large {
                width: 60px;
                height: 60px;
            }
        }
    }
}