/**
 *
 * @Copyright 2025 VOID SOFTWARE, S.A.
 *
 */

/* ==========================================================================
   Layout
   ========================================================================== */

.chat-screen {
    position: relative;
    width: 100%;
    height: calc(100vh - var(--topbar-height));
    padding: 2rem 0;
    max-width: 1920px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 640px) minmax(400px, 1fr);
}

.chat-screen__chat {
    width: 100%;
    height: 100%;
    max-height: calc(100vh - var(--topbar-height));
    background-color: #EFEDF2;
    border-radius: 1.5rem;
    padding: 0 2rem 2rem;
    display: grid;
    grid-template-rows: 1fr auto;
}

.chat-screen__chat__bottom {
    width: 100%;
    position: relative;
    gap: 0.8rem;
}

.chat-screen__chat__bottom__links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.8rem;
    color: #6A696D;
}

.chat-screen__chat__bottom__links a {
    color: #6A696D;
    font-size: 1.2rem;
    text-decoration: none;
    position: relative;
}

.chat-screen__chat__bottom__links a::after {
    content: '';
    position: absolute;
    bottom: -0.2rem;
    left: 0;
    width: 0;
    height: 0.1rem;
    background-color: #6A696D;
    transition: width 0.3s ease-in-out;
}

.chat-screen__chat__bottom__links a:hover::after {
    width: 100%;
}

.chat-screen__mobile-btns {
    width: 100%;
    display: flex;
    justify-content: center;
    position: absolute;
    top: -4rem;
}

.show-properties-btn,
.hide-properties-btn {
    display: none;
    opacity: 0;
    border-radius: 3rem;
    transition: all 0.3s ease-in-out;
    background-color: #110034;
}

.show-properties-btn:hover,
.hide-properties-btn:hover {
    background-color: #210068;
}

.show-properties-btn svg,
.hide-properties-btn svg {
    width: 2rem;
    height: 2rem;
}

.hide-properties-btn {
    position: fixed;
    bottom: 3rem;
}

/* ==========================================================================
   Properties
   ========================================================================== */
.chat-screen__properties {
    padding: 2rem;
    overflow: auto;

    scrollbar-gutter: stable;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.chat-screen__properties::-webkit-scrollbar {
    display: none;
}

.chat-screen__properties__section {
    padding-bottom: 2rem;
}

.chat-screen__properties__section.hidden {
    display: none;
}

.chat-screen__properties__section__header {
    width: 100%;
    display: inline-flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.chat-screen__properties__section__header__tags {
    display: flex;
    gap: 0.8rem;
}

.chat-screen__properties__section__header__tags .filter-tag {
    border: 1px solid #E4E4E7;
    border-radius: 4rem;
    padding: 0.4rem 0.8rem;
    font-size: 1.2rem;
    font-weight: 400;
    color: var(--color-neutral-950);
}

.chat-screen__properties__section__list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2.2rem;
}

.chat-screen__properties__section__list .property-card {    
    animation: fadeInFromBelow 1s ease-in forwards;
}

.chat-screen__properties__empty-state {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 2rem;
}

.chat-screen__properties__empty-state h1 {
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--color-neutral-950);
}

.chat-screen__properties__empty-state svg {
    width: 10rem;
    height: 10rem;
}

.chat-screen__properties__empty-state svg circle {
    animation: lookAroundChatEmptyState 3s linear infinite;
    transform-origin: center;
}

.chat-screen__properties__empty-state.hidden {
    display: none;
}

/* ==========================================================================
   Chat Components
   ========================================================================== */
