.ns-ai-assistant {
    --ns-ai-primary: #087f83;
    --ns-ai-secondary: #18bfc7;
    --ns-ai-accent: #00afa8;
    --ns-ai-light: #f4fafa;
    --ns-ai-user: #ddf6f2;
    --ns-ai-assistant: #f1f5f7;
    --ns-ai-ink: #263d43;
    --ns-ai-muted: #71858a;
    --ns-ai-border: #e1eaec;
    color: var(--ns-ai-ink);
    font-family: inherit;
    direction: rtl;
}

.ns-ai-assistant *,
.ns-ai-assistant *::before,
.ns-ai-assistant *::after {
    box-sizing: border-box;
}

.ns-ai-launcher {
    position: fixed;
    z-index: 9998;
    right: 22px;
    bottom: 22px;
    display: grid;
    width: 70px;
    height: 70px;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--ns-ai-secondary), var(--ns-ai-primary));
    box-shadow: 0 8px 24px rgba(8, 127, 131, .24);
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease;
}

.ns-ai-launcher:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 12px 28px rgba(8, 127, 131, .3);
}

.ns-ai-launcher:active {
    transform: scale(.96);
}

.ns-ai-launcher img {
    width: 51px;
    height: 51px;
    object-fit: contain;
    border-radius: 50%;
    background: transparent;
}

.ns-ai-launcher-status {
    position: absolute;
    inset-block-start: 2px;
    inset-inline-start: 2px;
    width: 15px;
    height: 15px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #16c784;
}

.ns-ai-assistant[data-launcher-side="left"] .ns-ai-launcher,
.ns-ai-assistant[data-launcher-side="left"] .ns-ai-panel {
    right: auto;
    left: 22px;
}

.ns-ai-panel {
    position: fixed;
    z-index: 9999;
    right: 22px;
    bottom: 106px;
    display: flex;
    width: min(450px, calc(100vw - 32px));
    height: min(690px, calc(100dvh - 132px));
    min-height: 390px;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(225, 234, 236, .95);
    border-radius: 23px;
    background: #fff;
    box-shadow: 0 18px 55px rgba(32, 74, 83, .17);
    animation: ns-ai-panel-in .22s ease-out both;
}

.ns-ai-panel[hidden] {
    display: none;
}

.ns-ai-header {
    position: relative;
    display: flex;
    min-height: 112px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    overflow: hidden;
    background: linear-gradient(115deg, #087f83, #056c73 70%, #075d68);
    color: #fff;
}

.ns-ai-header::after {
    position: absolute;
    inset-inline-start: -24px;
    bottom: -34px;
    width: 190px;
    height: 60px;
    border-radius: 50%;
    background: rgba(24, 191, 199, .25);
    content: "";
}

.ns-ai-brand,
.ns-ai-header-actions {
    position: relative;
    z-index: 1;
}

.ns-ai-brand {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 12px;
}

.ns-ai-brand-logo {
    width: 60px;
    height: 60px;
    flex: 0 0 auto;
    border: 2px solid rgba(255, 255, 255, .75);
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
    object-fit: contain;
}

.ns-ai-brand-copy {
    min-width: 0;
}

.ns-ai-title {
    margin: 0;
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.45;
}

.ns-ai-subtitle {
    margin: 3px 0 5px;
    color: rgba(255, 255, 255, .82);
    font-size: 11px;
    line-height: 1.5;
}

.ns-ai-online {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, .95);
    font-size: 11px;
}

.ns-ai-online i,
.ns-ai-footer-meta::after {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22d27b;
}

.ns-ai-header-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 7px;
}

.ns-ai-header button,
.ns-ai-feedback button,
.ns-ai-copy {
    display: inline-grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .32);
    border-radius: 11px;
    background: rgba(255, 255, 255, .09);
    color: inherit;
    cursor: pointer;
    transition: background .16s ease, transform .16s ease;
}

.ns-ai-header button:hover {
    background: rgba(255, 255, 255, .2);
    transform: translateY(-1px);
}

