/*
 * WP Spider Chatbot UI
 * - Trigger fixed bottom-right
 * - Chat UI inside Bootstrap 5 Offcanvas (right)
 */

/* Trigger */
.spider-launcher {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 52px;
    height: 52px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    z-index: 1044;
}

.spider-launcher-label {
    position: absolute;
    left: 0;
    z-index: 10;
    top: 50%;
    width: auto;
    transform: translate(-105%, -50%);
    font-size: 1rem;
    white-space: nowrap;
    line-height: 1;
    font-weight: 500;
    background-color: #00437d;
    padding: 0.35rem 0.5rem 0.2rem 0.5rem;
    border-radius: 0.35rem;
    animation: pulse 1s ease-in-out infinite;
    transition: opacity 0.35s ease;
    opacity: 1;
}

.spider-launcher-label.hidden {
    opacity: 0;
    pointer-events: none;
}

@keyframes pulse {
    0% {
        transform: translate(-105%, -50%) scale(1);
    }
    50% {
        transform: translate(-105%, -50%) scale(1.05);
    }
    100% {
        transform: translate(-105%, -50%) scale(1);
    }
}

/* Messages area (inside offcanvas) */
.spider-messages {
    background: #f5f5f5;
    min-height: 100px;
}

.msg {
    margin-bottom: 8px;
    max-width: 80%;
    padding: 8px 10px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.4;
}

.msg.user {
    margin-left: auto;
    background: #0058a3;
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.msg.bot {
    margin-right: auto;
    background: #ffffff;
    color: #111827;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}

/* Typing bubble */
.msg.typing {
    margin-right: auto;
    background: #e5e7eb;
    color: #4b5563;
    font-size: 16px;
    min-width: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.msg.typing .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4b5563;
    margin: 0 3px;
    opacity: 0.2;
    animation: spiderTypingBounce 1s infinite ease-in-out;
}

.msg.typing .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.msg.typing .dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes spiderTypingBounce {
    0% {
        transform: translateY(0);
        opacity: 0.2;
    }
    30% {
        transform: translateY(-3px);
        opacity: 1;
    }
    60% {
        transform: translateY(0);
        opacity: 0.4;
    }
    100% {
        transform: translateY(0);
        opacity: 0.2;
    }
}

/* Mobile tweak */
@media (max-width: 600px) {
    .spider-launcher {
        right: 12px;
        bottom: 12px;
    }
}
