/*
 * ============================================
 *  SOFTCRAFTS CHATBOT WIDGET
 *  Floating lead capture assistant
 * ============================================
 */

/* ── Trigger Button ── */
.chatbot-trigger {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #00d4ff, #7c3aed);
    color: #fff;
    cursor: pointer;
    z-index: 9990;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 8px 32px rgba(0, 212, 255, 0.35),
        0 0 0 0 rgba(0, 212, 255, 0.4);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    animation: chatbot-pulse 2.5s ease-in-out infinite;
}

.chatbot-trigger:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 40px rgba(0, 212, 255, 0.5);
}

.chatbot-trigger.open {
    animation: none;
    background: linear-gradient(135deg, #7c3aed, #00d4ff);
    transform: rotate(0deg);
}

@keyframes chatbot-pulse {

    0%,
    100% {
        box-shadow: 0 8px 32px rgba(0, 212, 255, 0.35), 0 0 0 0 rgba(0, 212, 255, 0.4);
    }

    50% {
        box-shadow: 0 8px 32px rgba(0, 212, 255, 0.35), 0 0 0 12px rgba(0, 212, 255, 0);
    }
}

.trigger-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

/* Badge */
.trigger-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #060613;
    animation: badge-bounce 0.4s ease;
}

@keyframes badge-bounce {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

/* ── Notification Bubble ── */
.chatbot-bubble {
    position: fixed;
    bottom: 100px;
    right: 28px;
    background: rgba(12, 12, 36, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px 16px 4px 16px;
    padding: 14px 18px;
    max-width: 260px;
    z-index: 9989;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    animation: bubble-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
}

@keyframes bubble-in {
    0% {
        opacity: 0;
        transform: translateY(10px) scale(0.9);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.chatbot-bubble p {
    margin: 0;
    font-size: 0.85rem;
    color: #e2e8f0;
    line-height: 1.5;
    font-family: "Inter", sans-serif;
}

.bubble-close {
    background: none;
    border: none;
    color: #64748b;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.2s;
}

.bubble-close:hover {
    color: #fff;
}

/* ── Chat Window ── */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 28px;
    width: 380px;
    max-height: 550px;
    background: #0a0a1e;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    z-index: 9991;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow:
        0 25px 80px rgba(0, 0, 0, 0.55),
        0 0 40px rgba(0, 212, 255, 0.06);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
        visibility 0.35s,
        transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom right;
}

.chatbot-window.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* ── Header ── */
.chatbot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.08), rgba(124, 58, 237, 0.08));
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-header-title {
    margin: 0;
    font-family: "Space Grotesk", sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
}

.chatbot-status {
    font-size: 0.72rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    display: inline-block;
    animation: status-pulse 2s ease-in-out infinite;
}

@keyframes status-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

.chatbot-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.03);
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

/* ── Messages Area ── */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 280px;
    max-height: 340px;
    scroll-behavior: smooth;
}

/* Scrollbar */
.chatbot-messages::-webkit-scrollbar {
    width: 4px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

/* ── Message Bubbles ── */
.chatbot-msg {
    display: flex;
    gap: 8px;
    max-width: 88%;
}

.chatbot-msg-bot {
    align-self: flex-start;
}

.chatbot-msg-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(0, 212, 255, 0.08);
    border: 1px solid rgba(0, 212, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.msg-content {
    display: flex;
    flex-direction: column;
}

.msg-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.88rem;
    line-height: 1.55;
    font-family: "Inter", sans-serif;
}

.chatbot-msg-bot .msg-bubble {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: #e2e8f0;
    border-top-left-radius: 4px;
}

.chatbot-msg-user .msg-bubble {
    background: linear-gradient(135deg, #00d4ff, #7c3aed);
    color: #fff;
    border-top-right-radius: 4px;
}

.msg-time {
    font-size: 0.68rem;
    color: #475569;
    margin-top: 4px;
    padding: 0 4px;
}

.chatbot-msg-user .msg-time {
    text-align: right;
}

/* ── Typing Indicator ── */
.typing-bubble {
    display: flex;
    gap: 4px;
    padding: 12px 18px !important;
    align-items: center;
}

.typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #64748b;
    animation: typing-bounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.16s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.32s;
}

@keyframes typing-bounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* ── Quick Replies ── */
.chatbot-quick-replies {
    display: none;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 16px 12px;
}

.quick-reply-btn {
    padding: 7px 14px;
    border-radius: 50px;
    border: 1px solid rgba(0, 212, 255, 0.2);
    background: rgba(0, 212, 255, 0.06);
    color: #00d4ff;
    font-size: 0.78rem;
    font-weight: 500;
    font-family: "Inter", sans-serif;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
    animation: qr-fade-in 0.3s ease forwards;
    opacity: 0;
    transform: translateY(8px);
}

@keyframes qr-fade-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.quick-reply-btn:hover {
    background: rgba(0, 212, 255, 0.15);
    border-color: rgba(0, 212, 255, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.15);
}

/* ── Input Area ── */
.chatbot-input {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.02);
}

.chatbot-input input {
    flex: 1;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 10px 14px;
    color: #fff;
    font-size: 0.88rem;
    font-family: "Inter", sans-serif;
    outline: none;
    transition: border-color 0.3s ease;
}

.chatbot-input input::placeholder {
    color: #475569;
}

.chatbot-input input:focus {
    border-color: rgba(0, 212, 255, 0.35);
}

.chatbot-input button {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #00d4ff, #7c3aed);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.25s ease;
}

.chatbot-input button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.35);
}

/* ── Mobile Responsive ── */
@media (max-width: 480px) {
    .chatbot-window {
        bottom: 0;
        right: 0;
        width: 100%;
        max-height: 100vh;
        max-height: 100dvh;
        border-radius: 0;
        border: none;
    }

    .chatbot-window.open {
        height: 90vh;
        height: 90dvh;
    }

    .chatbot-messages {
        max-height: none;
        flex: 1;
    }

    .chatbot-trigger {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
    }

    .chatbot-bubble {
        bottom: 88px;
        right: 20px;
        max-width: 240px;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .chatbot-window {
        width: 360px;
        right: 16px;
        bottom: 90px;
    }

    .chatbot-trigger {
        bottom: 20px;
        right: 20px;
    }
}