:root {
    --header-height: 40px;
    --footer-height: 40px;
}

@media (max-width: 900px) {
    :root {
        --header-height: 30px;
        --footer-height: 35px;
    }
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f5f6fa;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-main {
    flex: 1;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
}

footer {
    height: var(--footer-height);
    background: #f1f3f5;
    border-top: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #555;
}

#chat-container {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 0;
    box-shadow: none;
    position: relative;
    overflow: hidden;
}

#chat-card-header {
    background: #007bff;
    color: white;
    height: var(--header-height);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    font-size: 14px;
    font-weight: bold;
}

    #chat-card-header .left {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    #chat-card-header .right button {
        border: none;
        background: transparent;
        color: white;
        font-size: 20px;
        cursor: pointer;
    }

#chat-box {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #fdfdfd;
}

.chat-footer {
    position: relative;
    background: #fafafa;
}

.faq-quick {
    padding: 10px;
    border-top: 1px solid #ddd;
    background: #fafafa;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}

    .faq-quick button {
        flex: 0 0 auto;
        margin: 0;
        padding: 6px 12px;
        border: none;
        border-radius: 6px;
        background: #107ec2;
        color: white;
        cursor: pointer;
        font-size: 13px;
        white-space: nowrap;
    }

        .faq-quick button:hover {
            background: #2356a7;
        }

#controls {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    border-top: 1px solid #ddd;
    background: #fafafa;
}

    #controls button {
        padding: 6px 12px;
        border: none;
        border-radius: 8px;
        font-size: 14px;
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 6px;
        transition: 0.2s;
    }

#clear-history {
    background: #dc3545;
    color: white;
}

    #clear-history:hover {
        background: #b02a37;
    }

#new-chat {
    background: #17a2b8;
    color: white;
}

    #new-chat:hover {
        background: #117a8b;
    }

#input-bar {
    display: flex;
    padding: 10px;
    border-top: 1px solid #ddd;
    background: #fff;
    gap: 8px;
    align-items: center;
}

#user-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #e6e6e6;
    border-radius: 8px;
    outline: none;
    font-size: 14px;
}

#send-btn {
    padding: 8px 14px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

    #send-btn:hover {
        background: #0056b3;
    }

.chat-info {
    background-color: #fff3cd;
    color: #856404;
    font-size: 0.85rem;
    padding: 8px 14px;
    border: 1px solid #ffeeba;
    border-radius: 8px;
    margin: auto 0;
    text-align: center;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 90%;
}

.chat-row {
    display: flex;
    align-items: flex-end;
    margin: 8px 0;
    opacity: 0;
    transform: translateY(10px);
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-row.user {
    justify-content: flex-end;
}

.chat-row.bot {
    justify-content: flex-start;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    margin: 0 8px;
    background-size: cover;
    background-position: center;
}

    .avatar.user {
        background-image: url('/Content/img/default-user.png');
    }

    .avatar.bot {
        background-image: url('/Content/assets/img/favicon.png');
    }

.message {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 15px;
    font-size: 14px;
    word-wrap: break-word;
}

.user-message {
    background: #007bff;
    color: white;
    border-bottom-right-radius: 0;
}

.bot-message {
    background: #e4e6eb;
    color: black;
    border-bottom-left-radius: 0;
}

.suggestion-btn {
    background: #dae4f4;
    border: 1px solid #b6d4fe;
    color: #084298;
    padding: 6px 10px;
    margin: 4px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
}

    .suggestion-btn:hover {
        background: #107ec2;
        color: #fff;
    }

.typing-indicator {
    display: flex;
    gap: 6px;
}

    .typing-indicator span {
        width: 10px;
        height: 10px;
        background: #4a90e2;
        border-radius: 50%;
        animation: blink 1.4s infinite both;
        opacity: 0.3;
    }

        .typing-indicator span:nth-child(2) {
            animation-delay: 0.2s;
        }

        .typing-indicator span:nth-child(3) {
            animation-delay: 0.4s;
        }

@keyframes blink {
    0%, 80%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }

    40% {
        opacity: 1;
        transform: scale(1.3);
    }
}

#scroll-bottom-btn {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 12px);
    transform: translateX(-50%);
    background-color: #e57373;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s, transform 0.15s;
    z-index: 220;
}

    #scroll-bottom-btn.show {
        opacity: 1;
        pointer-events: auto;
        transform: translate(-50%,0);
    }

    #scroll-bottom-btn:hover {
        background-color: #8b0000;
    }

    #scroll-bottom-btn i {
        font-size: 20px;
        font-weight: 700;
    }

body.dark {
    background: #121212;
    color: #ddd;
}

    body.dark #chat-container {
        background: #1e1e1e;
        box-shadow: none;
        color: #ddd;
    }

    body.dark #chat-card-header {
        background: #111;
        color: #fff;
        border-bottom: 2px solid #444;
    }

    body.dark #chat-box {
        background: #141414;
        color: #ddd;
    }

    body.dark .bot-message {
        background: #2b2b2b;
        color: #fff;
    }

    body.dark .user-message {
        background: #0d6efd;
        color: #fff;
    }

    body.dark .faq-quick {
        background: #1a1a1a;
    }

        body.dark .faq-quick button {
            background: #333;
            border: 1px solid #444;
            color: #ddd;
        }

            body.dark .faq-quick button:hover {
                background: #0d6efd;
                color: #fff;
            }

    body.dark .user-message {
        background: #007bff;
        color: white;
        border-bottom-right-radius: 0;
    }

    body.dark .bot-message {
        background: #e4e6eb;
        color: black;
        border-bottom-left-radius: 0;
    }

@media (max-width: 768px) {
    .faq-quick button:not(:nth-child(-n+2)) {
        display: none;
    }

    #chat-container {
        width: 100%;
        height: 100vh;
    }

    #scroll-bottom-btn {
        right: 16px;
        bottom: calc(100% + 10px);
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .faq-quick button:not(:nth-child(-n+2)) {
        display: none;
    }

    #user-input {
        font-size: 13px;
    }

    #scroll-bottom-btn {
        right: 10px;
        bottom: calc(100% + 8px);
        width: 36px;
        height: 36px;
    }
}