/* =========================================
   CHATBOT STYLES (Sereth Theme)
   ========================================= */

/* --- 1. Floating Icon --- */
#chat-icon {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background-color: var(--deep-blue);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 15px rgba(42, 64, 104, 0.3);
    cursor: pointer;
    z-index: 2050;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#chat-icon:hover {
    -webkit-transform: translateZ(0) scale(1.1);
    transform: translateZ(0) scale(1.1);
    background-color: var(--primary-blue);
}

/* Notification Badge */
#chat-icon::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 15px;
    height: 15px;
    background-color: #e74c3c;
    border-radius: 50%;
    border: 2px solid #fff;
}

/* --- 2. Chat Window --- */
#chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 350px;
    height: 500px;
    background-color: #fff;
    border-radius: 20px;
    box-shadow: 0 5px 30px rgba(0,0,0,0.15);
    display: none; /* Hidden by default */
    flex-direction: column;
    overflow: hidden;
    z-index: 2000;
    border: 1px solid rgba(0,0,0,0.05);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- 3. Header (FIXED VISIBILITY) --- */
.chat-header {
    background-color: var(--deep-blue);
    color: #ffffff !important; /* Force white text */
    padding: 15px 20px;
    font-family: var(--font-serif);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 500;
    color: #ffffff !important; /* Override global H4 blue style */
}

.chat-close {
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.8;
    transition: opacity 0.2s;
    color: #ffffff !important; /* Force white icon */
}

.chat-close:hover { opacity: 1; }

/* --- 4. Messages Area --- */
#chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #FDFCF8;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#chat-messages::-webkit-scrollbar { width: 6px; }
#chat-messages::-webkit-scrollbar-thumb { background-color: #ddd; border-radius: 10px; }

/* Message Bubbles */
.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 15px;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
}

.message.bot {
    align-self: flex-start;
    background-color: #fff;
    color: var(--text-grey);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border-bottom-left-radius: 2px;
}

.message.user {
    align-self: flex-end;
    background-color: var(--primary-blue);
    color: #fff;
    border-bottom-right-radius: 2px;
    box-shadow: 0 2px 5px rgba(62, 92, 154, 0.2);
}

.message a { color: inherit; text-decoration: underline; }

/* --- 5. Options / Buttons (FIXED ALIGNMENT) --- */
.options-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 5px;
    justify-content: flex-start; /* Force Left Alignment */
    width: 100%;
}

.option {
    background-color: transparent;
    border: 1px solid var(--primary-blue);
    color: var(--primary-blue);
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-sans);
    font-weight: 600;
    text-align: left; /* Ensure text inside button aligns left */
}

.option:hover {
    background-color: var(--primary-blue);
    color: white;
}

/* --- 6. Typing Indicator --- */
.typing {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 20px;
}

.typing span {
    width: 6px;
    height: 6px;
    background-color: #ccc;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing span:nth-child(1) { animation-delay: -0.32s; }
.typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* --- Responsive --- */
@media (max-width: 480px) {
    #chat-window {
        width: 90%;
        right: 5%;
        bottom: 80px;
        height: 60vh;
    }
}