@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@200;300;400;500;600&display=swap");

:root {
    --primary-color: #ff9800;
    /* Orange for contrast */
    --secondary-color: #ffb74d;
    /* Lighter orange */
    /* --background-color: #ffffff; */
    --background-color: #f7f7f7;
    /* White */
    --text-color: #212121;
    /* Dark gray */
    --light-gray: #f5f5f5;
    /* Light gray */
    --scrollbar-color: #c5cae9;
    /* Light blue-gray */
    --user-message-bg: #e3f2fd;
    /* Light blue */
    /* --bot-message-bg: #f0f0f0; */
    --bot-message-bg: #fff;
    /* Very light gray */
}

/* body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    background-image: url('/static/bg.jpeg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    font-size: 16px;
} */

#chat-icon {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background-color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    z-index: 4000;
}

#chat-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(255, 152, 0, 0.4);
}

#chat-icon img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

#chat-container {
    position: fixed;
    bottom: 80px;
    right: 30px;
    width: 370px;
    /* Increased width */
    height: calc(100% - 40px);
    max-height: min(650px, 79%);
    /* Increased max height */
    background-color: #fff;
    border: 1px solid var(--light-gray);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform: translateY(20px);
    opacity: 0;
    visibility: hidden;
    z-index: 4000;
}

#chat-container.visible {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

#chat-header {
    /* background-color: var(--primary-color); */
    color: #1B1B1B;
    padding: 0px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    line-height: 1.5;
}

.header__welcome-text {
    display: flex;
    align-items: center;
    gap: 5px;
}

.heading-icon {
    background-color: #0a8963;
    border-radius: 5px;
    box-shadow: 0 0 0 1px hsla(0, 0%, 100%, .8);
    height: 8px;
    width: 8px;
    display: inline-block;
}

.chat-heading {
    font-size: 15px;
    font-weight: bold;
    text-align: left;
    text-overflow: ellipsis;
    font-family: "Nunito", sans-serif;
}

#chat-header .heading {
    margin: 0;
    font-size: 18px;
}


#close-chat {
    background: none;
    border: none;
    color: #1B1B1B;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s ease;
}

#close-chat:hover {
    transform: scale(1.1);
}

#chat-messages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    max-height: calc(100% - 120px);
}

.message {
    max-width: 80%;
    margin-bottom: 15px;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 17px;
    /* Increased font size */
    line-height: 1.5;
    word-wrap: break-word;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.user-message {
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    text-align: right;
    flex-direction: row-reverse;
    justify-content: flex-end;
}

.bot-message {
    color: var(--text-color);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    max-width: 80%;
    width: fit-content;
    flex-direction: row;
}

.bot-message p {
    margin: 0 0 15px 0;
}

.bot-message p:last-child {
    margin-bottom: 0;
}

.bot-message ul,
.bot-message ol {
    margin: 0 0 15px 0;
    padding-left: 20px;
}

.bot-message img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 10px 0;
}

.bot-message code {
    background-color: #e0e0e0;
    padding: 2px 4px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}

.bot-message pre {
    background-color: #f5f5f5;
    padding: 10px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 15px 0;
}

.bot-message pre code {
    background-color: transparent;
    padding: 0;
    font-size: 0.9em;
    line-height: 1.4;
}

#chat-input-container {
    display: flex;
    padding: 8px;
    background-color: #fff;
    border-top: 1px solid var(--primary-color);
}

#user-input {
    flex-grow: 1;
    border: 1px solid var(--primary-color);
    background-color: var(--background-color);
    color: var(--text-color);
    padding: 10px 15px;
    border-radius: 20px;
    font-size: 15px;
    font-family: "Nunito", sans-serif;
    /* Increased font size */
    outline: none;
}


#user-input::placeholder {
    color: #9e9e9e;
}

#send-button {
    background-color: var(--primary-color);
    color: var(--background-color);
    border: none;
    /* padding: 10px 15px; */
    border-radius: 50px;
    margin-left: 10px;
    cursor: pointer;
    font-size: 16px;
    font-family: "Nunito", sans-serif;
    /* Increased font size */
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.2s ease;
    height: 32px;
    width: 32px;
}

