@use '../../styles/variables';
@use 'mixin';

.thy-message-container {
    position: fixed;
    z-index: variables.$message-z-index;
    top: variables.$message-spacing;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;

    .thy-message {
        width: fit-content;
        padding: 12px 16px;
        margin-bottom: variables.$message-margin-bottom;
        position: relative;
        display: flex;
        align-items: center;
        border: variables.$message-border;
        border-radius: variables.$message-border-radius-width;
        background: variables.$bg-panel;
        box-shadow: variables.$message-box-shadow;

        &-icon {
            font-size: variables.$message-icon-font-size;
        }

        .loading-icon,
        .loading-icon:after {
            width: variables.$message-icon-font-size;
            height: variables.$message-icon-font-size;
            border-radius: 50%;
        }
        .loading-icon {
            font-size: 10px;
            position: relative;
            text-indent: -9999em;
            border-top: 2px solid variables.$primary;
            border-right: 2px solid variables.$primary;
            border-bottom: 2px solid #eaf3fc;
            border-left: 2px solid #eaf3fc;
            transform: translateZ(0);
            animation: rotating 1.1s infinite linear;
        }

        &-close {
            cursor: variables.$hand-cursor;
            font-size: variables.$font-size-sm;
            color: variables.$message-close-color;
            margin-left: 16px;
            transition: color variables.$transition-duration-normal;
            &:hover {
                color: variables.$gray-600;
            }
        }

        &-main {
            flex: 1;
            font-size: variables.$font-size-base;
            color: variables.$gray-800;
            word-break: break-all;
            margin-left: variables.$message-icon-margin;
        }
    }

    @each $state, $color in variables.$message-states {
        @include mixin.thy-message-state($state, $color);
    }

    @keyframes rotating {
        0% {
            transform: rotate(0deg);
        }
        100% {
            transform: rotate(360deg);
        }
    }
}
