.nc-chatbot {
    position: fixed;
    bottom: 1.75rem;
    right: 1.75rem;
    z-index: 9999999999;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

.nc-chatbot__launcher {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
    box-shadow: 0 18px 38px rgba(37, 99, 235, 0.28);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.nc-chatbot__launcher:hover,
.nc-chatbot__launcher:focus-visible {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 22px 44px rgba(124, 58, 237, 0.33);
}

.nc-chatbot__launcher:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.45);
    outline-offset: 4px;
}

.nc-chatbot__launcher-glow {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.3);
    animation: nc-chatbot-pulse 2.4s infinite;
    pointer-events: none;
}

.nc-chatbot__launcher-stars {
    position: absolute;
    top: -0.35rem;
    right: -0.25rem;
    width: 1.45rem;
    height: 1.45rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #facc15, #fb923c);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 24px rgba(250, 204, 21, 0.4);
    color: #fff;
    transition: transform 0.2s ease;
    pointer-events: none;
}

.nc-chatbot__launcher-stars svg {
    width: 1.05rem;
    height: 1.05rem;
}

.nc-chatbot__launcher:hover .nc-chatbot__launcher-stars,
.nc-chatbot__launcher:focus-visible .nc-chatbot__launcher-stars {
    transform: translateY(-2px) scale(1.05);
}

@keyframes nc-chatbot-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.34);
    }
    70% {
        box-shadow: 0 0 0 16px rgba(37, 99, 235, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
    }
}

.nc-chatbot__launcher-icon svg {
    width: 1.75rem;
    height: 1.75rem;
}

.nc-chatbot__overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.nc-chatbot__panel {
    position: fixed;
    bottom: 5.5rem;
    right: 2.5rem;
    width: min(360px, calc(100vw - 2.5rem));
    height: min(560px, calc(100vh - 8.5rem));
    max-height: calc(100vh - 8.5rem);
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 26px 60px rgba(15, 23, 42, 0.24);
    display: flex;
    flex-direction: column;
    transform: translateY(8px) scale(0.94);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

.nc-chatbot.is-open .nc-chatbot__overlay {
    opacity: 1;
    pointer-events: auto;
}

.nc-chatbot.is-open .nc-chatbot__panel {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

.nc-chatbot__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 1.05rem 0.75rem;
    border-bottom: 1px solid #e2e8f0;
}

.nc-chatbot__agent {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.nc-chatbot__avatar {
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 20px;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.4);
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    animation: nc-chatbot-avatar-float 4s ease-in-out infinite;
}

.nc-chatbot__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
    display: block;
}

.nc-chatbot__title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #0f172a;
}

.nc-chatbot__status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.15rem;
    font-size: 0.78rem;
    color: #38a169;
    transition: color 0.2s ease;
}

.nc-chatbot__status[data-variant='busy'] {
    color: #7c3aed;
}

.nc-chatbot__status[data-variant='error'] {
    color: #dc2626;
}

.nc-chatbot__status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: currentColor;
    box-shadow: 0 0 0 4px rgba(56, 161, 105, 0.15);
}

.nc-chatbot__status[data-variant='busy']::before {
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.22);
}

.nc-chatbot__status[data-variant='error']::before {
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.2);
}

.nc-chatbot__close {
    border: none;
    background: #f1f5f9;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #475569;
    transition: background 0.2s ease, color 0.2s ease;
}

.nc-chatbot__close:hover,
.nc-chatbot__close:focus-visible {
    background: #e2e8f0;
    color: #0f172a;
}

.nc-chatbot__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0.9rem 1.05rem;
    overflow: hidden;
    gap: 0.6rem;
}

.nc-chatbot__messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding-right: 0.3rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(124, 58, 237, 0.4) transparent;
}

.nc-chatbot__messages::-webkit-scrollbar {
    width: 6px;
}

.nc-chatbot__messages::-webkit-scrollbar-thumb {
    background: rgba(124, 58, 237, 0.36);
    border-radius: 999px;
}

.nc-chatbot__message {
    max-width: 86%;
    padding: 0.55rem 0.9rem;
    border-radius: 16px;
    font-size: 0.88rem;
    line-height: 1.5;
    background: #f1f5f9;
    color: #0f172a;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
    align-self: flex-start;
    position: relative;
    word-break: break-word;
    overflow-wrap: anywhere;
    will-change: transform, opacity;
}

.nc-chatbot__message p {
    margin: 0 0 0.65rem;
    line-height: 1.55;
}

.nc-chatbot__message p:last-child {
    margin-bottom: 0;
}

