.tp-livechat {
    --tp-chat-navy: #0f2743;
    --tp-chat-navy-2: #17395f;
    --tp-chat-text: #12395f;
    --tp-chat-muted: #5e7691;
    --tp-chat-border: #cfdeec;
    --tp-chat-surface: #f4f8fc;
    --tp-chat-white: #ffffff;
    --tp-chat-success: #41c789;
}

.tp-livechat-presence {
    position: fixed;
    right: 96px;
    bottom: 34px;
    z-index: 998;
    border: 1px solid var(--tp-chat-border);
    background: var(--tp-chat-white);
    color: var(--tp-chat-text);
    border-radius: 999px;
    padding: 10px 14px;
    box-shadow: 0 10px 26px rgba(10, 39, 67, 0.14);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.tp-livechat-presence:hover {
    border-color: #a7c0d8;
    transform: translateY(-1px);
}

.tp-livechat-presence-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--tp-chat-success);
    box-shadow: 0 0 0 7px rgba(65, 199, 137, 0.14);
    flex-shrink: 0;
}

.tp-livechat-launcher {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: 0;
    background: var(--tp-chat-navy);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 14px 36px rgba(8, 31, 54, 0.34);
    cursor: pointer;
    z-index: 999;
    transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.tp-livechat-launcher:hover {
    transform: translateY(-2px);
    background: var(--tp-chat-navy-2);
    box-shadow: 0 18px 42px rgba(8, 31, 54, 0.42);
}

.tp-livechat-launcher svg {
    width: 24px;
    height: 24px;
}

.tp-livechat-widget {
    position: fixed;
    right: 24px;
    bottom: 96px;
    width: min(390px, calc(100vw - 28px));
    border-radius: 18px;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--tp-chat-border);
    box-shadow: 0 22px 50px rgba(8, 31, 54, 0.24);
    z-index: 1000;
    display: none;
    flex-direction: column;
}

.tp-livechat-widget.is-open {
    display: flex;
}

.tp-livechat-head {
    background: linear-gradient(135deg, var(--tp-chat-navy), var(--tp-chat-navy-2));
    color: #f2f8ff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.tp-livechat-head-main {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tp-livechat-agent-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    overflow: hidden;
}

.tp-livechat-agent-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tp-livechat-head-title {
    font-size: 0.88rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.tp-livechat-head-sub {
    font-size: 0.73rem;
    color: rgba(238, 247, 255, 0.83);
}

.tp-livechat-close {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 0;
    background: rgba(255, 255, 255, 0.14);
    color: inherit;
    cursor: pointer;
}

.tp-livechat-close:hover {
    background: rgba(255, 255, 255, 0.24);
}

.tp-livechat-messages {
    background: var(--tp-chat-surface);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 390px;
    overflow-y: auto;
}

.tp-livechat-message {
    max-width: 88%;
    border-radius: 14px;
    padding: 10px 12px;
    font-size: 0.84rem;
    line-height: 1.5;
    animation: tp-livechat-pop 0.22s ease;
}

@keyframes tp-livechat-pop {
    from { transform: translateY(6px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.tp-livechat-message-bot {
    align-self: flex-start;
    background: #fff;
    border: 1px solid #d8e5f2;
    color: var(--tp-chat-text);
}

.tp-livechat-message-user {
    align-self: flex-end;
    background: var(--tp-chat-navy-2);
    color: #fff;
}

.tp-livechat-time {
    margin-top: 6px;
    display: block;
    font-size: 0.68rem;
    opacity: 0.72;
}

.tp-livechat-typing {
    align-self: flex-start;
    background: #fff;
    border: 1px solid #d8e5f2;
    color: #507094;
    border-radius: 12px;
    padding: 8px 10px;
    font-size: 0.76rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tp-livechat-dots {
    display: inline-flex;
    gap: 4px;
}

.tp-livechat-dots span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #6f8ca9;
    animation: tp-livechat-dot 1s infinite ease-in-out;
}

.tp-livechat-dots span:nth-child(2) { animation-delay: 0.16s; }
.tp-livechat-dots span:nth-child(3) { animation-delay: 0.32s; }

@keyframes tp-livechat-dot {
    0%, 80%, 100% { opacity: 0.35; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-2px); }
}

.tp-livechat-quick {
    background: var(--tp-chat-surface);
    border-top: 1px solid #dfe9f3;
    padding: 0 16px 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tp-livechat-quick-btn {
    border: 1px solid #c9d9e8;
    background: #fff;
    color: #264f79;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
}

.tp-livechat-quick-btn:hover {
    border-color: #9fbad6;
    background: #f2f7fc;
    color: #163d66;
}

.tp-livechat-compose {
    border-top: 1px solid #dbe7f2;
    background: #fff;
    display: flex;
    gap: 8px;
    padding: 12px;
}

.tp-livechat-input {
    flex: 1;
    border: 1px solid #c6d8e9;
    border-radius: 11px;
    background: #fff;
    color: #163c65;
    padding: 11px 12px;
    font-size: 0.84rem;
    outline: none;
}

.tp-livechat-input:focus {
    border-color: #96b5d5;
    box-shadow: 0 0 0 3px rgba(24, 72, 118, 0.09);
}

.tp-livechat-send {
    border: 0;
    border-radius: 11px;
    width: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    background: var(--tp-chat-navy);
}

.tp-livechat-send:hover {
    background: #0b2340;
}

.tp-livechat-send svg {
    width: 18px;
    height: 18px;
}

@media (max-width: 640px) {
    .tp-livechat-presence {
        right: 78px;
        bottom: 20px;
        font-size: 0.68rem;
        padding: 9px 11px;
    }

    .tp-livechat-launcher {
        right: 14px;
        bottom: 12px;
        width: 52px;
        height: 52px;
    }

    .tp-livechat-widget {
        right: 8px;
        bottom: 74px;
        width: calc(100vw - 16px);
        border-radius: 15px;
    }

    .tp-livechat-messages {
        max-height: 54vh;
    }

    /* Prevent mobile browsers from zooming on input focus */
    .tp-livechat-input {
        font-size: 16px;
    }
}
