@import "/_assets/styles/app.less";
@import "/_components/secondary-button/secondary-button.less";
@import "/_components/chat-component/chat-component.less";

html {
    overflow: hidden;
}

.gate {
    height: 100vh;
    .d-flex;
    .flex-align-center;
    .flex-justify-center;
    background: linear-gradient(135deg, @indigo, @primary);

    &__card {
        width: 380px;
        max-width: calc(100% - 32px);
        padding: 40px 32px;
        text-align: center;
    }

    &__logo {
        display: block;
        width: 220px;
        max-width: 100%;
        height: auto;
        margin: 0 auto 24px auto;
    }

    &__title {
        font-family: @fontFamily-heading;
        font-size: @fontSize-extra-large;
        font-weight: @fontWeights-extra-bold;
        color: @sky;
        margin-bottom: 8px;
    }

    &__text {
        color: fade(@white, 85%);
        margin-bottom: 24px;
    }

    &__error {
        .flex-justify-center;
        margin-bottom: 16px;
        padding: 8px 12px;
        border-radius: 4px;
        background-color: @white;
    }

    &__button {
        width: 100%;
        height: 44px;
        border-radius: 4px;
        background-color: @secondary;
        color: @white;
        font-weight: @fontWeights-bold;
        transition: all 0.3s ease;

        &:hover {
            opacity: 0.85;
        }
    }
}

.app {
    .d-flex;
    height: 100vh;
    background-color: @white;
}

.sidebar {
    width: 320px;
    flex-shrink: 0;
    height: 100%;
    .d-flex;
    .flex-column;
    padding: 20px;
    background-color: @navy;

    &__header {
        margin-bottom: 20px;
    }

    &__title {
        font-family: @fontFamily-heading;
        font-size: @fontSize-large;
        font-weight: @fontWeights-extra-bold;
        color: @white;
        margin-bottom: 16px;
    }

    .secondary-button__button {
        color: @white;
        border-color: @white;
    }

    &__empty {
        color: fade(@white, 70%);
        padding: 8px 4px;
    }

    &__list {
        flex: 1;
        overflow: auto;

        &::-webkit-scrollbar-track {
            background: fade(@white, 10%);
        }

        &::-webkit-scrollbar-thumb,
        &::-webkit-scrollbar-thumb:hover {
            background: @sky;
            border-color: @navy;
        }
    }

    &__footer {
        .d-flex;
        .flex-align-center;
        .flex-justify-between;
        padding-top: 16px;
        border-top: 1px solid fade(@white, 15%);
    }

    &__user {
        color: @white;
        font-weight: @fontWeights-medium;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        margin-right: 12px;
    }

    &__logout {
        .d-flex;
        .flex-align-center;
        color: fade(@white, 80%);
        flex-shrink: 0;

        .svg-icon__wrapper svg {
            width: 18px;
            margin-right: 6px;
        }

        &:hover {
            color: @error;
        }
    }

    &__credit {
        .d-flex;
        .flex-align-center;
        margin-top: 16px;

        &-label {
            font-size: @fontSize-small;
            color: fade(@white, 60%);
            margin-right: 8px;
        }

        &-logo {
            height: 22px;
            width: auto;
        }
    }
}

.thread {
    padding: 12px 16px;
    border-radius: 4px;
    cursor: pointer;
    border-left: 7px solid transparent;
    transition: all .3s ease;

    &:hover {
        background-color: fade(@white, 8%);
    }

    &--active {
        background-color: fade(@white, 8%);
        border-left-color: @sky;

        .thread__name {
            color: @sky;
        }
    }

    &__name {
        font-weight: @fontWeights-semi-bold;
        color: @white;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    &__meta {
        .d-flex;
        .flex-align-center;
        margin-top: 2px;
    }

    &__time {
        font-size: @fontSize-small;
        color: fade(@white, 55%);
    }

    &__live {
        .d-flex;
        .flex-align-center;
        margin-left: 8px;
        font-size: @fontSize-small;
        color: fade(@white, 75%);
        white-space: nowrap;
    }

    &__live-dot {
        width: 6px;
        height: 6px;
        margin-right: 6px;
        border-radius: 50%;
        background-color: @sky;
        animation: thread-live-pulse 1.2s ease-in-out infinite;
    }
}

@keyframes thread-live-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

@media (prefers-reduced-motion: reduce) {
    .thread__live-dot {
        animation: none;
    }
}

.conversation__brand {
    .d-flex;
    .flex-align-center;
    min-width: 0;
}

.conversation__logo {
    height: 36px;
    width: auto;
    flex-shrink: 0;
    margin-right: 12px;
}

.conversation__header-item .conversation__assistant {
    width: auto;
    min-width: 0;
    padding-left: 12px;
    border-left: 1px solid @medium-grey;
    font-family: @fontFamily;
    font-size: @fontSize-small;
    font-weight: @fontWeights-semi-bold;
    color: @text-muted;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation .message__item-text {
    color: @text;
}

.conversation .my_message .message__item-balloon {
    background-color: @primaryOpacity;
}

.chat__empty-title {
    font-family: @fontFamily-heading;
    font-weight: @fontWeights-extra-bold;
    color: @primary;
}

.chat__empty-text {
    color: @text-muted;
}

.main {
    flex: 1;
    min-width: 0;
    height: 100%;

    &__menu {
        display: none;
        margin-right: 12px;

        .svg-icon__wrapper svg {
            width: 24px;
        }
    }

    &__error {
        padding: 8px 40px;
        background-color: @white;
    }

    .conversations,
    .conversation {
        width: 100%;
    }
}

@media (max-width: 650px) {
    .sidebar {
        position: fixed;
        z-index: 10;
        top: 0;
        left: 0;
        width: 85%;
        max-width: 320px;
        transform: translateX(-100%);
        transition: transform .3s ease;
        box-shadow: 0px 4px 12px 0px #0000004d;

        &--open {
            transform: translateX(0);
        }
    }

    .main__menu {
        display: block;
    }

    .conversation__header {
        padding-left: 16px;
    }
}
