/* =========================================================
   BBAC Rules Chatbot — Stylesheet
   Author: Paul Forrest  |  Version: 1.0.0
   ========================================================= */

/* Wrapper */
.bbac-chat-wrap {
    max-width: 540px;
    margin: 0 auto;
    font-family: inherit;
    display: flex;
    flex-direction: column;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,0.09);
    background: #ffffff;
}

/* Header */
.bbac-chat-header {
    background: #1a3a6e;
    color: #ffffff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.bbac-chat-icon {
    font-size: 1.6em;
    line-height: 1;
    flex-shrink: 0;
}

.bbac-chat-title {
    font-weight: 700;
    font-size: 1em;
    line-height: 1.2;
}

.bbac-chat-subtitle {
    font-size: 0.78em;
    opacity: 0.82;
    margin-top: 2px;
}

/* Message area */
.bbac-chat-messages {
    flex: 1;
    min-height: 320px;
    max-height: 420px;
    overflow-y: auto;
    padding: 16px 14px 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8f9fa;
}

/* Individual messages */
.bbac-chat-msg {
    display: flex;
    max-width: 88%;
}

.bbac-chat-msg--bot {
    align-self: flex-start;
}

.bbac-chat-msg--user {
    align-self: flex-end;
}

.bbac-chat-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.88em;
    line-height: 1.55;
    word-break: break-word;
}

.bbac-chat-msg--bot .bbac-chat-bubble {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-bottom-left-radius: 4px;
    color: #212529;
}

.bbac-chat-msg--user .bbac-chat-bubble {
    background: #1a3a6e;
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

/* Suggestion chips */
.bbac-chat-suggestion {
    display: inline-block;
    margin: 3px 4px 3px 0;
    padding: 4px 10px;
    background: #e8f0fe;
    border: 1px solid #b3c8f5;
    border-radius: 20px;
    font-size: 0.83em;
    color: #1a3a6e;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}

.bbac-chat-suggestion:hover {
    background: #c5d9f7;
}

/* Typing indicator */
.bbac-chat-typing {
    padding: 6px 14px 2px;
    background: #f8f9fa;
}

.bbac-chat-typing .bbac-chat-bubble {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 10px 14px;
}

.bbac-typing-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #adb5bd;
    animation: bbac-bounce 1.2s infinite ease-in-out;
}

.bbac-typing-dot:nth-child(1) { animation-delay: 0s; }
.bbac-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.bbac-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes bbac-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
    40%            { transform: translateY(-6px); opacity: 1; }
}

/* Input row */
.bbac-chat-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #dee2e6;
    background: #ffffff;
}

.bbac-chat-input {
    flex: 1;
    border: 1px solid #ced4da;
    border-radius: 24px;
    padding: 9px 16px;
    font-size: 0.9em;
    color: #212529;
    background: #fff;
    outline: none;
    transition: border-color 0.15s;
}

.bbac-chat-input:focus {
    border-color: #1a3a6e;
    box-shadow: 0 0 0 3px rgba(26,58,110,0.1);
}

.bbac-chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #1a3a6e;
    color: #ffffff;
    font-size: 1em;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.bbac-chat-send:hover  { background: #14306b; }
.bbac-chat-send:active { background: #0f2450; }
.bbac-chat-send:disabled {
    background: #adb5bd;
    cursor: not-allowed;
}

/* Footer */
.bbac-chat-footer {
    padding: 8px 14px;
    background: #f1f3f5;
    border-top: 1px solid #dee2e6;
    font-size: 0.72em;
    color: #6c757d;
    text-align: center;
    line-height: 1.4;
}

/* Error bubble */
.bbac-chat-bubble--error {
    background: #fff3cd !important;
    border-color: #ffc107 !important;
    color: #856404 !important;
}

/* Markdown-style formatting in bot bubbles */
.bbac-chat-msg--bot .bbac-chat-bubble strong { color: #1a3a6e; }
.bbac-chat-msg--bot .bbac-chat-bubble ul,
.bbac-chat-msg--bot .bbac-chat-bubble ol {
    margin: 6px 0 4px 16px;
    padding: 0;
}
.bbac-chat-msg--bot .bbac-chat-bubble li { margin-bottom: 3px; }
.bbac-chat-msg--bot .bbac-chat-bubble p  { margin: 0 0 6px; }
.bbac-chat-msg--bot .bbac-chat-bubble p:last-child { margin-bottom: 0; }

/* Responsive */
@media (max-width: 480px) {
    .bbac-chat-messages { min-height: 260px; max-height: 340px; }
    .bbac-chat-suggestion { white-space: normal; }
}
