.lf-chat-section {
    margin-top: 2rem;
    padding: 1.5rem;
    border-radius: 1.5rem;
    border: 1px solid var(--border-color, #e2e8f0);
    background:
        radial-gradient(circle at 92% 8%, rgba(14, 165, 233, 0.12), transparent 38%),
        radial-gradient(circle at 6% 92%, rgba(59, 130, 246, 0.11), transparent 40%),
        #ffffff;
    box-shadow: var(--shadow-sm, 0 1px 2px 0 rgb(0 0 0 / 0.05));
}

.lf-chat-section.floating-widget {
    position: fixed;
    right: 20px;
    bottom: 92px;
    z-index: 1200;
    width: min(390px, calc(100vw - 28px));
    max-height: min(74vh, 660px);
    margin: 0;
    padding: 1rem;
    border-radius: 1rem;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.24);
    display: flex;
    flex-direction: column;
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform-origin: bottom right;
    overflow: visible;
}

.lf-chat-section.floating-widget.collapsed {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
    pointer-events: none;
}

.lf-chat-section.floating-widget.is-open {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.lf-chat-section.floating-widget .lf-chat-messages {
    flex: 1;
    min-height: 220px;
    max-height: none;
}

.lf-chat-section.floating-widget .lf-chat-chip-row {
    margin-bottom: 0.75rem;
}

.lf-chat-section.floating-widget .lf-chat-form {
    margin-top: 0.75rem;
}

.lf-chat-section.floating-widget .lf-chat-title {
    padding-right: 2.2rem;
}

.lf-chat-eyebrow {
    margin: 0 0 0.35rem;
    font-size: 0.72rem;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    color: #0b6fa1;
    font-weight: 700;
}

.lf-chat-title {
    margin: 0;
    font-size: 1.4rem;
    color: var(--text-primary, #0f172a);
}

.lf-chat-subtitle {
    margin: 0.55rem 0 1rem;
    color: var(--text-secondary, #64748b);
    line-height: 1.55;
}

.lf-chat-toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-bottom: 0.95rem;
}

.lf-chat-toolbar:empty {
    display: none;
    margin: 0;
}

.lf-chat-btn {
    border: 1px solid var(--border-color, #e2e8f0);
    background: #ffffff;
    border-radius: 0.75rem;
    min-height: 2.4rem;
    padding: 0 0.9rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
    cursor: pointer;
    transition: all 0.2s ease;
}

.lf-chat-btn:hover {
    background: #f1f5f9;
}

.lf-chat-btn:disabled,
.lf-chat-send:disabled,
.lf-chat-chip:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.lf-chat-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.lf-chat-chip {
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
    border-radius: 999px;
    padding: 0.38rem 0.78rem;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lf-chat-chip:hover {
    transform: translateY(-1px);
    background: #dbeafe;
}

.lf-chat-messages {
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 1rem;
    padding: 1rem;
    max-height: 390px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.92);
}

.lf-chat-message {
    display: flex;
    margin-bottom: 0.7rem;
}

.lf-chat-message:last-child {
    margin-bottom: 0;
}

.lf-chat-message.user {
    justify-content: flex-end;
}

.lf-chat-bubble {
    max-width: min(88%, 760px);
    padding: 0.72rem 0.88rem;
    border-radius: 1rem;
    border: 1px solid #dbe2ea;
    background: #f8fafc;
    color: var(--text-primary, #1e293b);
    font-size: 0.92rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

.lf-chat-message.user .lf-chat-bubble {
    background: #0f172a;
    color: #ffffff;
    border-color: #0f172a;
    border-bottom-right-radius: 0.4rem;
}

.lf-chat-message.assistant .lf-chat-bubble {
    border-bottom-left-radius: 0.4rem;
}

.lf-chat-message.system .lf-chat-bubble {
    border-color: #fecaca;
    background: #fff1f2;
    color: #9f1239;
}

.lf-chat-bubble.typing-bubble {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 62px;
    min-height: 2.25rem;
}

.lf-chat-dot {
    width: 0.42rem;
    height: 0.42rem;
    border-radius: 999px;
    background: #94a3b8;
    opacity: 0.32;
    animation: lfChatDotPulse 1s ease-in-out infinite;
}

.lf-chat-dot:nth-child(2) {
    animation-delay: 0.16s;
}

.lf-chat-dot:nth-child(3) {
    animation-delay: 0.32s;
}

@keyframes lfChatDotPulse {

    0%,
    80%,
    100% {
        opacity: 0.32;
        transform: translateY(0);
    }

    40% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

.lf-chat-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.65rem;
    margin-top: 0.95rem;
}

.lf-chat-input {
    width: 100%;
    min-height: 2.8rem;
    max-height: 9rem;
    resize: vertical;
    text-align: left !important;
    border: 1px solid #cbd5e1;
    border-radius: 0.75rem;
    padding: 0.65rem 0.75rem;
    font-size: 0.92rem;
    color: var(--text-primary, #1e293b);
    background: #ffffff;
    font-family: var(--font-body, 'Inter', sans-serif);
}

.lf-chat-send {
    border: 1px solid var(--primary-color, #0f172a);
    background: var(--primary-color, #0f172a);
    color: #ffffff;
    border-radius: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    min-width: 96px;
    padding: 0 1rem;
    transition: opacity 0.2s ease;
}

.lf-chat-send.loading {
    color: transparent;
    position: relative;
}

.lf-chat-send.loading::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0.92rem;
    height: 0.92rem;
    margin-left: -0.46rem;
    margin-top: -0.46rem;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #ffffff;
    border-radius: 999px;
    animation: lfChatSpin 0.72s linear infinite;
}

@keyframes lfChatSpin {
    to {
        transform: rotate(360deg);
    }
}

.lf-chat-status {
    margin: 0.68rem 0 0;
    font-size: 0.82rem;
    color: var(--text-secondary, #64748b);
    min-height: 1.15rem;
}

.lf-chat-status.error {
    color: #b91c1c;
}

.lf-chat-minimize {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 2;
}

.lf-chat-minimize:hover {
    background: #f1f5f9;
}

.lf-chat-launcher {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 62px;
    height: 62px;
    border-radius: 999px;
    border: 1px solid #0f172a;
    background: linear-gradient(135deg, #0f172a, #1e3a8a);
    color: #ffffff;
    font-weight: 800;
    font-size: 0.92rem;
    letter-spacing: 0.04em;
    box-shadow: 0 14px 26px rgba(15, 23, 42, 0.34);
    cursor: pointer;
    z-index: 1210;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.lf-chat-launcher:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 18px 32px rgba(15, 23, 42, 0.38);
}

.lf-chat-launcher.hidden {
    opacity: 0;
    transform: scale(0.85);
    pointer-events: none;
}

.lf-chat-launcher-hint {
    position: fixed;
    right: 94px;
    bottom: 28px;
    max-width: min(320px, calc(100vw - 130px));
    background: #ffffff;
    color: #0f172a;
    border: 1px solid #dbe2ea;
    border-radius: 0.9rem;
    padding: 0.62rem 0.78rem;
    font-size: 0.83rem;
    line-height: 1.4;
    white-space: pre-line;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.18);
    z-index: 1209;
    opacity: 0;
    transform: translateX(10px);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.lf-chat-launcher-hint::after {
    content: "";
    position: absolute;
    right: -7px;
    top: 50%;
    width: 12px;
    height: 12px;
    margin-top: -6px;
    background: #ffffff;
    border-top: 1px solid #dbe2ea;
    border-right: 1px solid #dbe2ea;
    transform: rotate(45deg);
}

.lf-chat-launcher-hint.show {
    opacity: 1;
    transform: translateX(0);
}

@media (max-width: 768px) {
    .lf-chat-section {
        padding: 1rem;
        border-radius: 1rem;
    }

    .lf-chat-form {
        grid-template-columns: 1fr;
    }

    .lf-chat-send {
        min-height: 2.7rem;
    }

    .lf-chat-bubble {
        max-width: 100%;
    }

    .lf-chat-btn {
        width: 100%;
    }

    .lf-chat-section.floating-widget {
        right: 12px;
        left: 12px;
        width: auto;
        bottom: 82px;
        max-height: min(72vh, 620px);
    }

    .lf-chat-launcher {
        right: 12px;
        bottom: 12px;
        width: 58px;
        height: 58px;
    }

    .lf-chat-launcher-hint {
        right: 78px;
        bottom: 22px;
        max-width: min(260px, calc(100vw - 92px));
        font-size: 0.79rem;
    }
}
