/* chatbot-widget.css — custom floating support chat (replaces the embedded
   DigitalOcean widget script). Brand colours match static/css/base.css
   (--color-primary #1a5632). */

.bf-chat {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 9999;
    font-family: var(--font-primary, -apple-system, sans-serif);
}

.bf-chat__toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: #1a5632;
    color: #fff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
}

.bf-chat__toggle:hover {
    background: #2a7a4a;
    transform: scale(1.05);
}

.bf-chat__greeting {
    position: absolute;
    right: 0;
    bottom: 68px;
    max-width: 220px;
    background: #fff;
    color: #1e293b;
    padding: 0.65rem 1.9rem 0.65rem 0.9rem;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    cursor: pointer;
    animation: bf-chat-greeting-in 0.3s ease-out;
}

.bf-chat__greeting::after {
    content: '';
    position: absolute;
    right: 20px;
    bottom: -8px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #fff;
}

.bf-chat__greeting-text {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.4;
}

.bf-chat__greeting-close {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.bf-chat__greeting-close:hover {
    background: #f1f5f9;
    color: #1e293b;
}

@keyframes bf-chat-greeting-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.bf-chat__icon-close {
    display: none;
}

.bf-chat__toggle[aria-expanded="true"] .bf-chat__icon-open {
    display: none;
}

.bf-chat__toggle[aria-expanded="true"] .bf-chat__icon-close {
    display: block;
}

.bf-chat__panel {
    position: absolute;
    right: 0;
    bottom: 68px;
    width: 340px;
    max-width: calc(100vw - 2rem);
    height: 480px;
    max-height: calc(100vh - 8rem);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.bf-chat__header {
    background: #1a5632;
    color: #fff;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

.bf-chat__logo {
    width: 24px;
    height: 24px;
    border-radius: 4px;
}

.bf-chat__title {
    font-weight: 600;
    font-size: 0.95rem;
}

.bf-chat__header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.15rem;
    flex-shrink: 0;
}

.bf-chat__icon-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #fff;
    opacity: 0.75;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.bf-chat__icon-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.15);
}

.bf-chat__messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    background: #f7f8fa;
}

.bf-chat__msg {
    max-width: 85%;
    padding: 0.5rem 0.75rem;
    border-radius: 10px;
    font-size: 0.88rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.bf-chat__msg--assistant {
    align-self: flex-start;
    background: #E5E8ED;
    color: #1e293b;
    border-bottom-left-radius: 2px;
}

.bf-chat__msg--assistant a {
    color: #1a5632;
    font-weight: 600;
}

.bf-chat__msg--assistant a:hover {
    text-decoration: underline;
}

.bf-chat__msg--user {
    align-self: flex-end;
    background: #1a5632;
    color: #fff;
    border-bottom-right-radius: 2px;
}

.bf-chat__msg--error {
    align-self: flex-start;
    background: #fde8e8;
    color: #9b1c1c;
    border-bottom-left-radius: 2px;
}

.bf-chat__msg--pending {
    align-self: flex-start;
    background: #E5E8ED;
    color: #667;
    font-style: italic;
}

.bf-chat__form {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
    background: #fff;
}

.bf-chat__input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    padding: 0.5rem 0.9rem;
    font-size: 0.88rem;
    outline: none;
}

.bf-chat__input:focus {
    border-color: #1a5632;
}

.bf-chat__send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #1a5632;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.bf-chat__send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 480px) {
    .bf-chat__panel {
        width: calc(100vw - 2rem);
        height: calc(100vh - 8rem);
    }
}