.ns-ai-header button svg,
.ns-ai-send svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.ns-ai-messages {
    display: flex;
    min-height: 0;
    flex: 1;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
    padding: 20px 17px;
    background:
        radial-gradient(ellipse at 10% 12%, rgba(24, 191, 199, .045), transparent 35%),
        var(--ns-ai-light);
    overscroll-behavior: contain;
    scrollbar-color: #bed6d8 transparent;
    scrollbar-width: thin;
}

.ns-ai-message-row {
    display: flex;
    width: 100%;
    align-items: flex-end;
    gap: 9px;
    animation: ns-ai-message-in .18s ease-out both;
}

.ns-ai-message-row-user {
    direction: ltr;
    justify-content: flex-start;
}

.ns-ai-message-row-assistant,
.ns-ai-message-row-pending,
.ns-ai-message-row-error {
    justify-content: flex-start;
}

.ns-ai-message-avatar {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--ns-ai-secondary), var(--ns-ai-primary));
    object-fit: contain;
    box-shadow: 0 2px 8px rgba(38, 61, 67, .1);
}

.ns-ai-message-user-avatar {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    place-items: center;
    border-radius: 50%;
    background: #d3f0ed;
    color: var(--ns-ai-primary);
}

.ns-ai-message-user-avatar svg {
    width: 19px;
    height: 19px;
    fill: currentColor;
}

.ns-ai-message {
    width: fit-content;
    max-width: min(86%, 355px);
    min-width: 80px;
    border: 1px solid rgba(225, 234, 236, .72);
    border-radius: 18px;
    padding: 12px 14px 9px;
    overflow-wrap: anywhere;
    color: var(--ns-ai-ink);
    line-height: 1.8;
}

.ns-ai-message-user {
    border-color: #d0eee9;
    border-end-end-radius: 6px;
    background: var(--ns-ai-user);
}

.ns-ai-message-assistant,
.ns-ai-message-pending,
.ns-ai-message-error {
    border-end-start-radius: 6px;
    background: var(--ns-ai-assistant);
}

.ns-ai-message-error {
    color: #9c3d3d;
}

.ns-ai-message-content {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.ns-ai-message-content > :first-child {
    margin-block-start: 0;
}

.ns-ai-message-content > :last-child {
    margin-block-end: 0;
}

.ns-ai-message-content p,
.ns-ai-message-content ul,
.ns-ai-message-content ol,
.ns-ai-message-content blockquote,
.ns-ai-message-content pre,
.ns-ai-message-content table {
    margin: 0 0 9px;
}

.ns-ai-message-content ul,
.ns-ai-message-content ol {
    padding-inline-start: 22px;
}

.ns-ai-message-content a {
    color: #067b80;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ns-ai-message-content a .ns-ai-page-link-icon {
    font-size: .8em;
    margin-inline-start: .35em;
    text-decoration: none;
}

.ns-ai-message-content code {
    border-radius: 5px;
    background: #e4ecee;
    padding: 2px 5px;
    direction: ltr;
    unicode-bidi: plaintext;
    font-family: Consolas, monospace;
    font-size: .9em;
}

.ns-ai-message-content pre {
    max-width: 100%;
    overflow: auto;
    border: 1px solid var(--ns-ai-border);
    border-radius: 9px;
    background: #e8eff1;
    padding: 10px;
    direction: ltr;
    text-align: left;
}

.ns-ai-message-content pre code {
    background: transparent;
    padding: 0;
}

.ns-ai-message-content blockquote {
    border-inline-start: 3px solid var(--ns-ai-secondary);
    padding-inline-start: 10px;
    color: var(--ns-ai-muted);
}

.ns-ai-message-content table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
}

.ns-ai-message-content th,
.ns-ai-message-content td {
    border: 1px solid var(--ns-ai-border);
    padding: 5px 8px;
    white-space: nowrap;
}

.ns-ai-message-content th {
    background: #e6eff0;
}

.ns-ai-message-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 5px;
    color: var(--ns-ai-muted);
    font-size: 10px;
    line-height: 1.4;
}

.ns-ai-message-user .ns-ai-message-meta {
    justify-content: flex-start;
}

