/* Floating chat widget */

.floating-chat {
    background: rgba(244, 243, 237, 1);
    opacity: 0.9;
    border-radius: 20px;
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
}

.floating-chat-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    padding: 0 1.25rem;
    border-radius: 999px;
    border-width: 1px;
    border-style: solid;
    font-weight: 600;
    transition: transform 150ms ease, box-shadow 150ms ease, filter 150ms ease;
}

.floating-chat-toggle:hover {
    transform: translateY(-1px);
}

.floating-chat-panel {
    width: min(360px, calc(100vw - 2rem));
    max-height: 70vh;
    border-width: 1px;
    border-style: solid;
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: rgb(var(--surface-1));
    border-color: black;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.1);
}

.floating-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom-width: 1px;
    border-bottom-style: solid;
    background-color: rgb(var(--surface-2));
    border-bottom-color: var(--border-default);
}

.floating-chat-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: black;
}

.floating-chat-toggle-button {
    border: 0;
    background: transparent;
    color: black;
    font-size: 1rem;
    line-height: 1;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
}

    .floating-chat-toggle-button:hover {
        color: black;
        background-color: rgba(0, 0, 0, 0.04);
    }

.floating-chat--collapsed .floating-chat-messages,
.floating-chat--collapsed .floating-chat-composer,
.floating-chat--collapsed .floating-chat-status {
    display: none;
}

.floating-chat-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.floating-chat-new-btn {
    border-radius: 999px;
    padding: 0.25rem 0.75rem;
    border-width: 1px;
    border-style: solid;
    font-size: 0.75rem;
}

.floating-chat-close {
    border: 0;
    font-size: 0.9rem;
    line-height: 1;
}

.floating-chat-status {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-bottom-width: 1px;
    border-bottom-style: solid;
    border-bottom-color: var(--border-default);
    color: black;
    background-color: rgb(var(--surface-2));
}

.floating-chat-messages {
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1 1 auto;
    min-height: 0;
    overscroll-behavior: contain;
    background-color: rgb(var(--surface-1));
}

.floating-chat-message {
    border-radius: 14px;
    padding: 0.75rem 0.9rem;
    border-width: 1px;
    border-style: solid;
    background-color: rgb(var(--surface-2));
    border-color: var(--border-default);
    color: black;
}

    .floating-chat-message header {
        font-size: 0.7rem;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        margin-bottom: 0.35rem;
        color: black;
    }

.floating-chat-message p,
.floating-chat-message ul {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.4;
}

.floating-chat-message ul {
    padding-left: 1rem;
}

.floating-chat-message-user {
    background-color: rgba(var(--color-brand-900), 0.06);
    border-color: var(--border-default);
}

.floating-chat-message-ai {
    background-color: rgb(var(--surface-2));
    border-color: var(--border-default);
}

.floating-chat-message a {
    color: rgb(var(--text-link));
}

.floating-chat-message a:hover {
    color: rgb(var(--text-link-hover));
}

.floating-chat-empty {
    border-radius: 14px;
    padding: 1rem;
    text-align: left;
    border-width: 1px;
    border-style: dashed;
    color: black;
    border-color: var(--border-default);
    background-color: rgb(var(--surface-2));
}

    .floating-chat-empty h3 {
        margin: 0 0 0.35rem 0;
        font-size: 0.95rem;
        color: black;
    }

    .floating-chat-empty p {
        margin: 0;
        font-size: 0.85rem;
        color: black;
    }

.floating-chat-composer {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1rem 1rem;
    border-top-width: 1px;
    border-top-style: solid;
    border-top-color: var(--border-default);
    background-color: rgb(var(--surface-2));
}

    .floating-chat-composer textarea {
        flex: 1 1 auto;
        border-width: 1px;
        border-style: solid;
        border-radius: 12px;
        padding: 0.5rem 0.75rem;
        font-size: 16px;
        line-height: 1.35;
        resize: none;
        border-color: var(--border-default);
        background-color: rgb(var(--surface-1));
        color: black;
    }

.floating-chat-input--disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.floating-chat-composer button {
    border-radius: 12px;
    border-width: 1px;
    border-style: solid;
    padding: 0 0.9rem;
    font-weight: 600;
    background-color: rgb(var(--interactive-primary));
    color: black;
    border-color: rgb(var(--interactive-primary));
}

.floating-chat-composer button:hover {
    background-color: rgb(var(--interactive-primary-hover));
    border-color: rgb(var(--interactive-primary-hover));
}

.floating-chat-send--disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.floating-chat-thinking-row {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.floating-chat-dots {
    display: inline-flex;
    gap: 0.25rem;
}

    .floating-chat-dots i {
        width: 6px;
        height: 6px;
        border-radius: 999px;
        display: inline-block;
        animation: floating-chat-pulse 1s infinite ease-in-out;
        background-color: black;
    }

.floating-chat-dots i:nth-child(2) {
    animation-delay: 0.15s;
}

.floating-chat-dots i:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes floating-chat-pulse {
    0%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    50% {
        transform: translateY(-3px);
        opacity: 1;
    }
}

@media (max-width: 640px) {
    .floating-chat {
        right: 1rem;
        left: 1rem;
        align-items: stretch;
    }

    .floating-chat-panel {
        width: 100%;
    }

    .floating-chat-toggle {
        width: 100%;
    }
}
