/* ═══════════════════════════════════════════
   Nova Chat Widget — NXTCORE Sales Assistant
   ═══════════════════════════════════════════ */

/* ── Trigger Button ── */
.nova-trigger {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #111;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,.2);
    z-index: 9998;
    transition: transform .2s ease, box-shadow .2s ease;
}
.nova-trigger:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(0,0,0,.3);
}
.nova-trigger svg {
    width: 26px;
    height: 26px;
    transition: transform .2s ease;
}
.nova-trigger.nova-open svg {
    transform: rotate(90deg);
}

/* ── Chat Panel ── */
.nova-panel {
    position: fixed;
    bottom: 92px;
    right: 24px;
    width: 380px;
    height: 560px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,.15);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    opacity: 0;
    transform: translateY(16px) scale(.96);
    pointer-events: none;
    transition: opacity .25s ease, transform .25s ease;
    overflow: hidden;
}
.nova-panel.nova-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* ── Header ── */
.nova-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
    background: #fafafa;
}
.nova-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #111;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}
.nova-header-info {
    flex: 1;
    min-width: 0;
}
.nova-header-name {
    font-weight: 600;
    font-size: 15px;
    color: #111;
    line-height: 1.2;
}
.nova-header-status {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.2;
}
.nova-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    padding: 4px;
    border-radius: 6px;
    transition: color .15s, background .15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.nova-close:hover {
    color: #111;
    background: #f3f4f6;
}
.nova-close svg {
    width: 20px;
    height: 20px;
}

/* ── Messages Area ── */
.nova-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}
.nova-messages::-webkit-scrollbar {
    width: 5px;
}
.nova-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

/* ── Message Bubbles ── */
.nova-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow: hidden;
}
.nova-msg-user {
    align-self: flex-end;
    background: #111;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.nova-msg-assistant {
    align-self: flex-start;
    background: #f3f4f6;
    color: #1f2937;
    border-bottom-left-radius: 4px;
}

/* Markdown inside assistant messages */
.nova-msg-assistant p {
    margin: 0 0 8px;
}
.nova-msg-assistant p:last-child {
    margin-bottom: 0;
}
.nova-msg-assistant strong {
    font-weight: 600;
}
.nova-msg-assistant em {
    font-style: italic;
}
.nova-msg-assistant ul,
.nova-msg-assistant ol {
    margin: 4px 0 8px;
    padding-left: 18px;
}
.nova-msg-assistant li {
    margin-bottom: 2px;
}
.nova-msg-assistant code {
    background: #e5e7eb;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 13px;
}
.nova-msg-assistant a {
    color: #2563eb;
    text-decoration: underline;
}
.nova-msg-assistant h3 {
    font-size: 15px;
    font-weight: 700;
    margin: 12px 0 6px;
    color: #111;
}
.nova-msg-assistant h3:first-child { margin-top: 0; }
.nova-msg-assistant h4 {
    font-size: 14px;
    font-weight: 600;
    margin: 10px 0 4px;
    color: #111;
}
.nova-msg-assistant h4:first-child { margin-top: 0; }
.nova-msg-assistant hr {
    border: none;
    border-top: 1px solid #d1d5db;
    margin: 10px 0;
}
.nova-msg-assistant ol {
    list-style-type: decimal;
}
.nova-msg-assistant pre {
    background: #1f2937;
    color: #e5e7eb;
    padding: 10px 12px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 12px;
    margin: 6px 0;
}
.nova-msg-assistant pre code {
    background: none;
    padding: 0;
    font-size: inherit;
    color: inherit;
}

/* ── Welcome State ── */
.nova-welcome {
    text-align: center;
    padding: 24px 16px 8px;
}
.nova-welcome-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #111;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
    margin-bottom: 12px;
}
.nova-welcome h3 {
    font-size: 17px;
    font-weight: 600;
    color: #111;
    margin: 0 0 6px;
}
.nova-welcome p {
    font-size: 13px;
    color: #6b7280;
    margin: 0;
    line-height: 1.4;
}
.nova-suggestions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px 8px;
}
.nova-suggestion {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    text-align: left;
    transition: border-color .15s, background .15s;
    line-height: 1.3;
}
.nova-suggestion:hover {
    border-color: #111;
    background: #f9fafb;
}

/* ── Product Card ── */
.nova-product-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    margin: 8px 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: border-color .15s, box-shadow .15s;
    overflow: hidden;
    max-width: 100%;
    box-sizing: border-box;
}
.nova-product-card:hover {
    border-color: #2563eb;
    box-shadow: 0 2px 8px rgba(37,99,235,.1);
}
.nova-product-card img {
    width: 48px;
    height: 48px;
    min-width: 48px;
    max-width: 48px;
    object-fit: contain;
    border-radius: 6px;
    background: #f9fafb;
    flex-shrink: 0;
}
.nova-product-card-info {
    flex: 1;
    min-width: 0;
}
.nova-product-card-name {
    font-size: 13px;
    font-weight: 600;
    color: #111;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nova-product-card-price {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}
.nova-product-card-arrow {
    flex-shrink: 0;
    color: #9ca3af;
    transition: color .15s;
}
.nova-product-card:hover .nova-product-card-arrow {
    color: #2563eb;
}

/* ── Typing Indicator ── */
.nova-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 14px;
    align-self: flex-start;
    background: #f3f4f6;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
}
.nova-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #9ca3af;
    animation: novaPulse 1.4s infinite ease-in-out;
}
.nova-typing-dot:nth-child(2) { animation-delay: .2s; }
.nova-typing-dot:nth-child(3) { animation-delay: .4s; }
@keyframes novaPulse {
    0%, 60%, 100% { opacity: .3; transform: scale(.8); }
    30% { opacity: 1; transform: scale(1); }
}

/* ── Input Area ── */
.nova-input-area {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #eee;
    flex-shrink: 0;
    background: #fff;
}
.nova-textarea {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    max-height: 100px;
    min-height: 36px;
    line-height: 1.4;
    transition: border-color .15s;
    overflow-y: auto;
}
.nova-textarea:focus {
    border-color: #111;
}
.nova-textarea::placeholder {
    color: #9ca3af;
}
.nova-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #111;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity .15s, background .15s;
}
.nova-send:disabled {
    opacity: .4;
    cursor: not-allowed;
}
.nova-send:not(:disabled):hover {
    background: #333;
}
.nova-send svg {
    width: 16px;
    height: 16px;
}

/* ── Error Message ── */
.nova-error {
    text-align: center;
    font-size: 13px;
    color: #dc2626;
    padding: 8px 14px;
    background: #fef2f2;
    border-radius: 10px;
    margin: 4px 0;
}

/* ── Mobile ── */
@media (max-width: 768px) {
    .nova-trigger {
        bottom: 16px;
        right: 16px;
    }
    /* Push chat button above sticky cart bar on product pages */
    .whmcs-templatefile-configureproduct .nova-trigger {
        bottom: 86px;
    }
    .nova-panel {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    .nova-panel.nova-visible {
        transform: translateY(0) scale(1);
    }
}

/* ── Powered-by footer ── */
.nova-footer {
    text-align: center;
    font-size: 11px;
    color: #9ca3af;
    padding: 4px 16px 8px;
    flex-shrink: 0;
}
