﻿:root {
    --message-padding: .8em;
    --message-border-radius: 10px;
    --accent-color: var(--theme-accent-color, #007bff);
    --bot-message-color: var(--theme-bot-message-color, rgb(51, 51, 51));
    --user-message-color: var(--theme-user-message-color, rgb(51, 51, 51));
    --user-message-background-color: var(--theme-user-message-background-color, #ddd);
}

.btn {
    border-radius: var(--message-border-radius);
}

.user-message .btn.btn-primary {
    border-color: var(--user-message-background-color) !important;
    background-color: var(--user-message-background-color) !important;
    color: var(--user-message-color) !important;
}

.bot-message .btn.btn-primary {
    background-color: var(--accent-color) !important;
}

#chatLauncher {
    position: fixed;
    bottom: 100px;
    right: 100px;
    background: var(--accent-color);
    color: white;
    padding: 10px 15px;
    border-radius: 25px;
    font-weight: bold;
    box-shadow: 0 0 10px rgba(0,0,0,0.3);
    z-index: 999;
    white-space: nowrap;
    font-size: 16px;
}

#chatbotIcon {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--accent-color);
    color: white;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 0 10px rgba(0,0,0,0.3);
    font-size: 24px;
}

#chatWindow {
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#chatHeader {
    background: var(--accent-color);
    color: white;
    padding: 10px 12px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

    #chatHeader img {
        height: 40px;
        width: auto;
        margin-right: 10px;
    }

#chatFooter {
    font-size: .8em;
    background-color: #eee;
    padding: 6px 12px;
}

.controls i {
    margin-left: 10px;
    cursor: pointer;
}

#chatContainer {
    display: flex;
    flex-direction: column;
    overflow-y: hidden;
    flex-grow: 1;
    position: relative;
}

    #chatContainer > #chatBodyWrapper {
        overflow-y: auto;
        flex: 1;
    }

    #chatContainer #chatBody {
        min-height: 100%;
        position: relative;
        padding: 10px;
        font-size: 14px;
        border-top: none;
        background-color: var(--bot-message-bg-color);
        display: flex;
        flex-direction: column;
    }

    #chatContainer > .overlay.hide {
        display: none;
        opacity: 0;
    }

    #chatContainer > .overlay {
        position: absolute;
        background-color: rgba(0,0,0,0.3);
        user-select: none;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 99;
        padding: 10px;
        width: 100%;
        backdrop-filter: blur(5px);
        opacity: 1;
        transition: opacity .5s ease-in-out;
        display: flex;
        flex-direction: column;
    }

        #chatContainer > .overlay .actions {
            flex-direction: column;
            flex-wrap: nowrap;
            align-items: end;
        }

    #chatContainer > *:not(first-child) {
        border-top: 1px solid #ccc;
    }

#chatInput {
    display: flex;
    height: 50px;
}

    #chatInput input {
        flex-grow: 1;
        padding: 0 12px;
        border: none;
        outline: none;
        font-size: 14px;
        background: var(--user-message-bg-color);
    }

    #chatInput .buttons {
        width: 70px;
        display: flex;
        font-size: 14px;
    }

        #chatInput .buttons button {
            border: none;
            flex: 1 0 auto;
        }

    #chatInput button.cancel {
        display: none;
        background-color: var(--accent-color);
        color: white;
        filter: grayscale(70%) brightness(1.2);
    }

    #chatInput button[type=submit] {
        background-color: var(--accent-color);
        color: white;
    }

        #chatInput button[type=submit]:disabled {
            display: none;
            cursor: not-allowed;
            opacity: .7;
            filter: grayscale(70%) brightness(1.2);
        }

            #chatInput button[type=submit]:disabled ~ button.cancel {
                display: inline-block;
            }

.feedback-buttons i {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.fa-thumbs-up {
    color: green;
    margin-right: 15px;
}

.fa-thumbs-down {
    color: red;
}

.feedback-buttons i:hover {
    transform: scale(1.3);
}

.feedback-message {
    margin-top: 8px;
    font-weight: bold;
}

    .feedback-message.success {
        color: green;
    }

    .feedback-message.error {
        color: red;
    }

#bot-welcome-message {
    background-color: #eef3f8;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    line-height: 1.6;
    color: #333;
}

.bot-message, .user-message {
    margin-bottom: .8em;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.message-header {
    display: flex;
    gap: .5em;
}

.message-content {
    max-width: 100%;
    width: max-content;
}

.bot-message {
    align-self: start;
}

    .bot-message > *:nth-child(n+3) {
        margin-top: .5em;
    }

    .bot-message .message-content {
        color: var(--bot-message-color);
        font-size: 1em;
    }

        .bot-message .message-content h1,
        .bot-message .message-content h2,
        .bot-message .message-content h3,
        .bot-message .message-content h4,
        .bot-message .message-content h5,
        .bot-message .message-content h6 {
            font-size: inherit;
        }

        .bot-message .message-content > *:last-child {
            margin-bottom: 0;
        }

.bot-avatar .bot-message {
    padding-left: 40px;
    padding-top: 5px;
    position: relative;
}

    .bot-avatar .bot-message:before {
        content: '';
        background-image: url(../img/avatar-bot.png);
        background-size: contain;
        width: 30px;
        height: 30px;
        position: absolute;
        top: 0;
        left: 0;
    }

.user-message {
    width: 80%;
    align-self: end;
    align-items: end;
    margin-top: 1.2em;
}

    .user-message .message-content {
        color: var(--user-message-color);
        padding: var(--message-padding);
        border-radius: var(--message-border-radius);
        background-color: var(--user-message-background-color);
        border-top-right-radius: 0;
    }

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: .3em;
}

.chat-time {
    color: #777;
}
