/**
 * Medical Chatbot Frontend Widget Styles
 */

:root {
    --mcb-primary: #0073aa;
}

#mcb-chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

/* Toggle Button */
#mcb-chat-toggle {
    width: 56px !important;
    height: 56px !important;
    min-width: 56px !important;
    min-height: 56px !important;
    max-width: 56px !important;
    max-height: 56px !important;
    border-radius: 50% !important;
    background: var(--mcb-primary) !important;
    color: #fff !important;
    border: none !important;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: absolute;
    bottom: 0;
    right: 0;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
}

#mcb-chat-toggle svg {
    fill: none !important;
    stroke: #fff !important;
    width: 24px !important;
    height: 24px !important;
}

#mcb-chat-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25) !important;
}

#mcb-chat-toggle:focus {
    outline: 2px solid var(--mcb-primary);
    outline-offset: 2px;
}

/* Chat Window */
#mcb-chat-window {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 370px;
    height: 520px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: mcb-slide-up 0.3s ease;
}

@keyframes mcb-slide-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
#mcb-chat-header {
    background: var(--mcb-primary);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

#mcb-chat-title {
    font-weight: 600;
    font-size: 15px;
}

#mcb-chat-minimize {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

#mcb-chat-minimize:hover {
    opacity: 1;
}

/* Messages Area */
#mcb-chat-messages {
    flex: 1;
    overflow-y: scroll !important;
    padding: 16px;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Message Bubbles */
.mcb-message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.mcb-message-user {
    background: var(--mcb-primary);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.mcb-message-bot {
    background: #f0f2f5;
    color: #1a1a1a;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.mcb-message-bot hr {
    border: none;
    border-top: 1px solid #d0d0d0;
    margin: 8px 0;
}

.mcb-message-bot em {
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

/* Typing Indicator */
.mcb-typing {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    background: #f0f2f5;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    max-width: 60px;
}

.mcb-typing-dot {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: mcb-bounce 1.4s infinite ease-in-out;
}

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

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

/* Input Area */
#mcb-chat-input-area {
    display: flex;
    padding: 12px;
    border-top: 1px solid #e5e5e5;
    gap: 8px;
    align-items: flex-end;
    flex-shrink: 0;
}

#mcb-chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 80px;
    outline: none;
    transition: border-color 0.2s;
}

#mcb-chat-input:focus {
    border-color: var(--mcb-primary);
}

#mcb-chat-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--mcb-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.2s;
}

#mcb-chat-send:hover {
    opacity: 0.9;
}

#mcb-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Sources */
.mcb-sources {
    margin-top: 8px;
    font-size: 12px;
}

.mcb-sources a {
    color: var(--mcb-primary);
    text-decoration: none;
}

.mcb-sources a:hover {
    text-decoration: underline;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #mcb-chat-window {
        width: calc(100vw - 24px);
        height: calc(100vh - 100px);
        right: -8px;
        bottom: 65px;
    }

    #mcb-chatbot-container {
        bottom: 12px;
        right: 12px;
    }
}
