/*
 * Style for Astro LLM Chat Widget
 */

/* ==================================== */
/* Positioning and base styles */
/* ==================================== */

#astro-llm-widget-container {
    display: contents;
}

#astro-llm-open-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #007bff;
    color: white;
    border: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease-in-out, box-shadow 0.3s ease-in-out, transform 0.3s ease-in-out;
}

#astro-llm-open-btn:hover {
    background-color: #0056b3;
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

#astro-llm-chat-window {
    position: fixed;
    bottom: 30px;
    right: 20px;
    z-index: 9999;
    width: 365px;
    height: 600px;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out, width 0.3s ease-out, height 0.3s ease-out;
    background-color: #1e1e1e;
    border-radius: 10px;
    box-shadow: 0px 0px 20px 10px #2f2f2f;
    flex-direction: column;
    overflow: hidden;
}

@media screen and (max-width: 576px){
    #astro-llm-chat-window {
        width: 330px;
        height: 500px;
        right: 10px;
        bottom: 10px;
    }
}

/* Chat widget Full size */
.chat-is-maximized {
    width: calc(50% - 40px) !important;
    height: calc(90% - 80px) !important;
    bottom: 20px !important;
    right: 20px !important;
}

@media screen and (max-width: 991px) {
    .chat-is-maximized {
        width: calc(100% - 40px) !important;
        height: calc(100% - 80px) !important;
    }
}

@media screen and (max-width: 576px) {
    .chat-is-maximized {
        width: calc(100% - 40px) !important;
        height: calc(100% - 60px) !important;
    }
}

.chat-is-open {
    display: flex !important;
    opacity: 1 !important;
    transform: scale(1) !important;
}

/* ==================================== */
/* Wave Animation */
/* ==================================== */

#astro-llm-open-btn::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: #007bff;
    opacity: 0.7;
    transform: scale(1);
    z-index: -1;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.7;
    }

    50% {
        transform: scale(1.5);
        opacity: 0.2;
    }

    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

/* ==================================== */
/* Content & Interface */
/* ==================================== */

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background-color: #0a0a0a;
    color: white;
    border-bottom: 1px solid #2f2f2f;
}

.chat-header .header-actions {
    display: flex;
    gap: 5px;
    align-items: center;
}

#astro-llm-close-btn,
#astro-llm-toggle-size-btn {
    background: none;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
}

.chat-header h3 {
    margin: 0;
    padding: 0;
    font-size: 18px;
    background: linear-gradient(90deg, #fff, #fff, #308abb);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shine 5s infinite linear;
    font-weight: 700;
}

@keyframes shine {
    50% { background-position: -200% 0 }
    100% { background-position: -200% 0 }
}

#astro-llm-close-btn {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
}

#astro-llm-close-btn .close-icon:hover{
    opacity: 0.8;
}

#astro-llm-toggle-size-btn:hover{
    opacity: 0.8;
    transform: scale(1.1);
}

.chat-content-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    overflow-y: hidden;
}

/* Hide welcome message after chat starts to have more space for messages */
.welcome-message.hidden-on-chat {
    display: none !important;
}

.welcome-message {
    padding: 15px;
    color: #ccc;
    text-align: center;
    height: 100%;
    align-content: center;
}

.welcome-message h4 {
    font-size: 24px;
    color: white;
    margin-bottom: 5px;
}

.welcome-message p {
    font-size: 16px;
}

/* Scroll to bottom chat btn */
.scroll-to-bottom-btn {
    position: sticky;
    display: none;
    bottom: 10px;
    left: 95%;
    transform: none;
    background-color: #333;
    color: white;
    border: 1px solid #555;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    font-size: 1.2em;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
    transition: opacity 0.3s;
    opacity: 0;
    pointer-events: none;
}

.scroll-to-bottom-btn.visible {
    opacity: 1;
    pointer-events: auto;
    display: inline-block;
}

.scroll-to-bottom-btn.visible:hover {
    opacity: 0.8;
}

.context-wrapper>section,
.context-wrapper>section>article {
    position: relative;
    z-index: 1;
}

.context-wrapper {
    padding: 10px;
    overflow-y: auto;
    position: relative;
}

