/* BouwTag Chat Widget */

.btchat-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--btchat-color, #f5a623);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btchat-bubble:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}

.btchat-bubble svg {
    width: 28px;
    height: 28px;
    fill: #fff;
}

.btchat-bubble--close svg {
    width: 22px;
    height: 22px;
}

/* Chat Window */
.btchat-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
    z-index: 9998;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.btchat-window--open {
    display: flex;
}

/* Header */
.btchat-header {
    background: var(--btchat-color, #f5a623);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.btchat-header__title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.btchat-header__close {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    opacity: 0.8;
}

.btchat-header__close:hover {
    opacity: 1;
}

.btchat-header__close svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}

/* Messages Area */
.btchat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btchat-messages::-webkit-scrollbar {
    width: 4px;
}

.btchat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

/* Message Bubbles */
.btchat-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.btchat-msg--user {
    align-self: flex-end;
    background: var(--btchat-color, #f5a623);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.btchat-msg--assistant {
    align-self: flex-start;
    background: #f1f3f5;
    color: #1a1a1a;
    border-bottom-left-radius: 4px;
}

.btchat-msg--assistant a {
    color: var(--btchat-color, #f5a623);
    text-decoration: underline;
}

.btchat-msg--assistant strong {
    font-weight: 600;
}

.btchat-msg--assistant ul,
.btchat-msg--assistant ol {
    margin: 4px 0;
    padding-left: 20px;
}

.btchat-msg--assistant li {
    margin-bottom: 2px;
}

.btchat-msg--assistant p {
    margin: 0 0 8px;
}

.btchat-msg--assistant p:last-child {
    margin-bottom: 0;
}

/* Typing Indicator */
.btchat-typing {
    align-self: flex-start;
    background: #f1f3f5;
    padding: 12px 18px;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    display: none;
    gap: 4px;
    align-items: center;
}

.btchat-typing--visible {
    display: flex;
}

.btchat-typing__dot {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: btchat-bounce 1.2s infinite ease-in-out;
}

.btchat-typing__dot:nth-child(2) {
    animation-delay: 0.15s;
}

.btchat-typing__dot:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes btchat-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* Input Area */
.btchat-input {
    display: flex;
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
    gap: 8px;
    flex-shrink: 0;
}

.btchat-input__field {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    font-family: inherit;
    resize: none;
}

.btchat-input__field:focus {
    border-color: var(--btchat-color, #f5a623);
}

.btchat-input__send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--btchat-color, #f5a623);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.2s;
}

.btchat-input__send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btchat-input__send svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .btchat-window {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .btchat-bubble {
        bottom: 16px;
        right: 16px;
    }
}