.ns-ai-feedback {
    display: flex;
    align-items: center;
    gap: 5px;
}

.ns-ai-feedback button,
.ns-ai-copy {
    width: 29px;
    height: 29px;
    border-color: #dce5e8;
    border-radius: 9px;
    background: rgba(255, 255, 255, .72);
    color: var(--ns-ai-ink);
}

.ns-ai-feedback button:hover,
.ns-ai-copy:hover {
    background: #fff;
    color: var(--ns-ai-primary);
}

.ns-ai-feedback button:disabled {
    cursor: default;
    opacity: .6;
}

.ns-ai-feedback svg,
.ns-ai-copy svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.ns-ai-welcome {
    max-width: 100%;
}

.ns-ai-welcome .ns-ai-message-content {
    font-size: 14px;
}

.ns-ai-welcome-actions {
   /* display: flex;*/
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 12px;
}

.ns-ai-quick-action {
    border: 1px solid #dce7e9;
    border-radius: 999px;
    background: #fff;
    color: var(--ns-ai-ink);
    cursor: pointer;
    padding: 7px 7px;
    font: inherit;
    font-size: 11px;
    transition: border-color .16s ease, color .16s ease, transform .16s ease;
}

.ns-ai-quick-action:hover {
    transform: translateY(-1px);
    border-color: var(--ns-ai-secondary);
    color: var(--ns-ai-primary);
}

.ns-ai-pending-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    min-height: 18px;
    color: var(--ns-ai-secondary);
}

.ns-ai-pending-indicator i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    animation: ns-ai-typing 1s infinite ease-in-out;
}

.ns-ai-pending-indicator i:nth-child(2) {
    animation-delay: .16s;
}

.ns-ai-pending-indicator i:nth-child(3) {
    animation-delay: .32s;
}

.ns-ai-footer {
    flex: 0 0 auto;
    border-top: 1px solid var(--ns-ai-border);
    background: #fff;
    padding: 11px 14px max(11px, env(safe-area-inset-bottom));
}

.ns-ai-form {
    display: flex;
    flex-wrap: wrap;
    min-height: 54px;
    align-items: flex-end;
    gap: 9px;
    border: 1px solid #d9e4e6;
    border-radius: 18px;
    background: #fff;
    padding: 7px 8px 7px 7px;
    box-shadow: 0 2px 8px rgba(38, 61, 67, .04);
    transition: border-color .18s ease, box-shadow .18s ease;
}

.ns-ai-form:focus-within {
    border-color: rgba(8, 127, 131, .55);
    box-shadow: 0 0 0 3px rgba(8, 127, 131, .09);
}

.ns-ai-assistant .ns-ai-input {
    display: block;
    min-width: 0;
    height: 36px;
    min-height: 36px;
    max-height: 120px;
    flex: 1 1 calc(100% - 60px);
    resize: none;
    border: 0;
    outline: 0;
    background: transparent;
    box-shadow: none;
    color: var(--ns-ai-ink);
    padding: 7px 8px;
    font: inherit;
    line-height: 1.5;
}

.ns-ai-assistant .ns-ai-input:focus {
    border: 0;
    outline: 0;
    box-shadow: none;
}

.ns-ai-assistant .ns-ai-input::placeholder {
    color: #8b9b9f;
}

.ns-ai-send {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    order: 1;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--ns-ai-secondary), var(--ns-ai-primary));
    color: #fff;
    cursor: pointer;
    transition: filter .16s ease, transform .16s ease, opacity .16s ease;
}

.ns-ai-send:hover:not(:disabled) {
    filter: brightness(1.05);
    transform: scale(1.04);
}

.ns-ai-send:disabled {
    cursor: wait;
    opacity: .55;
}

.ns-ai-assistant .ns-ai-form > small {
    order: 2;
}

.ns-ai-footer-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    position: relative;
    padding: 9px 3px 0;
}

.ns-ai-support-links {
    position: absolute;
    right: 40%;
    display: flex;
    align-items: center;
    gap: 7px;
}

