/* chat.css */

/* Common Styles */
#chat-container {
    background-color: #f1f1f1;
    border: 1px solid #ccc;
    display: flex;
    flex-direction: column;
    font-family: 'Roboto', sans-serif;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    width: 100%;
    height: 500px;
    margin-top: 20px;
    border-radius: 8px;
}

/* Header */
#chat-header {
    padding: 10px;
    background-color: #fff;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 8px 8px 0 0;
}

#chat-header h2 {
    margin: 0;
    font-size: 16px;
    color: #333;
}

/* Messages Area */
#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    background-color: #f9f9f9;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Individual Message */
.message {
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.message .author {
    font-weight: bold;
    color: #606060;
    margin-right: 5px;
}

.message .content {
    color: #0f0f0f;
}

.message.bot .author {
    color: #1a73e8;
    /* Google Blue for AI */
}

.message.bot .content {
    color: #333;
}

/* Input Area */
#chat-input-area {
    padding: 10px;
    background-color: #fff;
    border-top: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-radius: 0 0 8px 8px;
}

#chat-input-area input[type="text"] {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    outline: none;
}

#chat-input-area input[type="text"]:focus {
    border-color: #1a73e8;
}

#chat-form {
    display: flex;
    gap: 5px;
}

#message-input {
    flex: 1;
}

#send-btn {
    padding: 8px 15px;
    background-color: #28a745;
    /* Green */
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s ease;
}

#send-btn:hover {
    background-color: #8B4513;
    /* Brown */
}

#send-btn:active {
    background-color: #000000;
    /* Black */
}

/* Hidden Name Input - Force Hide on both mobile and desktop */
#chat-input-area #name-input.hidden {
    display: none !important;
}

/* Chat Button (Green, visible on both desktop and mobile) */
#mobile-chat-btn {
    display: block;
    width: 100%;
    max-width: 400px;
    margin: 10px auto;
    padding: 15px;
    background-color: #28a745;
    /* Green */
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

#mobile-chat-btn:hover {
    background-color: #218838;
}

/* Close Button (visible on both desktop and mobile) */
#close-chat-mobile {
    display: block;
    background: none;
    border: none;
    font-size: 24px;
    color: #555;
    cursor: pointer;
    padding: 0 10px;
}

#close-chat-mobile:hover {
    color: #000;
}

/* Desktop: Chat container is visible by default */
@media (min-width: 769px) {
    #chat-container {
        display: flex;
    }

    #chat-container.open {
        display: flex;
    }

    /* Hide chat when close button is clicked on desktop */
    #chat-container.closed {
        display: none;
    }
}

/* Responsive Design (Mobile) */
@media (max-width: 768px) {

    /* Mobile Chat Container (Fixed Overlay) */
    #chat-container {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 70vh;
        /* Taller on mobile */
        margin-top: 0;
        border-radius: 16px 16px 0 0;
        z-index: 1002;
        transform: translateY(100%);
        /* Hidden by default */
        transition: transform 0.3s ease-in-out;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
    }

    #chat-container.open {
        transform: translateY(0);
    }

    #chat-header {
        border-radius: 16px 16px 0 0;
    }

    body {
        padding-bottom: 20px;
    }
}