.chat-interface-wrapper {
    padding: 10px !important;
    background-color: #0a0a0a;
    border-top: 1px solid #2f2f2f;
    position: relative;
    padding-bottom: 10px !important;
    width: 100% !important;
}

/* ==================================== */
/* Style for labels and textarea */
/* ==================================== */

#txtPrompt {
    width: 100%;
    min-height: 80px;
    padding: 8px 10px;
    border: 1px solid #2f2f2f;
    border-radius: 5px;
    background-color: #0a0a0a;
    color: white;
    box-sizing: border-box;
    font-size: 14px;
}

#txtPrompt:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 0.1rem rgba(0, 123, 255, 0.25);
}

.chat-ui-action-topic-wrapper,
.chat-ui-action-exp-wrapper {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 10px;
}

.chat-ui-action-topic-wrapper label,
.chat-ui-action-exp-wrapper label {
    color: #ccc;
    white-space: nowrap;
    font-size: 14px;
}

#ddlTopic,
#ddlTarget,
#ddlExpLvl,
#txtSpecificTarget {
    width: 100%;
    padding: 5px 8px;
    background-color: #0a0a0a !important;
    color: white !important;
    border: 1px solid #2f2f2f !important;
    border-radius: 5px;
    box-sizing: border-box;
    font-size: 14px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
}

.chat-ui-action-btn-wrapper {
    width: 100%;
}

.global-chat-btns #btnAskAI,
.global-chat-btns #btnClearChatHistory {
    font-size: 14px;
    padding: 5px 10px;
}

.global-chat-btns #btnAskAI {
    float: right;
}

/* ==================================== */
/* Message from User/АІ */
/* ==================================== */

.context-wrapper>section>article.question {
    background-color: #007bff;
    color: white;
    border-radius: 10px 10px 0 10px;
    margin-left: auto;
    max-width: 80%;
    font-size: 14px;
}

.context-wrapper>section>article.response,
.context-wrapper>section>article.loading {
    background-color: #2f2f2f;
    color: white;
    border-radius: 10px 10px 10px 0;
    margin-right: auto;
    max-width: 85%;
    font-size: 14px;
}

.context-wrapper>section>article.response div ul {
    padding-left: 0px;
    margin-bottom: 0px;
}

.chat-is-maximized .context-wrapper>section>article.question,
.chat-is-maximized .context-wrapper>section>article.response {
    max-width: 65%;
}

@media screen and (max-width: 991px) {

    .chat-is-maximized .context-wrapper>section>article.question,
    .chat-is-maximized .context-wrapper>section>article.response {
        max-width: 60%;
    }
}

@media screen and (max-width: 768px) {

    .chat-is-maximized .context-wrapper>section>article.question,
    .chat-is-maximized .context-wrapper>section>article.response {
        max-width: 75%;
    }
}

@media screen and (max-width: 576px) {

    .chat-is-maximized .context-wrapper>section>article.question,
    .chat-is-maximized .context-wrapper>section>article.response {
        max-width: 85%;
    }
}

.context-wrapper>section>article.loading {
    animation: chatWidgetLoading 1s infinite alternate;
}

.loadingTextAnimation {
    animation: chatWidgetLoading 1s infinite alternate;
}

@keyframes chatWidgetLoading {
    from {
        color: white;
    }

    to {
        color: #2f2f2f;
    }
}

.context-wrapper>section {
    padding: 0.5rem 0.25rem;
    background-color: transparent;
}

.context-wrapper>section>article {
    padding: 8px 12px;
    margin-bottom: 8px;
}

/* ==================================== */
/* Custom Scrollbar */
/* ==================================== */

/* Chrome, Safari, Opera scrollbar style */
.context-wrapper::-webkit-scrollbar {
    width: 8px;
}

.context-wrapper::-webkit-scrollbar-track {
    background: #000000;
}

.context-wrapper::-webkit-scrollbar-thumb {
    background-color: #2f2f2f;
    border-radius: 4px;
    border: 1px solid #2f2f2f;
}

.context-wrapper::-webkit-scrollbar-thumb:hover {
    background-color: #007bff;
}