.conversation {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    width: 100%;
    max-height: 100%;
    padding: 0 0 7rem 0;
    overflow: auto;
    position: relative;

    scrollbar-gutter: stable;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.conversation__messages {
    width: 100%;
    display: flex;
    flex-direction: column;
}

.btn-clean-chat {
    position: sticky;
    top: 1rem;
    left: 0.5rem;
    font-size: 1.4rem;
    width: fit-content;
    opacity: 1;
    pointer-events: auto;
    gap: 0;
    border: 1px solid transparent;
    transition: all 0.4s ease-in-out;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 0.8rem;
}

.btn-clean-chat span {
    max-width: 0;
    white-space: nowrap;
    overflow: hidden;
    margin-left: 0;
    transition: all 0.4s ease-in-out;
}

.btn-clean-chat.hidden {
    opacity: 0;
    pointer-events: none;
}

.btn-clean-chat:hover {
    border-color: var(--color-purple);
}

.btn-clean-chat:hover span {
    max-width: 100px;
    margin-left: 0.8rem;
}

.conversation::-webkit-scrollbar {
    display: none;
}

.conversation__welcome {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 3rem 0;
}

.conversation__welcome h1 {
    font-size: 4.2rem;
    font-weight: 800;
    margin-bottom: 1.2rem;
}

.conversation__welcome h2 {
    font-size: 2.0rem;
    font-weight: 450;
}

.conversation__bubble {
    padding: 1rem;
    line-height: 2.0rem;
    font-size: 1.5rem;
    max-width: 80%;
    margin: 1.2rem 0;
}

.conversation__bubble--user {
    align-self: flex-end;
    padding: 0.8rem 1.2rem;
    background-color: var(--color-neutral-0);
    border-radius: 2rem;
}

.conversation__bubble--model {
    display: inline-flex;
    gap: 1rem;
}

.conversation__bubble--model .model-icon-container {
    width: 3.2rem;
    height: 3.2rem;
    flex: 0 0 auto;
}

.conversation__bubble--model.animated .model-icon-container svg path,
.loading-bubble .model-icon-container svg path {
    animation: lookAroundChatAvatar 3s linear infinite;
    transform-origin: center;
}

/* ==========================================================================
   Loading Animations
   ========================================================================== */

.loading-bubble {
    display: flex;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

.loading-bubble.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.typing-animation {
    display: flex;
    gap: 4px;
    align-items: center;
    height: 100%;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #56C3E8;
    border-radius: 50%;
    animation: typingLoadingAnimation 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes lookAroundChatAvatar {
    0%, 100% {
        transform: translateX(0px);
    }
    25% {
        transform: translateX(-0.4rem);
    }
    75% {
        transform: translateX(0.1rem);
    }
}

@keyframes lookAroundChatEmptyState {
    0% {
        transform: translateX(-2rem);
    }
    25% {
        transform: translateX(-4rem);
    }
    50% {
        transform: translateX(12rem);
    }
    75% {
        transform: translateX(1.5rem);
    }
    100% {
        transform: translateX(-2rem);
    }
}

@keyframes fadeInFromBelow {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes typingLoadingAnimation {
    0%, 60%, 100% {
        transform: translateY(2px);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-2px);
        opacity: 1;
    }
}

/* ==========================================================================
   Breakpoints
   ========================================================================== */

@media screen and (max-width: 1920px) {
    .chat-screen {
        padding: 0;
    }

    .chat-screen__chat {
        border-radius: 0;
    }
}

@media screen and (max-width: 1470px) {
    .chat-screen__properties__section__list {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media screen and (max-width: 1190px) {
    .chat-screen__properties__section__list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media screen and (max-width: 940px) {
    .show-properties-btn.show {
        display: flex;
        opacity: 1;
        animation: fadeInFromBelow 0.5s ease forwards;
    }

    .chat-screen {
        grid-template-columns: 1fr;
    }

    .chat-screen__properties__section__list {
        grid-template-columns: repeat(3, 1fr);
    }

    .chat-screen__properties {
        position: fixed;
        z-index: 500;
        top: var(--topbar-height);
        left: 0;
        right: 0;
        bottom: 0;
        transform: translateY(100%);
        transition: transform 0.5s ease;
        background-color: var(--color-neutral-0);
        padding-bottom: 5rem;
    }

    .chat-screen.results-open .chat-screen__properties {
        transform: translateY(0);
    }

    .chat-screen.results-open .hide-properties-btn {
        display: inline-flex;
        z-index: 550;
        animation: fadeInFromBelow 0.5s ease forwards;
    }
}

@media screen and (max-width: 550px) {
    .chat-screen__properties__section__list {
        grid-template-columns: repeat(2, 1fr);
    }

    .conversation__welcome h1 {
        font-size: 3.2rem;
    }

    .conversation__welcome h2 {
        font-size: 1.6rem;
    }
}
