/* AI Chatbot Styles */
:root {
    --ai-primary: #6c5ce7;
    --ai-secondary: #a29bfe;
    --ai-bg: #dfe6e9;
    --ai-text: #2d3436;
    --user-msg-bg: #0984e3;
    --bot-msg-bg: #ffffff;
}

.chatbot-toggler {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: var(--ai-primary);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    z-index: 1000;
    border: none;
    outline: none;
}

.chatbot-toggler:hover {
    transform: scale(1.1);
}

.chatbot-toggler span {
    color: white;
    font-size: 1.8rem;
    position: absolute;
}

.chatbot {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 550px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.5);
    transform-origin: bottom right;
    transition: all 0.3s ease;
    z-index: 1001;
    display: flex;
    flex-direction: column;
}

body.show-chatbot .chatbot {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}

.chatbot header {
    background: linear-gradient(135deg, var(--ai-primary), var(--ai-secondary));
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
}

.chatbot header h2 {
    font-size: 1.2rem;
    font-family: 'Inter', sans-serif;
    margin: 0;
}

.chatbot header span {
    cursor: pointer;
    font-size: 1.5rem;
}

.chatbox {
    overflow-y: auto;
    padding: 20px;
    flex-grow: 1;
    background: var(--ai-bg);
    font-family: 'Inter', sans-serif;
    padding-bottom: 0;
}

.chatbox .chat {
    display: flex;
    list-style: none;
    margin-bottom: 15px;
}

.chatbox .chat p {
    white-space: pre-wrap;
    padding: 12px 16px;
    border-radius: 10px 10px 0 10px;
    max-width: 85%;
    font-size: 0.95rem;
    line-height: 1.4;
}

.chatbox .chat-incoming p {
    background: var(--bot-msg-bg);
    color: var(--ai-text);
    border-radius: 10px 10px 10px 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.chatbox .chat-outgoing {
    justify-content: flex-end;
}

.chatbox .chat-outgoing p {
    background: var(--user-msg-bg);
    color: white;
    border-radius: 10px 10px 0 10px;
}

/* Chat Options */
.chat-options {
    padding: 10px 20px;
    background: var(--ai-bg);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 120px;
    overflow-y: auto;
}

.option-btn {
    background: white;
    border: 1px solid var(--ai-primary);
    color: var(--ai-primary);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
}

.option-btn:hover {
    background: var(--ai-primary);
    color: white;
}

.chat-input {
    display: flex;
    gap: 5px;
    padding: 10px 20px;
    border-top: 1px solid #ddd;
    background: white;
}

.chat-input textarea {
    height: 45px;
    width: 100%;
    border: none;
    outline: none;
    resize: none;
    padding: 12px 0;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
}

.chat-input span {
    align-self: flex-end;
    color: var(--ai-primary);
    cursor: pointer;
    font-size: 1.35rem;
    height: 45px;
    display: flex;
    align-items: center;
}

/* Crisis Mode */
.crisis-alert {
    background: #ffebee !important;
    border: 2px solid #d32f2f !important;
    color: #c62828 !important;
}

@media (max-width: 490px) {
    .chatbot {
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .chatbot-toggler {
        bottom: 20px;
        right: 20px;
    }

    .chatbox {
        height: 90%;
    }
}