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

.chatbot {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 99999;
    font-family: 'Poppins', Arial, sans-serif;
}


/* =========================================================
   FLOATING CHAT BUTTON
   ========================================================= */

.chatbot-toggle {
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    background: #2f6bff;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.chatbot-toggle:hover {
    background: #2459d6;
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

.chatbot-toggle:active {
    transform: scale(0.96);
}

.chatbot-toggle svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

.chatbot-toggle-chat,
.chatbot-toggle-close {
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-toggle-close {
    display: none;
}

.chatbot.chatbot-open .chatbot-toggle-chat {
    display: none;
}

.chatbot.chatbot-open .chatbot-toggle-close {
    display: flex;
}


/* =========================================================
   CHAT WINDOW
   ========================================================= */

.chatbot-window {
    position: absolute;
    right: 0;
    bottom: 76px;
    width: 380px;
    height: 560px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.22);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(15px) scale(0.97);
    transform-origin: bottom right;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.chatbot.chatbot-open .chatbot-window {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}


/* =========================================================
   HEADER
   ========================================================= */

.chatbot-header {
    flex-shrink: 0;
    min-height: 76px;
    padding: 14px 16px;
    background: #2f6bff;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-header-icon {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-header-icon svg {
    width: 24px;
    height: 24px;
    fill: #ffffff;
}

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

.chatbot-title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chatbot-status {
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
}

.chatbot-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

.chatbot-close {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.15);
}

.chatbot-close svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}


/* =========================================================
   MESSAGE AREA
   ========================================================= */

.chatbot-messages {
    flex: 1;
    min-height: 0;
    padding: 18px 16px;
    background: #f5f7fb;
    overflow-x: hidden;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}


/* =========================================================
   MESSAGE ROWS
   ========================================================= */

.chatbot-message {
    width: 100%;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.chatbot-message-bot {
    justify-content: flex-start;
}

.chatbot-message-user {
    justify-content: flex-end;
}

.chatbot-message-content {
    max-width: 78%;
}

.chatbot-avatar {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #2f6bff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-avatar svg {
    width: 16px;
    height: 16px;
    fill: #ffffff;
}


/* =========================================================
   MESSAGE BUBBLES
   ========================================================= */

.chatbot-bubble {
    padding: 11px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    overflow-wrap: anywhere;
    word-break: normal;
}

.chatbot-message-bot .chatbot-bubble {
    background: #ffffff;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.chatbot-message-user .chatbot-bubble {
    background: #2f6bff;
    color: #ffffff;
    border-bottom-right-radius: 5px;
}


/* =========================================================
   TYPING INDICATOR
   ========================================================= */

.chatbot-typing {
    flex-shrink: 0;
    padding: 0 16px 14px;
    background: #f5f7fb;
    display: none;
    align-items: flex-end;
    gap: 8px;
}

.chatbot-typing.chatbot-typing-visible {
    display: flex;
}

.chatbot-typing-bubble {
    min-width: 56px;
    height: 38px;
    padding: 0 13px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    border-bottom-left-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.chatbot-typing-bubble span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #94a3b8;
    animation: chatbotTyping 1.2s infinite ease-in-out;
}

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

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

@keyframes chatbotTyping {
    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.5;
    }

    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}


/* =========================================================
   INPUT AREA
   ========================================================= */

.chatbot-input-area {
    flex-shrink: 0;
    padding: 12px 14px 8px;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
}

.chatbot-input-wrapper {
    min-height: 46px;
    padding: 5px 5px 5px 14px;
    background: #f8fafc;
    border: 1px solid #dbe1e8;
    border-radius: 24px;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chatbot-input-wrapper:focus-within {
    border-color: #2f6bff;
    box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.10);
}

.chatbot-input {
    flex: 1;
    min-width: 0;
    min-height: 34px;
    max-height: 110px;
    padding: 7px 0;
    border: none;
    outline: none;
    resize: none;
    background: transparent;
    color: #1f2937;
    font-family: inherit;
    font-size: 14px;
    line-height: 20px;
    overflow-y: auto;
}

.chatbot-input::placeholder {
    color: #94a3b8;
}

.chatbot-send {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background: #2f6bff;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.chatbot-send:hover {
    background: #2459d6;
}

.chatbot-send:active {
    transform: scale(0.94);
}

.chatbot-send:disabled {
    background: #aab7d6;
    cursor: not-allowed;
    transform: none;
}

.chatbot-send svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}


/* =========================================================
   FOOTER
   ========================================================= */

.chatbot-footer {
    padding-top: 7px;
    color: #94a3b8;
    font-size: 10px;
    text-align: center;
}


/* =========================================================
   TABLET
   ========================================================= */

@media (min-width: 600px) and (max-width: 1024px) {

    .chatbot {
        right: 20px;
        bottom: 20px;
    }

    .chatbot-window {
        width: 400px;
        height: 580px;
        max-height: calc(100vh - 110px);
    }

}

/* =========================================================
   LIVE SUPPORT INVITATION
   ========================================================= */

