/* ==========================================================================
   Design Buzz Chatbot Widget
   ========================================================================== */

.chatbot-widget {
    position: fixed;
    right: 2rem;
    bottom: 2rem;
    z-index: 1150;
    font-family: var(--font-body);
    transition: bottom 0.22s ease;
}

body.back-to-top-visible .chatbot-widget {
    bottom: 6rem;
}

.chatbot-launcher {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    background: linear-gradient(145deg, var(--accent), var(--accent-light));
    color: var(--primary-dark);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.55rem;
    box-shadow: 0 8px 26px rgba(230, 126, 34, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chatbot-launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(230, 126, 34, 0.42);
}

.chatbot-panel {
    position: absolute;
    right: 0;
    bottom: 72px;
    width: min(380px, calc(100vw - 2rem));
    height: 560px;
    border: 1px solid rgba(230, 126, 34, 0.32);
    background: linear-gradient(180deg, rgba(12, 12, 14, 0.98), rgba(17, 17, 21, 0.98));
    box-shadow: 0 24px 44px rgba(0, 0, 0, 0.5);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(8px) scale(0.98);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

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

.chatbot-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1rem 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(24, 24, 30, 0.94);
}

.chatbot-title {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text);
}

.chatbot-subtitle {
    margin-top: 0.3rem;
    margin-bottom: 0;
    font-size: 0.75rem;
    color: var(--text-light);
    line-height: 1.4;
}

.chatbot-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    color: var(--text-light);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}

.chatbot-close:hover {
    border-color: rgba(230, 126, 34, 0.7);
    color: var(--accent);
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.9rem 0.9rem 0.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.chatbot-row {
    display: flex;
}

.chatbot-row.user {
    justify-content: flex-end;
}

.chatbot-row.assistant,
.chatbot-row.system {
    justify-content: flex-start;
}

.chatbot-bubble {
    max-width: 86%;
    padding: 0.62rem 0.72rem;
    border-radius: 12px;
    font-size: 0.86rem;
    line-height: 1.5;
    word-wrap: break-word;
    margin-bottom: 0;
}

.chatbot-row.user .chatbot-bubble {
    background: var(--accent);
    color: var(--primary-dark);
    border-bottom-right-radius: 4px;
}

.chatbot-row.assistant .chatbot-bubble,
.chatbot-row.system .chatbot-bubble {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    border-bottom-left-radius: 4px;
}

.chatbot-row.system .chatbot-bubble {
    border: 1px dashed rgba(230, 126, 34, 0.45);
    background: rgba(230, 126, 34, 0.09);
    color: #f7d7b2;
}

.chatbot-typing {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    min-width: 58px;
    padding: 0.58rem 0.72rem;
}

.chatbot-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.75);
    animation: chatbotTypingPulse 1.1s infinite ease-in-out;
}

.chatbot-typing-dot:nth-child(2) {
    animation-delay: 0.12s;
}

.chatbot-typing-dot:nth-child(3) {
    animation-delay: 0.24s;
}

@keyframes chatbotTypingPulse {
    0%,
    80%,
    100% {
        opacity: 0.35;
        transform: translateY(0);
    }
    40% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

.chatbot-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin: 0.25rem 0 0.45rem;
}

.chatbot-chip {
    border: 1px solid rgba(230, 126, 34, 0.6);
    background: rgba(230, 126, 34, 0.1);
    color: var(--accent-light);
    border-radius: 999px;
    padding: 0.35rem 0.72rem;
    font-size: 0.73rem;
    letter-spacing: 0.03em;
    cursor: pointer;
}

.chatbot-chip:hover {
    background: rgba(230, 126, 34, 0.2);
}

.chatbot-lead-card {
    margin-top: 0.5rem;
    border: 1px solid rgba(230, 126, 34, 0.45);
    background: rgba(17, 17, 21, 0.9);
    border-radius: 12px;
    padding: 0.65rem;
}

.chatbot-lead-card h4 {
    margin: 0 0 0.55rem;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--accent-light);
}

.chatbot-lead-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.45rem;
}

.chatbot-input,
.chatbot-textarea {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    border-radius: 8px;
    padding: 0.52rem 0.62rem;
    font-size: 0.82rem;
}

.chatbot-input:focus,
.chatbot-textarea:focus {
    outline: none;
    border-color: rgba(230, 126, 34, 0.9);
    box-shadow: 0 0 0 2px rgba(230, 126, 34, 0.2);
}

.chatbot-checkbox {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--text-light);
    font-size: 0.73rem;
}

.chatbot-lead-actions {
    margin-top: 0.45rem;
    display: flex;
    justify-content: flex-end;
}

.chatbot-small-btn {
    border: 1px solid var(--accent);
    background: var(--accent);
    color: var(--primary-dark);
    border-radius: 999px;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.4rem 0.8rem;
    cursor: pointer;
}

.chatbot-small-btn:hover {
    background: var(--accent-light);
    border-color: var(--accent-light);
}

.chatbot-status {
    margin-top: 0.5rem;
    margin-bottom: 0;
    font-size: 0.72rem;
    color: var(--text-light);
}

.chatbot-cta-row {
    padding: 0.45rem 0.7rem 0.1rem;
    display: flex;
    justify-content: flex-end;
    background: rgba(24, 24, 30, 0.95);
}

.chatbot-cta-btn {
    border: 1px solid rgba(230, 126, 34, 0.58);
    background: rgba(230, 126, 34, 0.1);
    color: var(--accent-light);
    border-radius: 999px;
    font-size: 0.68rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.34rem 0.64rem;
    cursor: pointer;
}

.chatbot-cta-btn:hover {
    background: rgba(230, 126, 34, 0.2);
}

.chatbot-cta-btn.is-active,
.chatbot-cta-btn:disabled {
    border-color: rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-light);
    cursor: default;
}

.chatbot-composer {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.7rem;
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    background: rgba(24, 24, 30, 0.95);
}

.chatbot-composer textarea {
    flex: 1;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    padding: 0.58rem 0.65rem;
    line-height: 1.4;
    font-size: 0.86rem;
}

.chatbot-composer textarea:focus {
    outline: none;
    border-color: rgba(230, 126, 34, 0.9);
}

.chatbot-send {
    border: 1px solid var(--accent);
    background: var(--accent);
    color: var(--primary-dark);
    border-radius: 10px;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    min-width: 78px;
    height: 44px;
    cursor: pointer;
}

.chatbot-send:hover {
    background: var(--accent-light);
    border-color: var(--accent-light);
}

.chatbot-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

@media (max-width: 900px) {
    .chatbot-widget {
        right: 1rem;
    }

    body.back-to-top-visible .chatbot-widget {
        bottom: 5.4rem;
    }

    .chatbot-panel {
        width: min(360px, calc(100vw - 1rem));
    }
}

@media (max-width: 680px) {
    .chatbot-widget {
        right: 0.85rem;
    }

    body.back-to-top-visible .chatbot-widget {
        bottom: 5.2rem;
    }

    .chatbot-panel {
        width: calc(100vw - 1.7rem);
        height: 72vh;
        max-height: 620px;
        bottom: 66px;
    }
}
