:root {
    --chatbot-primary: #042c4e;
    --chatbot-secondary: #00aaff;
    --chatbot-white: #ffffff;
    --chatbot-light-bg: #f4f7f9;
    --chatbot-user-msg-bg: #00aaff;
    --chatbot-text-dark: #333;
    --chatbot-text-light: #f1f1f1;
}

.chatbot {
    font-family: 'Quicksand', sans-serif;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(0, 170, 255, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(0, 170, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 170, 255, 0); }
}

.chatbot-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(45deg, var(--chatbot-secondary), var(--chatbot-primary));
    color: var(--chatbot-white);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(4, 44, 78, 0.4);
    z-index: 9998;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: pulse 2s infinite 3s;
}

.chatbot-fab:hover {
    transform: scale(1.1);
    animation: none;
}

.chatbot-fab svg {
    transition: opacity 0.2s, transform 0.2s;
    position: absolute;
}
.chatbot-fab .icon-open {
    opacity: 0;
    transform: rotate(-90deg);
}
.chatbot-fab.active .icon-closed {
    opacity: 0;
    transform: rotate(90deg);
}
.chatbot-fab.active .icon-open {
    opacity: 1;
    transform: rotate(0deg);
}

@keyframes bubble-appear {
    0% { transform: translateY(10px) scale(0.8); opacity: 0; }
    80% { transform: translateY(-5px) scale(1.05); opacity: 1; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

.chatbot-fab-bubble {
    position: absolute;
    bottom: 70px;
    right: 0;
    padding: 10px 18px;
    background: var(--chatbot-white);
    color: var(--chatbot-primary);
    border-radius: 15px;
    border-bottom-right-radius: 2px;
    font-weight: 600;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform-origin: bottom right;
}

.chatbot-fab-bubble.active {
    visibility: visible;
    animation: bubble-appear 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) 1s forwards;
}

.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 370px;
    max-width: calc(100vw - 40px);
    height: 550px;
    max-height: calc(100vh - 120px);
    background: var(--chatbot-white);
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(4, 44, 78, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transform-origin: bottom right;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chatbot-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.chatbot-header {
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-secondary) 100%);
    color: var(--chatbot-white);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.chatbot-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.chatbot-avatar img { width: 100%; height: auto; }
.chatbot-title h3 { margin: 0; font-size: 1.1rem; font-weight: 700; }
.chatbot-title span { font-size: 0.8rem; opacity: 0.8; }
.chatbot-close-mobile { display: none; }

.chatbot-messages {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: var(--chatbot-light-bg);
    display: flex;
    flex-direction: column;
}

.message { display: flex; margin-bottom: 15px; max-width: 85%; }
.message-bubble { padding: 12px 18px; border-radius: 20px; line-height: 1.5; font-size: 0.9rem; }
.bot-message { align-self: flex-start; }
.bot-message .message-bubble { background: var(--chatbot-white); color: var(--chatbot-text-dark); border-bottom-left-radius: 5px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.bot-message a { color: var(--chatbot-secondary); font-weight: 600; text-decoration: none; }
.bot-message a:hover { text-decoration: underline; }

.user-message { align-self: flex-end; }
.user-message .message-bubble { background: var(--chatbot-user-msg-bg); color: var(--chatbot-white); border-bottom-right-radius: 5px; }

.typing-indicator { display: flex; align-items: center; padding: 12px 18px; }
.typing-indicator span { height: 8px; width: 8px; background-color: #bdc3c7; border-radius: 50%; display: inline-block; margin: 0 2px; animation: bounce 1.4s infinite ease-in-out both; }
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1.0); } }

.chatbot-suggestion-chips {
    padding: 0 15px 15px 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background: var(--chatbot-light-bg);
}

.chip {
    background: var(--chatbot-white);
    border: 1px solid #dce4e8;
    color: var(--chatbot-secondary);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.chip:hover {
    background: var(--chatbot-secondary);
    color: var(--chatbot-white);
    border-color: var(--chatbot-secondary);
    transform: translateY(-2px);
}

.chatbot-input-area {
    display: flex;
    padding: 15px 20px;
    border-top: 1px solid #eaf1f8;
    background: var(--chatbot-white);
    flex-shrink: 0;
}
#chatbot-input {
    flex-grow: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    font-family: 'Quicksand', sans-serif;
    background: transparent;
}
#chatbot-send {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: var(--chatbot-secondary);
}
#chatbot-send:hover { color: var(--chatbot-primary); }

@media (max-width: 480px) {
    .chatbot-window { width: 100%; height: 100%; max-height: 100%; bottom: 0; right: 0; border-radius: 0; }
    .chatbot-fab { bottom: 20px; right: 20px; }
    .chatbot-fab-bubble { display: none; }
    .chatbot-header .chatbot-close-mobile {
        display: block;
        margin-left: auto;
        background: none;
        border: none;
        color: var(--chatbot-white);
        font-size: 1.5rem;
        cursor: pointer;
        line-height: 1;
        opacity: 0.7;
        transition: opacity 0.2s;
    }
    .chatbot-header .chatbot-close-mobile:hover { opacity: 1; }
}