.nb-chat {
    position: fixed;
    right: 1rem;
    bottom: 5.5rem;
    z-index: 130;
    font-family: "Source Sans 3", Arial, sans-serif;
}

.wa-dropdown.wa-float-wrap.wa-float-stacked {
    bottom: 10rem;
}

.nb-chat .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.nb-chat-toggle {
    position: relative;
    width: 3.7rem;
    height: 3.7rem;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, #0b376d, #0f8a95);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(11, 55, 109, 0.35);
    transition: transform 0.15s ease;
}

.nb-chat-toggle:hover {
    transform: scale(1.05);
}

.nb-chat-toggle svg {
    width: 1.8rem;
    height: 1.8rem;
}

.nb-chat-icon-close,
.nb-chat.is-open .nb-chat-icon-open {
    display: none;
}

.nb-chat.is-open .nb-chat-icon-close {
    display: block;
}

.nb-chat-tip {
    position: absolute;
    right: calc(100% + 0.65rem);
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
    background: #102a43;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.4rem 0.7rem;
    border-radius: 0.5rem;
    box-shadow: 0 8px 18px rgba(16, 42, 67, 0.2);
    animation: nb-chat-tip 7s ease 2s both;
    pointer-events: none;
}

.nb-chat.is-open .nb-chat-tip,
.nb-chat.tip-seen .nb-chat-tip {
    display: none;
}

@keyframes nb-chat-tip {
    0%, 100% { opacity: 0; }
    8%, 85% { opacity: 1; }
}

.nb-chat-panel {
    position: absolute;
    right: 0;
    bottom: calc(100% + 0.75rem);
    width: min(23rem, calc(100vw - 1.5rem));
    height: min(34rem, calc(100vh - 9rem));
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #d9e4ef;
    border-radius: 1rem;
    box-shadow: 0 24px 60px rgba(15, 38, 64, 0.28);
    overflow: hidden;
}

.nb-chat-panel[hidden] {
    display: none;
}

.nb-chat-head {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.85rem 1rem;
    background: linear-gradient(135deg, #0b376d, #0f8a95);
    color: #fff;
}

.nb-chat-avatar {
    width: 2.3rem;
    height: 2.3rem;
    border-radius: 999px;
    background: #fff;
    color: #0b376d;
    font-family: "Sora", Arial, sans-serif;
    font-weight: 800;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.nb-chat-head-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    flex: 1;
}

.nb-chat-head-text strong {
    font-family: "Sora", Arial, sans-serif;
    font-size: 0.98rem;
}

.nb-chat-head-text span {
    font-size: 0.8rem;
    opacity: 0.9;
}

.nb-chat-dot {
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 999px;
    background: #4ade80;
    margin-right: 0.2rem;
}

.nb-chat-close {
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.2rem;
}

.nb-chat-log {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    background: #f5f8fc;
}

.nb-chat-msg {
    max-width: 85%;
    padding: 0.6rem 0.8rem;
    border-radius: 0.9rem;
    font-size: 0.95rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.nb-chat-msg.bot {
    align-self: flex-start;
    background: #fff;
    color: #102a43;
    border: 1px solid #e1e9f2;
    border-bottom-left-radius: 0.3rem;
}

.nb-chat-msg.user {
    align-self: flex-end;
    background: #0b376d;
    color: #fff;
    border-bottom-right-radius: 0.3rem;
}

.nb-chat-msg a {
    color: #0f8a95;
    font-weight: 600;
    word-break: break-all;
}

.nb-chat-msg.user a {
    color: #bfefff;
}

.nb-chat-msg.success {
    border-color: #addfc0;
    background: #f1fbf5;
}

.nb-chat-typing {
    display: inline-flex;
    gap: 0.25rem;
}

.nb-chat-typing i {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 999px;
    background: #9fb3c8;
    animation: nb-chat-bounce 1s infinite ease-in-out;
}

.nb-chat-typing i:nth-child(2) { animation-delay: 0.15s; }
.nb-chat-typing i:nth-child(3) { animation-delay: 0.3s; }

@keyframes nb-chat-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
    40% { transform: translateY(-4px); opacity: 1; }
}

.nb-chat-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.55rem 0.8rem 0;
    background: #fff;
}

.nb-chat-quick[hidden] {
    display: none;
}

.nb-chat-chip {
    border: 1px solid #c9d8e8;
    background: #f8fbff;
    color: #0b376d;
    border-radius: 999px;
    padding: 0.32rem 0.7rem;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
}

.nb-chat-chip:hover {
    background: #0b376d;
    border-color: #0b376d;
    color: #fff;
}

.nb-chat-form {
    display: flex;
    gap: 0.5rem;
    padding: 0.65rem 0.8rem;
    background: #fff;
}

.nb-chat-form input {
    flex: 1;
    min-width: 0;
    border: 1px solid #c9d8e8;
    border-radius: 999px;
    padding: 0.6rem 0.9rem;
    font: inherit;
    font-size: 16px;
}

.nb-chat-form input:focus {
    outline: 2px solid #0f8a95;
    outline-offset: 0;
    border-color: transparent;
}

.nb-chat-form button {
    width: 2.6rem;
    height: 2.6rem;
    flex-shrink: 0;
    border: 0;
    border-radius: 999px;
    background: #0b376d;
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.nb-chat-form button:disabled {
    opacity: 0.5;
    cursor: wait;
}

.nb-chat-form button svg {
    width: 1.15rem;
    height: 1.15rem;
}

.nb-chat-wa {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.6rem;
    background: #25d366;
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
}

.nb-chat-wa:hover {
    background: #1ebe5b;
}

.nb-chat-wa svg {
    width: 1.15rem;
    height: 1.15rem;
}

@media (max-width: 720px) {
    .wa-dropdown.wa-float-wrap.wa-float-stacked {
        bottom: 11rem;
    }

    .nb-chat {
        right: 0.75rem;
        bottom: 6.5rem;
    }

    .nb-chat-panel {
        position: fixed;
        right: 0.5rem;
        left: 0.5rem;
        bottom: calc(0.5rem + env(safe-area-inset-bottom));
        width: auto;
        height: min(36rem, calc(100vh - 1rem));
        height: min(36rem, calc(100dvh - 1rem));
    }

    .nb-chat.is-open .nb-chat-toggle {
        display: none;
    }
}
