/* ===========================
   CHATBOT
   =========================== */

.chatbot-launcher {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1500;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.8rem 1.1rem;
    border: none;
    border-radius: 999px;
    background: #667eea;
    color: #ffffff;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.chatbot-launcher:hover,
.chatbot-launcher:focus-visible {
    background: #5568d8;
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(102, 126, 234, 0.45);
}

.chatbot-launcher svg {
    width: 20px;
    height: 20px;
}

.chatbot-open .chatbot-launcher {
    display: none;
}

/* Panel */
.chatbot-panel {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1500;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: min(600px, calc(100vh - 100px));
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid #e6e8ef;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(20, 24, 40, 0.25);
    overflow: hidden;
    animation: chatbotIn 0.2s ease;
}

.chatbot-panel[hidden] {
    display: none;
}

@keyframes chatbotIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.chatbot-header {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.85rem 1rem;
    background: #2c3e50;
    color: #ffffff;
}

.chatbot-logo {
    height: 24px;
    width: auto;
    flex-shrink: 0;
}

.chatbot-heading {
    flex: 1;
    min-width: 0;
}

.chatbot-heading h2 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
}

.chatbot-heading p {
    margin: 0;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.7);
}

.chatbot-close {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 6px;
}

.chatbot-close:hover,
.chatbot-close:focus-visible {
    background: rgba(255, 255, 255, 0.12);
}

/* Messages */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    background: #f7f8fb;
}

.chatbot-message {
    max-width: 88%;
    padding: 0.6rem 0.8rem;
    border-radius: 12px;
    font-size: 0.88rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.chatbot-message p {
    margin: 0 0 0.4rem;
}

.chatbot-message p:last-child {
    margin-bottom: 0;
}

.chatbot-message ul {
    margin: 0.2rem 0 0.4rem;
    padding-left: 1.1rem;
}

.chatbot-message li {
    margin: 0.15rem 0;
}

.chatbot-assistant {
    align-self: flex-start;
    background: #ffffff;
    border: 1px solid #e6e8ef;
    color: #2c3e50;
    border-bottom-left-radius: 4px;
}

.chatbot-user {
    align-self: flex-end;
    background: #667eea;
    color: #ffffff;
    border-bottom-right-radius: 4px;
    white-space: pre-wrap;
}

.chatbot-error {
    background: #fff6f5;
    border-color: #f3d3cf;
    color: #8a3a32;
}

/* Typing indicator */
.chatbot-typing {
    display: inline-flex;
    gap: 4px;
    padding: 0.75rem 0.9rem;
}

.chatbot-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #9aa3b5;
    animation: chatbotDot 1.2s infinite ease-in-out;
}

.chatbot-typing span:nth-child(2) { animation-delay: 0.15s; }
.chatbot-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes chatbotDot {
    0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-3px); }
}

/* Suggested questions */
.chatbot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0 1rem 0.75rem;
    background: #f7f8fb;
}

.chatbot-suggestions[hidden] {
    display: none;
}

.chatbot-chip {
    background: #ffffff;
    border: 1px solid #c9cff5;
    color: #4f5bd5;
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    font: inherit;
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.chatbot-chip:hover,
.chatbot-chip:focus-visible {
    background: #eef0fd;
}

/* Input */
.chatbot-form {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    padding: 0.7rem 0.8rem;
    border-top: 1px solid #e6e8ef;
    background: #ffffff;
}

.chatbot-input {
    flex: 1;
    resize: none;
    border: 1px solid #dde1ec;
    border-radius: 10px;
    padding: 0.55rem 0.7rem;
    font: inherit;
    font-size: 0.88rem;
    line-height: 1.4;
    max-height: 120px;
    overflow-y: hidden;
    color: #2c3e50;
}

.chatbot-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.chatbot-send {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 10px;
    background: #667eea;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.chatbot-send svg {
    width: 17px;
    height: 17px;
}

.chatbot-send:disabled {
    opacity: 0.5;
    cursor: wait;
}

/* Footer: WhatsApp and disclaimer */
.chatbot-footer {
    padding: 0 0.8rem 0.7rem;
    background: #ffffff;
}

.chatbot-whatsapp {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.55rem;
    border-radius: 10px;
    background: #e9f8ef;
    color: #128c4b;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.2s ease;
}

.chatbot-whatsapp:hover,
.chatbot-whatsapp:focus-visible {
    background: #d5f2e1;
}

.chatbot-whatsapp svg {
    width: 18px;
    height: 18px;
}

.chatbot-disclaimer {
    margin: 0.45rem 0 0;
    font-size: 0.68rem;
    color: #999;
    text-align: center;
    line-height: 1.4;
}

.chatbot-disclaimer a {
    color: #667eea;
    text-decoration: underline;
}

/* Phones: full-width sheet; icon-only launcher */
@media (max-width: 480px) {
    .chatbot-panel {
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        height: 85vh;
        border-radius: 16px 16px 0 0;
    }

    .chatbot-launcher {
        right: 16px;
        bottom: 16px;
        padding: 0.85rem;
    }

    .chatbot-launcher-label {
        display: none;
    }
}

/* Links in answers: page sections, projects, the booking page */
.chatbot-assistant a {
    color: #4f5bd5;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.chatbot-assistant a:hover {
    color: #3f4bc0;
}

/* An answer that broke off mid-stream */
.chatbot-cutoff {
    color: #8a3a32;
    font-size: 0.85em;
}
