/* css/chat.css - Central Cocktail Chat Widget */

:root {
    --chat-primary: #25d366; /* WhatsApp Green */
    --chat-primary-dark: #128c7e; /* WhatsApp Dark Green */
    --chat-bg: #0b141a; /* WhatsApp Dark Mode Background */
    --chat-text: #ffffff;
    --chat-bubble-user: #005c4b; /* WhatsApp Sent Bubble Dark */
    --chat-bubble-agent: #202c33; /* WhatsApp Received Bubble Dark */
    --chat-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* Floating Button */
.chat-widget-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background-color: var(--chat-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--chat-shadow);
    cursor: pointer;
    z-index: 9999;
    transition: transform 0.3s ease, background-color 0.3s ease;
    border: none;
    outline: none;
}

.chat-widget-btn:hover {
    transform: scale(1.05);
    background-color: var(--chat-primary-dark);
}

.chat-widget-btn svg {
    fill: #ffffff;
    width: 30px;
    height: 30px;
    transition: opacity 0.3s ease;
}

.chat-widget-btn .close-icon {
    display: none;
    fill: #ffffff;
    width: 20px;
    height: 20px;
}

.chat-widget-btn.open .chat-icon {
    display: none;
}

.chat-widget-btn.open .close-icon {
    display: block;
}

/* Chat Window */
.chat-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 350px;
    height: 500px;
    max-height: calc(100vh - 120px);
    background-color: var(--chat-bg);
    border-radius: 12px;
    box-shadow: var(--chat-shadow);
    display: flex;
    flex-direction: column;
    z-index: 9998;
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
    border: 1px solid #333;
    overflow: hidden;
}

.chat-window.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
}

/* Chat Header */
.chat-header {
    background-color: #202c33;
    padding: 15px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #111b21;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    background-color: var(--chat-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-weight: bold;
    color: #111;
    font-size: 18px;
    position: relative;
}

.chat-avatar::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background-color: #4CAF50;
    border-radius: 50%;
    border: 2px solid #202c33;
}

.chat-title {
    display: flex;
    flex-direction: column;
}

.chat-title strong {
    color: #fff;
    font-size: 16px;
    letter-spacing: 0.5px;
}

.chat-title span {
    color: #aaa;
    font-size: 12px;
}

/* Chat Body (Messages) */
.chat-body {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: var(--chat-bg);
}

/* Scrollbar styling for chat body */
.chat-body::-webkit-scrollbar {
    width: 6px;
}
.chat-body::-webkit-scrollbar-thumb {
    background-color: #444;
    border-radius: 3px;
}

.chat-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease;
}

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

.chat-msg.agent {
    background-color: var(--chat-bubble-agent);
    color: #fff;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.chat-msg.user {
    background-color: var(--chat-bubble-user);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

/* Chat Options Container */
.chat-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 5px;
    animation: fadeIn 0.3s ease;
}

.chat-option-btn {
    background-color: transparent;
    border: 1px solid var(--chat-primary);
    color: var(--chat-primary);
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    text-align: left;
    transition: all 0.2s ease;
}

.chat-option-btn:hover {
    background-color: var(--chat-primary);
    color: #111;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 14px;
    background-color: var(--chat-primary);
    border-radius: 12px;
    border-bottom-left-radius: 2px;
    align-self: flex-start;
    width: fit-content;
    align-items: center;
}

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

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

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

/* Responsive */
@media (max-width: 400px) {
    .chat-window {
        width: calc(100% - 40px);
        height: calc(100vh - 120px);
    }
}
