/* Website chatbot widget - see resources/views/partials/chatbot.blade.php */

#np-chat {
    --np-chat-brand: #005778;
    --np-chat-accent: #00ab9a;
    --np-chat-ink: #1f2933;
    --np-chat-soft: #6b7785;
    --np-chat-line: #e3e8ee;
    font-family: inherit;
}

/* The site stylesheet colors every span and link #3D3B58 and forces every
   textarea to 100px with !important. These rules undo that inside the
   widget only - without them the header subtitle and the launcher label
   are dark-on-dark, and the message box is three lines tall. */
#np-chat .np-chat-launcher span {
    color: inherit;
}

#np-chat .np-chat-header span {
    color: #fff;
    opacity: .9;
}

#np-chat .np-chat-form textarea {
    height: 42px !important;
    min-height: 42px;
}

/* The back-to-top arrow lives in the same corner; lift it above the chat button. */
body .scroll-top {
    bottom: 100px;
}

.np-chat-launcher {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1040;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    border: 0;
    border-radius: 999px;
    background: var(--np-chat-brand);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .22);
    cursor: pointer;
}

.np-chat-launcher:hover,
.np-chat-launcher:focus-visible {
    background: var(--np-chat-accent);
}

.np-chat-launcher svg,
.np-chat-form button svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.np-chat-launcher[aria-expanded="true"] {
    display: none;
}

.np-chat-panel {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    width: 380px;
    height: min(600px, calc(100vh - 48px));
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
    overflow: hidden;
    color: var(--np-chat-ink);
    font-size: 15px;
}

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

.np-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--np-chat-brand);
    color: #fff;
}

.np-chat-header strong {
    display: block;
    font-size: 16px;
}

.np-chat-header span {
    font-size: 13px;
}

.np-chat-close {
    border: 0;
    background: none;
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.np-chat-log {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f6f8fa;
}

.np-chat-msg {
    max-width: 85%;
    margin-bottom: 10px;
    padding: 10px 13px;
    border-radius: 14px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    line-height: 1.45;
}

.np-chat-msg-assistant {
    background: #fff;
    border: 1px solid var(--np-chat-line);
    border-bottom-left-radius: 4px;
}

.np-chat-msg-visitor {
    margin-left: auto;
    background: var(--np-chat-brand);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.np-chat-msg a {
    color: var(--np-chat-brand);
    text-decoration: underline;
}

.np-chat-msg-visitor a {
    color: #fff;
}

.np-chat-msg-system {
    max-width: 100%;
    background: none;
    color: var(--np-chat-soft);
    font-size: 13px;
    text-align: center;
}

.np-chat-typing span {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 3px;
    border-radius: 50%;
    background: var(--np-chat-soft);
    animation: np-chat-blink 1.2s infinite both;
}

.np-chat-typing span:nth-child(2) { animation-delay: .2s; }
.np-chat-typing span:nth-child(3) { animation-delay: .4s; }

@keyframes np-chat-blink {
    0%, 80%, 100% { opacity: .25; }
    40% { opacity: 1; }
}

.np-chat-start {
    padding: 14px 16px;
    border-top: 1px solid var(--np-chat-line);
}

.np-chat-start[hidden],
.np-chat-form[hidden],
.np-chat-footnote[hidden],
.np-chat-error[hidden] {
    display: none;
}

.np-chat-note,
.np-chat-footnote {
    margin: 0 0 10px;
    color: var(--np-chat-soft);
    font-size: 12px;
    line-height: 1.4;
}

.np-chat-footnote {
    margin: 0;
    padding: 0 16px 10px;
}

.np-chat-captcha {
    margin-bottom: 10px;
}

.np-chat-start-btn {
    width: 100%;
    padding: 11px;
    border: 0;
    border-radius: 8px;
    background: var(--np-chat-brand);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

.np-chat-start-btn:disabled {
    opacity: .6;
    cursor: default;
}

.np-chat-error {
    margin: 8px 0 0;
    color: #c0392b;
    font-size: 13px;
}

.np-chat-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--np-chat-line);
}

.np-chat-form textarea {
    flex: 1;
    max-height: 120px;
    padding: 9px 11px;
    border: 1px solid var(--np-chat-line);
    border-radius: 10px;
    resize: none;
    font: inherit;
}

.np-chat-form textarea:focus {
    outline: 2px solid var(--np-chat-accent);
    outline-offset: -1px;
}

.np-chat-form button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: var(--np-chat-brand);
    color: #fff;
    cursor: pointer;
}

.np-chat-form button:disabled {
    opacity: .5;
    cursor: default;
}

@media (max-width: 480px) {
    .np-chat-panel {
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .np-chat-launcher {
        right: 16px;
        bottom: 16px;
    }

    body .scroll-top {
        bottom: 84px;
    }
}
