/* BouwTag Chat Widget */

.btchat-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--btchat-color, #fe661b);
    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, #fe661b);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.btchat-header__left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btchat-header__logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.btchat-header__logo svg {
    width: auto;
    height: 28px;
}

.btchat-header__title {
    font-family: 'Secular One', sans-serif;
    font-size: 17px;
    font-weight: 400;
    color: #fff;
    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;
}

/* WhatsApp CTA */
.btchat-whatsapp {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #25d366;
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s;
    flex-shrink: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.btchat-whatsapp:hover,
.btchat-whatsapp:focus {
    background: #1ebe57;
    color: #fff;
    text-decoration: none;
}

.btchat-whatsapp__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btchat-whatsapp__icon svg {
    width: 22px;
    height: 22px;
    fill: #fff;
}

.btchat-whatsapp__label {
    flex: 1;
    line-height: 1.3;
}

/* 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, #fe661b);
    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, #fe661b);
    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;
}

/* Product card */
.btchat-product-card {
    align-self: flex-start;
    max-width: 85%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(26, 43, 74, 0.08);
    transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}

.btchat-product-card:hover {
    box-shadow: 0 8px 20px rgba(26, 43, 74, 0.14);
    transform: translateY(-2px);
    border-color: var(--btchat-color, #fe661b);
}

.btchat-product-card__image {
    flex: 0 0 56px;
    width: 56px;
    height: 56px;
    border-radius: 10px;
    overflow: hidden;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btchat-product-card__image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.btchat-product-card__info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.btchat-product-card__name {
    font-family: 'Secular One', sans-serif;
    font-size: 14px;
    line-height: 1.2;
    color: #1a2b4a;
}

.btchat-product-card__price {
    font-size: 13px;
    font-weight: 700;
    color: #1a2b4a;
}

.btchat-product-card__cta {
    margin-top: 2px;
    font-size: 12px;
    font-weight: 600;
    color: var(--btchat-color, #fe661b);
}

/* 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 8px;
    border-top: 1px solid #e5e7eb;
    gap: 8px;
    flex-shrink: 0;
}

.btchat-disclaimer {
    padding: 0 16px 10px;
    font-size: 11px;
    line-height: 1.3;
    color: #9ca3af;
    text-align: center;
    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, #fe661b);
}

.btchat-input__send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--btchat-color, #fe661b);
    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;
        width: 52px;
        height: 52px;
        transition: transform 0.2s, box-shadow 0.2s, bottom 0.3s ease;
    }

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

    /* Chat open: verberg de zwevende bubble (sluiten kan met het kruis in de header) */
    .btchat-window--open ~ .btchat-bubble {
        display: none;
    }
}