#send-button svg {
    fill: #555;
    /* Arrow color */
    transition: fill 0.2s;
}

#send-button:hover svg {
    fill: #000;
    /* Darker arrow on hover */
}

#send-button:hover {
    background-color: var(--secondary-color);
    transform: scale(1.05);
}

/* Custom scrollbar */
#chat-messages::-webkit-scrollbar {
    width: 8px;
}

#chat-messages::-webkit-scrollbar-track {
    background: var(--light-gray);
}

#chat-messages::-webkit-scrollbar-thumb {
    background-color: var(--scrollbar-color);
    border-radius: 4px;
}

#typing-indicator {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 30px;
    margin-bottom: 10px;
}

#typing-indicator.hidden {
    display: none;
}

.dot {
    width: 6px;
    height: 6px;
    background-color: var(--primary-color);
    border-radius: 50%;
    margin: 0 3px;
    animation: bounce 1.3s linear infinite;
    box-sizing: border-box;
}

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

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

@keyframes bounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-10px);
    }
}

.typing-indicator {
    background-color: var(--bot-message-bg);
    padding: 12px 16px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 30px;
    /* width: 60px; */
}

.typing-indicator .dot {
    width: 6px;
    height: 6px;
    background-color: var(--text-color);
    border-radius: 50%;
    margin: 0 3px;
    animation: bounce 1.3s linear infinite;
}

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

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

@keyframes bounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-5px);
    }
}

.view-image-btn-container {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.view-image-btn {
    padding: 8px 16px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.view-image-btn:hover {
    background-color: var(--secondary-color);
}

.image-modal {
    display: flex;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
}

.modal-content {
    position: relative;
    background-color: #fefefe;
    padding: 20px;
    border-radius: 10px;
    max-width: 90%;
    max-height: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    cursor: pointer;
    color: #aaa;
    transition: color 0.3s ease;
}

.close-modal:hover {
    color: #333;
}

.message-container {
    display: flex;
    margin-bottom: 15px;
    align-items: flex-start;
    max-width: 80%;
}

.bot-message {
    align-self: flex-start;
}

.user-message {
    align-self: flex-end;
}

.message-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

.bot-message .message-icon {
    background-color: var(--primary-color);
    color: white;
    margin-right: 10px;
}

.user-message .message-icon {
    background-color: var(--secondary-color);
    color: white;
    margin-left: 10px;
}

.message-text {
    max-width: 100%;
    /* padding: 12px 16px;  */
    padding: .6em 1em;
    border-radius: 14px;
    /* border-radius: 18px; */
    /* font-size: 17px; */
    font-size: 14px;
    font-family: "Nunito", sans-serif;
    line-height: 1.4;
    word-wrap: break-word;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.bot-message .message-text {
    background-color: #f2f2f2;
    color: var(--text-color);
    /* border-bottom-left-radius: 4px; */
}

.user-message .message-text {
    background-color: var(--user-message-bg);
    color: var(--text-color);
    /* border-bottom-right-radius: 4px; */
    text-align: right;
}

.bot-message .message-text ul {
    list-style-type: none;
    padding-left: 0;
    margin-top: 10px;
}

.bot-message .message-text li {
    margin-bottom: 15px;
    padding-left: 25px;
    position: relative;
}

.bot-message .message-text li:before {
    content: '•';
    color: var(--primary-color);
    font-size: 18px;
    position: absolute;
    left: 0;
    top: 0;
}

.bot-message .message-text strong {
    font-weight: 600;
    color: var(--primary-color);
}

.bot-message .message-text li strong {
    font-size: 1.05em;
    display: block;
    margin-bottom: 3px;
}

.bot-message .message-text li:not(:last-child) {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding-bottom: 15px;
}

#welcome-txt {
    font-family: "Nunito", sans-serif;
    padding: 4px 16px;
}

.hidden {
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

#chat-icon.visible {
    opacity: 1;
    transform: scale(1);
}

#chat-container.hidden {
    transform: translateY(20px);
}

#chat-container.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.5s ease, transform 0.5s ease;
}