:root {
    --chat-primary: #16a34a;        /* xanh chính */
    --chat-primary-dark: #15803d;   /* xanh đậm */
    --chat-primary-light: #4ade80;  /* xanh nhạt (thêm mới) */
    --chat-bg: #f8fafc;
    --chat-border: #dbe5f1;
    --chat-text: #0f172a;
    --chat-muted: #64748b;
    --chat-white: #ffffff;
    --chat-shadow: 0 18px 45px rgba(15, 23, 42, 0.18);
}

.txacb-root,
.txacb-root * {
    box-sizing: border-box;
}

.txacb-shortcode-wrap {
    position: relative;
    min-height: 1px;
}

.txacb-root .chat-launcher {
    position: fixed;
    right: 22px;
    bottom: 85px;
    z-index: 9999;
    width: 90px;
    height: 90px;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    background-color: transparent;
    overflow: hidden;
    color: var(--chat-white);
    box-shadow: 0 16px 32px rgba(29, 78, 216, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/*.txacb-root .chat-launcher:hover {*/
/*    transform: translateY(-2px);*/
/*    box-shadow: 0 20px 36px rgba(29, 78, 216, 0.4);*/
/*}*/

.txacb-root .chat-launcher svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

.txacb-root .chat-widget {
    position: fixed;
    right: 22px;
    bottom: 98px;
    z-index: 9998;
    width: min(400px, calc(100vw - 24px));
    height: min(700px, calc(100vh - 124px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 22px;
    border: 1px solid var(--chat-border);
    background: var(--chat-white);
    box-shadow: var(--chat-shadow);
    opacity: 0;
    transform: translateY(10px) scale(0.98);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.txacb-root .chat-widget.is-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.txacb-root .chat-header {
    padding: 18px 18px 16px;
    background: linear-gradient(135deg, var(--chat-primary) 0%, var(--chat-primary-dark) 100%);
    color: var(--chat-white);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.txacb-root .chat-header-main h2 {
    margin: 0 0 4px;
    font-size: 18px;
}

.txacb-root .chat-header-main p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    opacity: 0.95;
}

.txacb-root .chat-header-actions {
    display: flex;
    gap: 8px;
}

.txacb-root .chat-icon-btn {
    border: 0;
    background: rgba(255, 255, 255, 0.14);
    color: var(--chat-white);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
}

.txacb-root .chat-body {
    flex: 1;
    padding: 16px;
    background: linear-gradient(180deg, #f8fbff 0%, #f7f9fc 100%);
    overflow-y: auto;
    scroll-behavior: smooth;
}

.txacb-root .chat-message {
    max-width: 86%;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.txacb-root .chat-message.bot {
    align-items: flex-start;
}

.txacb-root .chat-message.user {
    margin-left: auto;
    align-items: flex-end;
}

.txacb-root .chat-bubble {
    padding: 11px 13px;
    border-radius: 16px;
    line-height: 1.6;
    font-size: 14px;
    white-space: pre-wrap;
    word-break: break-word;
    box-shadow: 0 7px 18px rgba(15, 23, 42, 0.05);
}

.txacb-root .chat-message.bot .chat-bubble {
    background: var(--chat-white);
    border: 1px solid #e2e8f0;
    color: var(--chat-text);
    border-bottom-left-radius: 6px;
}

.txacb-root .chat-message.user .chat-bubble {
    background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-dark));
    color: var(--chat-white);
    border-bottom-right-radius: 6px;
}

.txacb-root .chat-meta {
    font-size: 11px;
    color: var(--chat-muted);
    padding: 0 4px;
}

.txacb-root .chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 4px 0 14px;
}

.txacb-root .chat-suggestion-btn,
.txacb-root .chat-action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    background: #ecfdf5;
    border: 1px solid #bbf7d0;
    color: var(--chat-primary-dark);
    border-radius: 999px;
    padding: 9px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.txacb-root .chat-suggestion-btn:hover,
.txacb-root .chat-action-link:hover {
    background: rgba(74, 222, 128, 0.15);
    border-color: var(--chat-primary-light);
    transform: translateY(-1px);
}

.txacb-root .chat-footer {
    padding: 12px;
    border-top: 1px solid #e2e8f0;
    background: var(--chat-white);
}

.txacb-root .chat-input-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.txacb-root .chat-input {
    flex: 1;
    min-height: 46px;
    max-height: 120px;
    resize: none;
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    padding: 12px 14px;
    font: inherit;
    outline: none;
    color: var(--chat-text);
    background: #fff;
}

.txacb-root .chat-input:focus {
    border-color: #4ade80;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15);
}

.txacb-root .chat-input:disabled,
.txacb-root .chat-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.txacb-root .chat-send {
    height: 46px;
    min-width: 46px;
    border: 0;
    border-radius: 14px;
    cursor: pointer;
    background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-dark));
    color: var(--chat-white);
    font-size: 18px;
    box-shadow: 0 10px 22px rgba(29, 78, 216, 0.25);
}

.txacb-root .chat-hint {
    margin-top: 8px;
    color: var(--chat-muted);
    font-size: 12px;
    line-height: 1.5;
}

.txacb-root .chat-typing {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.txacb-root .chat-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #94a3b8;
    animation: chatTyping 1s infinite ease-in-out;
}

.txacb-root .chat-typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.txacb-root .chat-typing span:nth-child(3) {
    animation-delay: 0.3s;
}


.txacb-admin-wrap {
    max-width: 1200px;
}

.txacb-admin-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

.txacb-admin-card {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

.txacb-admin-card h2 {
    margin-top: 0;
}

.txacb-admin-card-full {
    margin-bottom: 20px;
}

.txacb-json-editor {
    width: 100%;
    min-height: 640px;
    font-family: Consolas, Monaco, monospace;
    font-size: 13px;
    line-height: 1.6;
    padding: 14px;
    border: 1px solid #c3c4c7;
    border-radius: 10px;
    background: #0f172a;
    color: #e2e8f0;
}

.txacb-json-wrapper {
    border: 1px solid #d1d5db;
    border-radius: 10px;
    overflow: hidden;
    background: #0f172a;
}

.txacb-json-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #111827;
    padding: 10px 12px;
    border-bottom: 1px solid #1f2937;
}

.txacb-json-toolbar button {
    background: #2563eb;
    color: #fff;
    border: 0;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
}

.txacb-json-toolbar button:hover {
    background: #1d4ed8;
}

.txacb-json-status {
    font-size: 12px;
    font-weight: 500;
}

.txacb-json-status.valid {
    color: #22c55e;
}

.txacb-json-status.invalid {
    color: #ef4444;
}

.txacb-json-editor {
    width: 100%;
    height: 420px;
    border: 0;
    outline: none;
    resize: vertical;
    padding: 14px;
    font-family: "Fira Code", monospace;
    font-size: 13px;
    line-height: 1.6;
    background: #0f172a;
    color: #e5e7eb;
}

#txacb-json-error {
    background: #111827;
    color: #ef4444;
    font-size: 12px;
    padding: 8px 12px;
    border-top: 1px solid #1f2937;
    display: none;
}

@media (max-width: 960px) {
    .txacb-admin-grid {
        grid-template-columns: 1fr;
    }
}



@keyframes chatTyping {
    0%,
    80%,
    100% {
        transform: scale(0.7);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@media (max-width: 640px) {
    .txacb-root .chat-widget {
        right: 12px;
        bottom: 88px;
        width: calc(100vw - 24px);
        height: calc(100vh - 110px);
    }

    .txacb-root .chat-launcher {
        right: 14px;
        bottom: 14px;
    }
}
