/* Chat tư vấn AI — styles for the popup built by /theme/assets/js/chat-react.js.
   Everything is scoped to the launcher and #support-chat-popup because this theme does not load Tailwind. */

/*#region Launcher*/
.addThis_listing .addThis_item button.addThis_item--icon,
.actionToolbar_mobile ul.actionToolbar_listing li button {
    padding: 0;
    border: 0;
    background: transparent;
    font: inherit;
}

.addThis_listing .addThis_item button.addThis_item--icon svg {
    display: block;
    width: 44px;
    height: 44px;
}

.addThis_listing .addThis_item button.addThis_item--icon:focus-visible,
.actionToolbar_mobile ul.actionToolbar_listing li button:focus-visible {
    outline: 2px solid #059669;
    outline-offset: 2px;
}

.addThis_listing .addThis_item .support-chat-launcher::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(5, 150, 105, .45);
    animation: support-chat-pulse 2.4s ease-out infinite;
}

@keyframes support-chat-pulse {
    70%, 100% {
        box-shadow: 0 0 0 12px rgba(5, 150, 105, 0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .addThis_listing .addThis_item .support-chat-launcher::before {
        animation: none;
    }
}

/* The mobile toolbar now holds six actions instead of five. */
.actionToolbar_mobile ul.actionToolbar_listing li {
    width: auto;
    flex: 1 1 0;
}

    .actionToolbar_mobile ul.actionToolbar_listing li button {
        display: block;
        width: 100%;
        text-align: center;
        cursor: pointer;
    }

        .actionToolbar_mobile ul.actionToolbar_listing li button svg {
            fill: #059669;
            width: 35px;
            height: 35px;
            display: inline-block;
            vertical-align: middle;
        }
/*#endregion*/

/*#region Popup*/
.support-chat-widget {
    position: fixed;
    right: 84px;
    bottom: 24px;
    z-index: 1050;
    width: 360px;
    max-width: calc(100vw - 16px);
    font-size: 14px;
    line-height: 1.5;
    color: #334155;
}

    .support-chat-widget.hidden {
        display: none;
    }

    .support-chat-widget.is-expanded {
        width: 640px;
    }

.support-chat-card {
    position: relative;
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 20px 40px rgba(15, 23, 42, .18);
}

.support-popup-title {
    margin: 0 72px 4px 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
    color: #0f172a;
    text-transform: none;
}

.support-chat-ai-icon {
    margin-right: 4px;
}

.support-popup-desc {
    margin: 0;
    font-size: 13px;
    color: #64748b;
}

.support-popup-close,
.support-popup-expand {
    position: absolute;
    top: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    font-size: 16px;
    line-height: 1;
    color: #475569;
    cursor: pointer;
}

.support-popup-close {
    right: 12px;
}

.support-popup-expand {
    right: 44px;
}

    .support-popup-close:hover,
    .support-popup-expand:hover {
        background: #f1f5f9;
    }

    .support-popup-close img {
        width: 16px;
        height: 16px;
    }

.support-chat-widget .focus-ring:focus-visible {
    outline: 2px solid #059669;
    outline-offset: 2px;
}

#support-chat-messages {
    height: 260px;
    max-height: calc(100vh - 260px);
    min-height: 120px;
    margin-top: 12px;
    padding: 12px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
}

.support-chat-widget.is-expanded #support-chat-messages {
    height: 60vh;
}

#support-chat-messages > div {
    display: flex;
    margin-top: 8px;
}

    #support-chat-messages > div:first-child {
        margin-top: 0;
    }

#support-chat-messages > .justify-start {
    justify-content: flex-start;
}

#support-chat-messages > .justify-end {
    justify-content: flex-end;
}

#support-chat-messages > div > p {
    max-width: 85%;
    margin: 0;
    padding: 8px 12px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

#support-chat-messages > .justify-start > p {
    border-bottom-left-radius: 4px;
    background: #fff;
    color: #334155;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
}

#support-chat-messages > .justify-end > p {
    border-bottom-right-radius: 4px;
    background: #059669;
    color: #fff;
}

/* Source cards returned with an answer. */
#support-chat-messages > .w-full {
    flex-wrap: wrap;
    gap: 6px;
}

    #support-chat-messages > .w-full > div {
        max-width: 48%;
        padding: 8px;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        background: #fff;
        font-size: 12px;
        line-height: 1.4;
        color: #475569;
    }

    #support-chat-messages > .w-full a {
        font-weight: 600;
        color: #047857;
        text-decoration: underline;
    }

    #support-chat-messages > .w-full span {
        font-weight: 600;
    }

.support-chat-source-image {
    display: block;
    max-width: 100%;
    max-height: 64px;
    margin-bottom: 6px;
    border-radius: 4px;
    object-fit: cover;
}

#support-chat-form {
    display: flex;
    gap: 8px;
    margin: 12px 0 0;
}

#support-chat-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    font-size: 14px;
    color: #0f172a;
}

    #support-chat-input:disabled {
        background: #f1f5f9;
    }

.support-popup-submit {
    flex: 0 0 auto;
    height: 40px;
    padding: 0 16px;
    border: 0;
    border-radius: 8px;
    background: #059669;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
}

    .support-popup-submit:hover {
        background: #047857;
    }

    .support-popup-submit:disabled {
        opacity: .6;
        cursor: not-allowed;
    }

.support-popup-note {
    display: block;
    margin-top: 8px;
    font-size: 11px;
    text-align: center;
    color: #94a3b8;
}

    .support-popup-note a {
        color: inherit;
        text-decoration: underline;
    }

@media only screen and (max-width: 600px) {
    .support-chat-widget,
    .support-chat-widget.is-expanded {
        right: 8px;
        left: 8px;
        bottom: 53px; /* sits above the 45px mobile action toolbar */
        width: auto;
        max-width: none;
    }

    .support-chat-widget.is-expanded #support-chat-messages {
        height: calc(100vh - 260px);
    }
}
/*#endregion*/