.chatbot-live-invite {
    flex-shrink: 0;
    margin: 0;
    padding: 14px 16px 16px;
    background: #f5f7fb;
    border-top: 1px solid #e5e7eb;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

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

.chatbot-live-invite-icon {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #2f6bff;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(47, 107, 255, 0.18);
}

.chatbot-live-invite-icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.chatbot-live-invite-content {
    flex: 1;
    min-width: 0;
    padding: 13px 14px;
    background: #ffffff;
    border: 1px solid #dbe3f0;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.chatbot-live-invite-title {
    margin-bottom: 3px;
    color: #2f6bff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
}

.chatbot-live-invite-agent {
    margin-bottom: 8px;
    color: #1f2937;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}

.chatbot-live-invite-message {
    margin-bottom: 12px;
    color: #64748b;
    font-size: 13px;
    line-height: 1.5;
}

.chatbot-live-invite-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chatbot-live-invite-accept,
.chatbot-live-invite-decline {
    min-height: 36px;
    padding: 8px 14px;
    border-radius: 9px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        transform 0.15s ease;
}

.chatbot-live-invite-accept {
    border: 1px solid #2f6bff;
    background: #2f6bff;
    color: #ffffff;
}

.chatbot-live-invite-accept:hover {
    background: #2459d6;
    border-color: #2459d6;
}

.chatbot-live-invite-decline {
    border: 1px solid #dbe1e8;
    background: #ffffff;
    color: #64748b;
}

.chatbot-live-invite-decline:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #334155;
}

.chatbot-live-invite-accept:active,
.chatbot-live-invite-decline:active {
    transform: scale(0.97);
}

.chatbot-live-invite-accept:disabled,
.chatbot-live-invite-decline:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}
/* =========================================================
   PHONE
   ========================================================= */

@media (max-width: 599px) {

    .chatbot {
        right: 14px;
        bottom: 14px;
    }

    .chatbot-toggle {
        width: 56px;
        height: 56px;
    }

    .chatbot-toggle svg {
        width: 26px;
        height: 26px;
    }

    .chatbot-window {
        position: fixed;
        top: 12px;
        right: 12px;
        bottom: 82px;
        left: 12px;
        width: auto;
        height: auto;
        max-height: none;
        border-radius: 16px;
        transform-origin: bottom right;
    }

    .chatbot-header {
        min-height: 70px;
        padding: 12px 14px;
    }

    .chatbot-header-icon {
        width: 40px;
        height: 40px;
    }

    .chatbot-title {
        font-size: 15px;
    }

    .chatbot-messages {
        padding: 16px 12px;
    }

    .chatbot-message-content {
        max-width: 82%;
    }

    .chatbot-input-area {
        padding: 10px 10px 7px;
    }

        .chatbot-live-invite {
        padding: 12px;
        gap: 9px;
    }

    .chatbot-live-invite-icon {
        width: 34px;
        height: 34px;
    }

    .chatbot-live-invite-icon svg {
        width: 18px;
        height: 18px;
    }

    .chatbot-live-invite-content {
        padding: 12px;
    }

    .chatbot-live-invite-actions {
        gap: 6px;
    }

    .chatbot-live-invite-accept,
    .chatbot-live-invite-decline {
        flex: 1;
        padding: 8px 10px;
    }
}


/* =========================================================
   VERY SMALL PHONES
   ========================================================= */

@media (max-width: 360px) {

    .chatbot-window {
        top: 8px;
        right: 8px;
        bottom: 76px;
        left: 8px;
    }

    .chatbot-title {
        font-size: 14px;
    }

    .chatbot-header-icon {
        width: 36px;
        height: 36px;
    }

    .chatbot-message-content {
        max-width: 84%;
    }

    .chatbot-bubble {
        padding: 10px 12px;
        font-size: 13px;
    }

}


/* ============================================
   REQUEST LIVE SUPPORT
============================================ */

.chatbot-request-live-support{
    padding:10px 16px;
    background:#fff;
    border-top:1px solid #e5e7eb;
}

.chatbot-request-live-support-button{
    width:100%;
    min-height:42px;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    padding:10px 14px;
    border:1px solid #2563eb;
    border-radius:8px;
    background:#eff6ff;
    color:#2563eb;
    font-size:13px;
    font-weight:600;
    cursor:pointer;
    transition:background .2s ease,color .2s ease,border-color .2s ease;
}

.chatbot-request-live-support-button:hover{
    background:#2563eb;
    color:#fff;
}

.chatbot-request-live-support-button:disabled{
    background:#f3f4f6;
    border-color:#d1d5db;
    color:#9ca3af;
    cursor:not-allowed;
}

.chatbot-request-live-support-button svg{
    width:18px;
    height:18px;
    fill:currentColor;
    flex-shrink:0;
}

/* ============================================
   END LIVE SUPPORT
============================================ */

.chatbot-end-live-support-button{
    width:100%;
    min-height:42px;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    padding:10px 14px;
    border:1px solid #dc2626;
    border-radius:8px;
    background:#fef2f2;
    color:#dc2626;
    font-size:13px;
    font-weight:600;
    cursor:pointer;
    transition:background .2s ease,color .2s ease,border-color .2s ease;
}

.chatbot-end-live-support-button:hover{
    background:#dc2626;
    color:#fff;
}

.chatbot-end-live-support-button:disabled{
    background:#f3f4f6;
    border-color:#d1d5db;
    color:#9ca3af;
    cursor:not-allowed;
}

.chatbot-end-live-support-button svg{
    width:18px;
    height:18px;
    fill:currentColor;
    flex-shrink:0;
}

.chatbot-end-live-support-button[hidden]{
    display:none;
}

.chatbot-request-live-support-button[hidden]{
    display:none;
}