/* True Power AI Chatbot */
.tp-chatbot {
    --cb-w: min(380px, calc(100vw - 1.5rem));
    --cb-h: min(520px, calc(100dvh - 6.5rem));
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1080;
    font-family: "Archivo", sans-serif;
}

.tp-chatbot-toggle {
    width: 58px;
    height: 58px;
    border: 0;
    border-radius: 50%;
    background: var(--tp-gradient, linear-gradient(135deg, #2473c2 0%, #1a5a9e 50%, #0d3d7a 100%));
    color: #fff;
    font-size: 1.55rem;
    box-shadow: 0 10px 28px rgba(36, 115, 194, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s var(--tp-ease, ease), box-shadow 0.25s;
    position: relative;
}

.tp-chatbot-toggle:hover {
    transform: translateY(-3px) scale(1.04);
    box-shadow: 0 14px 34px rgba(36, 115, 194, 0.5);
}

.tp-chatbot-toggle.is-open {
    background: #0d2a5c;
}

.tp-chatbot-toggle .tp-cb-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid #fff;
}

.tp-chatbot-panel {
    position: absolute;
    right: 0;
    bottom: calc(58px + 0.75rem);
    width: var(--cb-w);
    height: var(--cb-h);
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(15, 45, 90, 0.28);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px) scale(0.96);
    transform-origin: bottom right;
    transition: opacity 0.28s var(--tp-ease, ease), transform 0.28s var(--tp-ease, ease), visibility 0.28s;
}

.tp-chatbot-panel.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.tp-chatbot-header {
    background: linear-gradient(135deg, #072d6b 0%, #2473c2 100%);
    color: #fff;
    padding: 0.95rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.tp-chatbot-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
    overflow: hidden;
}

.tp-chatbot-avatar img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    display: block;
}

.tp-chatbot-header-text h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.2;
}

.tp-chatbot-header-text p {
    margin: 0.15rem 0 0;
    font-size: 0.75rem;
    opacity: 0.88;
}

.tp-chatbot-close {
    margin-left: auto;
    background: transparent;
    border: 0;
    color: #fff;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.85;
    padding: 0.25rem;
}

.tp-chatbot-close:hover {
    opacity: 1;
}

.tp-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: linear-gradient(180deg, #f5f8fc 0%, #eef3f9 100%);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.tp-cb-msg {
    max-width: 88%;
    padding: 0.7rem 0.9rem;
    border-radius: 14px;
    font-size: 0.875rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.tp-cb-msg a {
    color: #1b5fa7;
    font-weight: 500;
}

.tp-cb-msg a.tp-cb-page-link {
    display: inline;
    text-decoration: underline;
    text-underline-offset: 2px;
    word-break: break-all;
    font-weight: 600;
}

.tp-cb-msg a.tp-cb-page-link:hover {
    color: #0d3d7a;
}

.tp-cb-msg.bot {
    align-self: flex-start;
    background: #fff;
    color: #1a1a2e;
    border: 1px solid #e2eaf3;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(15, 45, 90, 0.06);
}

.tp-cb-msg.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #1b5fa7 0%, #2473c2 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.tp-cb-msg.typing {
    display: flex;
    gap: 5px;
    align-items: center;
    padding: 0.85rem 1rem;
}

.tp-cb-msg.typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #2473c2;
    animation: tp-cb-bounce 1.2s infinite ease-in-out;
}

.tp-cb-msg.typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.tp-cb-msg.typing span:nth-child(3) {
    animation-delay: 0.3s;
}

.tp-cb-bot-block {
    align-self: flex-start;
    max-width: 94%;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.tp-cb-bot-block .tp-cb-msg.bot {
    max-width: 100%;
}

.tp-cb-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.15rem 0.1rem 0.25rem;
}

.tp-cb-options-label {
    width: 100%;
    font-size: 0.7rem;
    font-weight: 600;
    color: #6b7c90;
    letter-spacing: 0.02em;
    margin-bottom: 0.1rem;
}

.tp-cb-option {
    border: 1px solid #b7cce6;
    background: #fff;
    color: #1b5fa7;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.4rem 0.7rem;
    border-radius: 999px;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.3;
    text-align: left;
    transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.15s;
}

.tp-cb-option:hover {
    background: #e8f0fb;
    border-color: #2473c2;
    transform: translateY(-1px);
}

.tp-cb-option.is-link {
    background: linear-gradient(135deg, #1b5fa7 0%, #2473c2 100%);
    border-color: transparent;
    color: #fff;
}

.tp-cb-option.is-link:hover {
    background: linear-gradient(135deg, #154a86 0%, #1b5fa7 100%);
    color: #fff;
}

@keyframes tp-cb-bounce {
    0%,
    80%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    40% {
        transform: translateY(-5px);
        opacity: 1;
    }
}

.tp-chatbot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0 1rem 0.65rem;
    background: #eef3f9;
    flex-shrink: 0;
}

.tp-cb-chip {
    border: 1px solid #c5d8ef;
    background: #fff;
    color: #1b5fa7;
    font-size: 0.72rem;
    font-weight: 500;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    font-family: inherit;
}

.tp-cb-chip:hover {
    background: #e8f0fb;
    border-color: #2473c2;
}

.tp-chatbot-input {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    border-top: 1px solid #e2eaf3;
    background: #fff;
    flex-shrink: 0;
}

.tp-chatbot-input input {
    flex: 1;
    border: 1px solid #d0ddea;
    border-radius: 999px;
    padding: 0.55rem 1rem;
    font-size: 0.875rem;
    font-family: inherit;
    outline: none;
    color: #1a1a2e;
}

.tp-chatbot-input input:focus {
    border-color: #2473c2;
    box-shadow: 0 0 0 3px rgba(36, 115, 194, 0.15);
}

.tp-chatbot-input button {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: var(--tp-gradient, linear-gradient(135deg, #2473c2, #0d3d7a));
    color: #fff;
    font-size: 1.05rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s, opacity 0.2s;
}

.tp-chatbot-input button:hover:not(:disabled) {
    transform: scale(1.06);
}

.tp-chatbot-input button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.tp-chatbot-footer {
    text-align: center;
    font-size: 0.65rem;
    color: #8899aa;
    padding: 0 0.75rem 0.55rem;
    background: #fff;
}

@media (max-width: 575.98px) {
    .tp-chatbot {
        right: 0.75rem;
        bottom: 0.75rem;
    }

    .tp-chatbot-panel {
        position: fixed;
        right: 0.5rem;
        left: 0.5rem;
        bottom: 5rem;
        width: auto;
        height: min(70dvh, 520px);
    }

    .back-to-top {
        right: 1rem;
        bottom: 5.75rem;
    }
}
