/* ============================================================
   New Style Construction UK — AI Chatbot Styles
   ============================================================ */

.chatbot-fab {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 60px;
    height: 60px;
    background: var(--c-amber);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 24px rgba(212,135,10,0.45);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.chatbot-fab:hover { transform: scale(1.1); }
.chatbot-fab.active { background: var(--c-surface2); box-shadow: 0 4px 24px rgba(0,0,0,0.4); }

.chatbot-fab__pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--c-amber);
    animation: pulse 2.5s ease-out infinite;
    opacity: 0;
}
@keyframes pulse {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.7); opacity: 0; }
}

.chatbot-fab__icon {
    width: 26px;
    height: 26px;
    color: var(--c-bg);
    position: absolute;
    transition: all 0.25s ease;
}
.chatbot-fab.active .chatbot-fab__icon { color: var(--c-white); }
.chatbot-fab__icon--close { opacity: 0; transform: rotate(-90deg) scale(0.6); }
.chatbot-fab.active .chatbot-fab__icon--open { opacity: 0; transform: rotate(90deg) scale(0.6); }
.chatbot-fab.active .chatbot-fab__icon--close { opacity: 1; transform: rotate(0) scale(1); }

.chatbot-window {
    position: fixed;
    bottom: 104px;
    right: 28px;
    width: 380px;
    max-height: 580px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    z-index: 999;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(20px) scale(0.96);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}
.chatbot-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.chatbot-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--c-surface2);
    border-bottom: 1px solid var(--c-border);
    flex-shrink: 0;
}
.chatbot-header__avatar {
    width: 40px;
    height: 40px;
    background: var(--c-surface2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}
.chatbot-header__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.chatbot-header__avatar svg { width: 22px; height: 22px; color: var(--c-bg); }
.chatbot-header__info { flex: 1; }
.chatbot-header__info strong { display: block; font-size: 0.88rem; color: var(--c-white); font-weight: 600; }
.chatbot-header__info span { font-size: 0.72rem; color: var(--c-amber); }
.chatbot-header__info span::before { content: '●'; margin-right: 5px; font-size: 0.55rem; }
.chatbot-header__close {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--c-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    transition: all var(--transition);
}
.chatbot-header__close:hover { background: var(--c-border); color: var(--c-white); }
.chatbot-header__close svg { width: 16px; height: 16px; }

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scrollbar-width: thin;
    scrollbar-color: var(--c-border) transparent;
}
.chatbot-messages::-webkit-scrollbar { width: 4px; }
.chatbot-messages::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: 2px; }

.chatbot-msg { display: flex; max-width: 88%; }
.chatbot-msg--bot { align-self: flex-start; }
.chatbot-msg--user { align-self: flex-end; flex-direction: row-reverse; }

.chatbot-msg__bubble {
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 0.875rem;
    line-height: 1.6;
}
.chatbot-msg--bot .chatbot-msg__bubble {
    background: var(--c-surface2);
    border: 1px solid var(--c-border);
    color: var(--c-text);
    border-bottom-left-radius: 4px;
}
.chatbot-msg--user .chatbot-msg__bubble {
    background: var(--c-amber);
    color: var(--c-bg);
    border-bottom-right-radius: 4px;
    font-weight: 500;
}
.chatbot-msg__bubble p { margin-bottom: 8px; }
.chatbot-msg__bubble p:last-child { margin-bottom: 0; }

.chatbot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}
.chatbot-suggestion {
    background: transparent;
    border: 1px solid var(--c-border);
    color: var(--c-text-muted);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-body);
}
.chatbot-suggestion:hover { border-color: var(--c-amber); color: var(--c-amber); background: rgba(212,135,10,0.06); }

/* Typing indicator */
.chatbot-typing {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 14px 16px;
    background: var(--c-surface2);
    border: 1px solid var(--c-border);
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}
.chatbot-typing span {
    width: 7px;
    height: 7px;
    background: var(--c-text-muted);
    border-radius: 50%;
    animation: typing 1.2s ease-in-out infinite;
}
.chatbot-typing span:nth-child(2) { animation-delay: 0.2s; }
.chatbot-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-5px); opacity: 1; }
}

.chatbot-input-area {
    padding: 12px 16px 16px;
    border-top: 1px solid var(--c-border);
    background: var(--c-surface);
    flex-shrink: 0;
}
.chatbot-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: 12px;
    padding: 8px 10px 8px 14px;
    transition: border-color var(--transition);
}
.chatbot-input-wrap:focus-within { border-color: var(--c-amber); }

#chatbotInput {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--c-white);
    font-family: var(--font-body);
    font-size: 0.875rem;
    line-height: 1.5;
    resize: none;
    max-height: 100px;
    overflow-y: auto;
    padding: 4px 0;
}
#chatbotInput::placeholder { color: var(--c-text-muted); }

.chatbot-send {
    width: 34px;
    height: 34px;
    background: var(--c-amber);
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--c-bg);
    flex-shrink: 0;
    transition: all var(--transition);
}
.chatbot-send:hover { background: var(--c-amber-lt); transform: scale(1.05); }
.chatbot-send:disabled { background: var(--c-border); cursor: not-allowed; transform: none; }
.chatbot-send svg { width: 16px; height: 16px; }

.chatbot-disclaimer { font-size: 0.68rem; color: var(--c-text-muted); text-align: center; margin-top: 8px; }
.chatbot-disclaimer a { color: var(--c-amber); }

/* Error state */
.chatbot-msg__bubble.error {
    background: rgba(224,82,82,0.12);
    border-color: rgba(224,82,82,0.3);
    color: #f08080;
}

/* API key warning */
.chatbot-api-warning {
    background: rgba(212,135,10,0.1);
    border: 1px solid rgba(212,135,10,0.3);
    border-radius: var(--radius);
    padding: 12px 14px;
    font-size: 0.78rem;
    color: var(--c-amber);
    margin: 8px 0;
    line-height: 1.5;
}

@media (max-width: 480px) {
    .chatbot-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-height: 70vh;
        border-radius: 16px 16px 0 0;
    }
    .chatbot-fab { bottom: 20px; right: 20px; }
}