.ns-ai-support-links a {
    position: relative;
    display: inline-grid;
    width: 24px;
    height: 24px;
    place-items: center;
    background: #fff;
    color: var(--ns-ai-primary);
    text-decoration: none;
    transition: border-color .16s ease, background .16s ease, color .16s ease, transform .16s ease;
    margin-bottom: 4px;
    opacity: 0.7;
}

.ns-ai-support-links a:hover {
    border-color: var(--ns-ai-secondary);
    background: #effafb;
    color: var(--ns-ai-secondary);
    transform: translateY(-1px);
    opacity: 1;
}

.ns-ai-support-links i {
    font-size: 22px;
    line-height: 1;
}

.ns-ai-support-links .icon-whatsapp {
    color: #25D366;
}

.ns-ai-support-links .icon-telegram {
    color: #1976d2;
}

.ns-ai-support-links a::after {
    position: absolute;
    inset-block-end: calc(100% + 7px);
    left: 50%;
    width: max-content;
    max-width: 150px;
    border-radius: 7px;
    background: var(--ns-ai-ink);
    color: #fff;
    content: attr(data-tooltip);
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
    opacity: 0;
    padding: 7px 8px;
    pointer-events: none;
    transform: translate(-50%, 4px);
    transition: opacity .16s ease, transform .16s ease;
    white-space: nowrap;
}

.ns-ai-support-links a:hover::after,
.ns-ai-support-links a:focus-visible::after {
    opacity: 1;
    transform: translate(-50%, 0);
}

.ns-ai-site-brand {
    color: #325660;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.ns-ai-site-brand i {
    display: inline-grid;
    width: 19px;
    height: 19px;
    place-items: center;
    border-radius: 6px 6px 8px 8px;
    background: linear-gradient(145deg, var(--ns-ai-secondary), var(--ns-ai-primary));
    color: #fff;
    font-size: 12px;
    font-style: normal;
}

.ns-ai-privacy {
    margin: 0;
    color: var(--ns-ai-muted);
    font-size: 10px;
    line-height: 1.5;
    text-align: end;
}

@keyframes ns-ai-panel-in {
    from { opacity: 0; transform: translateY(10px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes ns-ai-message-in {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes ns-ai-typing {
    0%, 60%, 100% { opacity: .38; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-3px); }
}

@media (max-width: 600px) {
    .ns-ai-welcome .ns-ai-message-content {
        font-size: 12px;
    }
    .ns-ai-support-links {
        position: absolute;
        right: 33%;
    }
    .ns-ai-launcher {
        right: 16px;
        bottom: max(16px, env(safe-area-inset-bottom));
        width: 60px;
        height: 60px;
    }

    .ns-ai-launcher img {
        width: 46px;
        height: 46px;
    }

    .ns-ai-assistant[data-launcher-side="left"] .ns-ai-launcher {
        right: auto;
        left: 16px;
    }

    .ns-ai-panel {
        top: auto;
        right: 16px;
        bottom: calc(98px + env(safe-area-inset-bottom));
        left: auto;
        width: min(400px, calc(100vw - 32px));
        height: min(72dvh, 640px);
        min-height: min(420px, calc(100dvh - 120px));
        border: 1px solid rgba(225, 234, 236, .95);
        border-radius: 20px;
    }

    .ns-ai-assistant[data-launcher-side="left"] .ns-ai-panel {
        right: auto;
        left: 16px;
    }

    .ns-ai-header {
        min-height: 100px;
        padding: max(13px, env(safe-area-inset-top)) 14px 13px;
    }

    .ns-ai-brand-logo {
        width: 52px;
        height: 52px;
    }

    .ns-ai-title {
        font-size: 15px;
    }

    .ns-ai-subtitle {
        max-width: 230px;
        font-size: 10px;
    }

    .ns-ai-messages {
        padding: 16px 12px;
    }

    .ns-ai-message {
        max-width: 88%;
    }

    .ns-ai-footer {
        padding-bottom: max(11px, env(safe-area-inset-bottom));
    }

}

@media (prefers-reduced-motion: reduce) {
    .ns-ai-assistant *,
    .ns-ai-assistant *::before,
    .ns-ai-assistant *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
