/* ── Liberty Roofing Chatbot ──────────────────────────────── */

.lb-chat {
    --cb-navy: #1B3A5C;
    --cb-navy-dark: #122842;
    --cb-red: #C41E3A;
    --cb-gold: #D4A843;
    --cb-white: #ffffff;
    --cb-off-white: #F7F5F2;
    --cb-gray: #6B7280;
    --cb-radius: 16px;
    --cb-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    font-family: 'Open Sans', system-ui, -apple-system, sans-serif;
    position: fixed;
    bottom: 0;
    right: 0;
    z-index: 9999;
}

/* ── FAB (Floating Action Button) ────────────────────────── */

.lb-chat__fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--cb-red);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 24px rgba(196, 30, 58, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    z-index: 10000;
}

.lb-chat__fab:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 32px rgba(196, 30, 58, 0.5);
}

.lb-chat__fab-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--cb-gold);
    color: var(--cb-navy-dark);
    font-size: 12px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: lb-pulse 2s ease-in-out infinite;
}

@keyframes lb-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* ── Chat Window ─────────────────────────────────────────── */

.lb-chat__window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 540px;
    max-height: calc(100vh - 140px);
    background: var(--cb-white);
    border-radius: var(--cb-radius);
    box-shadow: var(--cb-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 10001;
}

.lb-chat__window--open {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* ── Header ──────────────────────────────────────────────── */

.lb-chat__header {
    background: var(--cb-navy);
    color: var(--cb-white);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.lb-chat__header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lb-chat__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.lb-chat__header-info strong {
    display: block;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
}

.lb-chat__status {
    display: block;
    font-size: 0.72rem;
    opacity: 0.75;
    margin-top: 1px;
}

.lb-chat__close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}

.lb-chat__close:hover {
    color: var(--cb-white);
    background: rgba(255, 255, 255, 0.1);
}

/* ── Body (Messages) ─────────────────────────────────────── */

.lb-chat__body {
    flex: 1;
    overflow-y: auto;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--cb-off-white);
    scroll-behavior: smooth;
}

.lb-chat__body::-webkit-scrollbar {
    width: 5px;
}

.lb-chat__body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
}

/* ── Messages ────────────────────────────────────────────── */

.lb-msg {
    display: flex;
    animation: lb-fadeIn 0.3s ease;
}

@keyframes lb-fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.lb-msg--bot {
    justify-content: flex-start;
}

.lb-msg--user {
    justify-content: flex-end;
}

.lb-msg__bubble {
    max-width: 82%;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.lb-msg__bubble--bot {
    background: var(--cb-white);
    color: var(--cb-navy-dark);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.lb-msg__bubble--bot a {
    color: var(--cb-gold);
    text-decoration: underline;
}

.lb-msg__bubble--user {
    background: var(--cb-navy);
    color: var(--cb-white);
    border-bottom-right-radius: 4px;
}

/* ── Typing Indicator ────────────────────────────────────── */

.lb-msg__typing {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 14px 20px;
}

.lb-msg__typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--cb-gray);
    opacity: 0.5;
    animation: lb-typingDot 1.4s ease-in-out infinite;
}

.lb-msg__typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.lb-msg__typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes lb-typingDot {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-4px); }
}

/* ── Footer (Options / Input) ────────────────────────────── */

.lb-chat__footer {
    flex-shrink: 0;
    padding: 12px 14px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    background: var(--cb-white);
    min-height: 20px;
}

/* ── Option Buttons ──────────────────────────────────────── */

.lb-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.lb-options__btn {
    padding: 9px 16px;
    border-radius: 20px;
    border: 1.5px solid var(--cb-navy);
    background: var(--cb-white);
    color: var(--cb-navy);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.lb-options__btn:hover {
    background: var(--cb-navy);
    color: var(--cb-white);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(27, 58, 92, 0.25);
}

/* ── Text Input ──────────────────────────────────────────── */

.lb-input-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.lb-input {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid #ddd;
    border-radius: 10px;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.lb-input:focus {
    border-color: var(--cb-navy);
}

.lb-input-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--cb-red);
    color: var(--cb-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.2s;
}

.lb-input-send:hover {
    background: #a8182f;
    transform: scale(1.05);
}

.lb-input-skip {
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid #ddd;
    background: var(--cb-white);
    color: var(--cb-gray);
    font-size: 0.8rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
}

.lb-input-skip:hover {
    background: var(--cb-off-white);
    color: var(--cb-navy);
}

/* ── Mobile ──────────────────────────────────────────────── */

@media (max-width: 480px) {
    .lb-chat__window {
        bottom: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        max-width: 100vw;
        border-radius: 0;
    }

    .lb-chat__fab {
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
    }
}