.nc-chatbot__message.is-new {
    animation: nc-chatbot-bubble-in 0.38s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

@keyframes nc-chatbot-bubble-in {
    0% {
        transform: translateY(14px) scale(0.94);
        opacity: 0;
        filter: blur(2px);
    }
    60% {
        transform: translateY(-4px) scale(1.02);
        opacity: 1;
        filter: blur(0);
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
        filter: blur(0);
    }
}

.nc-chatbot__message--user {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
    align-self: flex-end;
}

.nc-chatbot__message--assistant {
    background: linear-gradient(135deg, #f6f0ff 0%, #eef7ff 100%);
    border: 1px solid rgba(59, 130, 246, 0.08);
}

.nc-chatbot__message--system {
    align-self: center;
    background: transparent;
    color: #64748b;
    box-shadow: none;
    font-size: 0.85rem;
}

.nc-chatbot__typing {
    display: none;
    align-items: center;
    gap: 0.3rem;
    padding: 0.28rem 0.55rem;
    border-radius: 999px;
    background: rgba(124, 58, 237, 0.12);
    color: #6d28d9;
    width: fit-content;
    align-self: flex-start;
    margin-left: 0.25rem;
    transition: opacity 0.2s ease;
}

.nc-chatbot__typing.is-active {
    display: inline-flex;
}

.nc-chatbot__typing[hidden] {
    display: none !important;
}

.nc-chatbot__typing span {
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: currentColor;
    opacity: 0.4;
    animation: nc-chatbot-typing 1.2s infinite;
}

.nc-chatbot__typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.nc-chatbot__typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes nc-chatbot-typing {
    0%, 80%, 100% {
        opacity: 0.4;
        transform: translateY(0);
    }
    40% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

.nc-chatbot__chips {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.4rem;
    overflow-x: auto;
    padding: 0.3rem 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    mask-image: linear-gradient(to right, transparent, black 16px, black calc(100% - 16px), transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 16px, black calc(100% - 16px), transparent);
}

.nc-chatbot__chips::-webkit-scrollbar {
    display: none;
}

.nc-chatbot__chip {
    border: none;
    border-radius: 999px;
    padding: 0.28rem 0.8rem;
    font-size: 0.8rem;
    cursor: pointer;
    background: #e5f1ff;
    color: #1e3a8a;
    transition: background 0.2s ease, color 0.2s ease;
    flex: 0 0 auto;
    white-space: nowrap;
}

.nc-chatbot__chip:hover,
.nc-chatbot__chip:focus-visible {
    background: #d5bfff;
    color: #5b21b6;
}

.nc-chatbot__form {
    display: flex;
    align-items: flex-end;
    gap: 0.6rem;
    padding: 0.75rem 1.05rem 1rem;
    border-top: 1px solid #e2e8f0;
    margin-block-end: 0 !important;

}

.nc-chatbot__form textarea {
    flex: 1;
    min-height: 44px;
    max-height: 160px;
    padding: 0.55rem 0.75rem;
    border-radius: 16px;
    border: 1px solid #cce4ff;
    background: #f8fafc;
    resize: none;
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 0 !important;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.nc-chatbot__form textarea:focus-visible {
    outline: none;
    border-color: #2563eb;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.nc-chatbot__send {
    width: 3rem;
    height: 3rem;
    border-radius: 999px;
    border: none;
    background: linear-gradient(140deg, #2563eb, #7c3aed);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.nc-chatbot__send[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

.nc-chatbot__send svg {
    width: 1.25rem;
    height: 1.25rem;
}

.nc-chatbot.is-busy .nc-chatbot__send {
    transform: scale(0.95);
}

@media (max-width: 782px) {
    .nc-chatbot {
        bottom: 1.25rem;
        right: 1.25rem;
    }

    .nc-chatbot__panel {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: min(100vh, 640px);
        max-height: 100vh;
        border-radius: 24px 24px 0 0;
    }
}


.nc-chatbot--rtl .nc-chatbot__panel {
    direction: rtl;
}

.nc-chatbot--rtl .nc-chatbot__header {
    flex-direction: row;
}

.nc-chatbot--rtl .nc-chatbot__agent {
    text-align: right;
}

.nc-chatbot--rtl .nc-chatbot__meta {
    text-align: right;
}

.nc-chatbot--rtl .nc-chatbot__chips {
    flex-direction: row-reverse;
    justify-content: flex-start;
    mask-image: linear-gradient(to left, transparent, black 16px, black calc(100% - 16px), transparent);
    -webkit-mask-image: linear-gradient(to left, transparent, black 16px, black calc(100% - 16px), transparent);
}

.nc-chatbot--rtl .nc-chatbot__message {
    text-align: right;
}

.nc-chatbot--rtl .nc-chatbot__message--user {
    align-self: flex-start;
}

.nc-chatbot--rtl .nc-chatbot__message--assistant {
    align-self: flex-end;
}

.nc-chatbot--rtl .nc-chatbot__form {
    flex-direction: row-reverse;
}

.nc-chatbot--rtl .nc-chatbot__form textarea {
    text-align: right;
}

.nc-chatbot--rtl .nc-chatbot__chips .nc-chatbot__chip {
    direction: rtl;
}

.nc-chatbot__message p {
    margin: 0 0 0.65rem;
    line-height: 1.55;
}

.nc-chatbot__message p:last-child {
    margin-bottom: 0;
}


@keyframes nc-chatbot-avatar-float {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-6px) scale(1.03);
    }
}
