/* Public chat widget — VERBATIM copy of the customer portal chat styles (platform/customer/assets/css/portal.css, "Chat Widget (#np-chat-*)" block) so the public bot looks 1:1. [chatbot upgrade 2026-11-04 UI] */
/* ══════════ Chat Widget (#np-chat-*) — moved here from layout/header.php ══════════ */
#np-chat-btn{position:fixed;bottom:24px;right:24px;z-index:9000;width:56px;height:56px;border-radius:50%;background:#9D174D;color:#fff;border:none;cursor:pointer;box-shadow:0 4px 20px rgba(157,23,77,.4);display:flex;align-items:center;justify-content:center;transition:transform .2s,box-shadow .2s,background .2s}
#np-chat-btn:hover{transform:scale(1.08);box-shadow:0 6px 28px rgba(157,23,77,.5)}
#np-chat-btn svg{width:24px;height:24px;fill:currentColor;transition:transform .25s,opacity .2s;position:absolute}
#np-chat-btn .np-icon-chat{opacity:1;transform:scale(1) rotate(0deg)}
#np-chat-btn .np-icon-close{opacity:0;transform:scale(0.5) rotate(-90deg)}
#np-chat-btn.is-open .np-icon-chat{opacity:0;transform:scale(0.5) rotate(90deg)}
#np-chat-btn.is-open .np-icon-close{opacity:1;transform:scale(1) rotate(0deg)}
#np-chat-unread{position:absolute;top:-3px;right:-3px;background:#ef4444;color:#fff;border-radius:50%;width:18px;height:18px;font-size:10px;font-weight:700;display:none;align-items:center;justify-content:center;border:2px solid #fff}

#np-chat-box{position:fixed;bottom:90px;right:24px;z-index:9001;width:360px;height:520px;min-height:460px;background:#fff;border-radius:16px;box-shadow:0 8px 40px rgba(0,0,0,.18);display:flex;flex-direction:column;overflow:hidden;border:1px solid #e5e7eb;transform:translateY(20px) scale(0.96);opacity:0;pointer-events:none;transition:transform .28s cubic-bezier(.34,1.38,.64,1),opacity .22s ease,box-shadow .22s ease}
#np-chat-box.open{transform:translateY(0) scale(1);opacity:1;pointer-events:auto}
@media(max-width:480px){#np-chat-box{inset:0;width:100%;height:100%;bottom:0;right:0;border-radius:0;transform:translateY(40px) scale(0.98)}
#np-chat-box.open{transform:translateY(0) scale(1)}
#np-chat-btn{display:flex!important}}

.np-chat-header{background:#9D174D;color:#fff;padding:14px 16px;display:flex;align-items:center;gap:10px;flex-shrink:0}
.np-chat-header-avatar{width:36px;height:36px;border-radius:50%;background:rgba(255,255,255,.2);display:flex;align-items:center;justify-content:center;font-size:18px;flex-shrink:0}
.np-chat-header-info{flex:1;min-width:0}
.np-chat-header-info strong{font-size:14px;display:block}
.np-chat-header-info span{font-size:12px;opacity:.8}
.np-chat-end{background:rgba(255,255,255,.15);border:1px solid rgba(255,255,255,.4);color:#fff;cursor:pointer;padding:5px 11px;border-radius:20px;font-size:11.5px;font-weight:600;font-family:inherit;line-height:1.4;transition:background .15s}
.np-chat-end:hover{background:rgba(255,255,255,.28)}
.np-chat-minimize{background:none;border:none;color:#fff;cursor:pointer;padding:4px;display:flex;align-items:center;justify-content:center;opacity:.7;transition:opacity .15s;margin-left:2px}
.np-chat-minimize:hover{opacity:1}
.np-chat-minimize svg{width:18px;height:18px;fill:currentColor}

.np-chat-messages{flex:1;overflow-y:auto;padding:14px;display:flex;flex-direction:column;gap:10px;min-height:0}
.np-msg{display:flex;gap:8px;align-items:flex-end}
.np-msg.customer{flex-direction:row-reverse}
.np-msg-bubble{max-width:78%;padding:9px 13px;border-radius:14px;font-size:13.5px;line-height:1.5;word-break:break-word}
.np-msg-bubble ol,.np-msg-bubble ul{margin:6px 0 2px;padding-left:18px}
.np-msg-bubble li{margin-bottom:3px}
.np-msg-bubble strong{font-weight:700}
.np-msg-bubble em{font-style:italic}
.np-msg.ai .np-msg-bubble,.np-msg.agent .np-msg-bubble{background:#f3f4f6;color:#111;border-bottom-left-radius:4px}
.np-msg.customer .np-msg-bubble{background:#9D174D;color:#fff;border-bottom-right-radius:4px}
.np-msg-time{font-size:10px;color:#bbb;margin-top:3px;flex-shrink:0;align-self:flex-end}
.np-msg.customer .np-msg-time{text-align:right}

.np-chat-typing{padding:0 14px 10px;font-size:12px;color:#999;display:none;align-items:center;gap:6px;flex-shrink:0}
.np-typing-dots span{display:inline-block;width:6px;height:6px;border-radius:50%;background:#bbb;animation:np-bounce .8s infinite;margin:0 1px}
.np-typing-dots span:nth-child(2){animation-delay:.15s}
.np-typing-dots span:nth-child(3){animation-delay:.3s}
@keyframes np-bounce{0%,80%,100%{transform:scale(.6)}40%{transform:scale(1)}}

.np-chat-input-wrap{border-top:1px solid #f0f0f0;flex-shrink:0;background:#fff}
.np-file-preview{padding:8px 12px 0;display:flex;gap:6px;flex-wrap:wrap}
.np-file-preview-item{display:flex;align-items:center;gap:6px;background:#f3f4f6;border-radius:8px;padding:5px 8px;font-size:12px;color:#444;max-width:180px}
.np-file-preview-item span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1}
.np-file-preview-item button{background:none;border:none;cursor:pointer;color:#999;padding:0;font-size:14px;line-height:1;flex-shrink:0}
.np-file-preview-item button:hover{color:#dc2626}
.np-file-preview-thumb{width:32px;height:32px;object-fit:cover;border-radius:4px;flex-shrink:0}
.np-chat-input-row{padding:10px 12px;display:flex;gap:8px;align-items:center}
.np-chat-input-row input{flex:1;border:1.5px solid #e5e7eb;border-radius:24px;padding:9px 14px;font-size:13.5px;outline:none;transition:border-color .15s;font-family:inherit}
.np-chat-input-row input:focus{border-color:#9D174D}
.np-chat-attach{background:none;border:none;cursor:pointer;color:#aaa;padding:4px;display:flex;align-items:center;justify-content:center;transition:color .15s;flex-shrink:0}
.np-chat-attach:hover{color:#9D174D}
.np-chat-attach svg{width:20px;height:20px;fill:currentColor}
.np-chat-send{background:#9D174D;color:#fff;border:none;border-radius:50%;width:36px;height:36px;display:flex;align-items:center;justify-content:center;cursor:pointer;flex-shrink:0;transition:background .15s}
.np-chat-send:hover{background:#b80046}
.np-chat-send svg{width:16px;height:16px;fill:currentColor}

.np-msg-attachment{margin-top:6px}
.np-msg-attach-img{max-width:200px;max-height:160px;border-radius:8px;display:block;cursor:pointer}
.np-msg-attach-file{display:inline-flex;align-items:center;gap:6px;background:rgba(0,0,0,.08);border-radius:8px;padding:6px 10px;font-size:12px;text-decoration:none;color:inherit}
.np-msg.customer .np-msg-attach-file{background:rgba(255,255,255,.2);color:#fff}
.np-msg-attach-file svg{width:14px;height:14px;fill:currentColor;flex-shrink:0}
.np-upload-progress{font-size:11px;color:#9D174D;padding:4px 12px;display:none}

/* Code blocks */
.np-msg-bubble code{background:rgba(0,0,0,.08);border-radius:4px;padding:1px 5px;font-family:monospace;font-size:12px}
.np-msg.customer .np-msg-bubble code{background:rgba(255,255,255,.2)}
.np-msg-bubble pre{background:rgba(0,0,0,.06);border-radius:8px;padding:8px 10px 8px 10px;overflow-x:auto;margin:6px 0 2px;font-size:12px;position:relative}
.np-msg.customer .np-msg-bubble pre{background:rgba(255,255,255,.15)}
.np-msg-bubble pre code{background:none;padding:0;font-size:12px}
.np-copy-btn{position:absolute;top:6px;right:6px;background:#444;border:none;color:#fff;border-radius:5px;padding:4px 6px;font-size:10px;cursor:pointer;transition:background .15s;font-family:inherit;line-height:1;display:flex;align-items:center;justify-content:center}
.np-msg.customer .np-copy-btn{background:#666}
.np-copy-btn:hover{background:#222}
.np-copy-btn.copied{background:#16a34a}

/* Lightbox */
#np-lightbox{position:fixed;inset:0;z-index:99999;background:rgba(0,0,0,.88);display:flex;align-items:center;justify-content:center;opacity:0;pointer-events:none;transition:opacity .2s ease}
#np-lightbox.show{opacity:1;pointer-events:auto}
#np-lightbox-media img{max-width:90vw;max-height:90vh;border-radius:8px;box-shadow:0 8px 40px rgba(0,0,0,.5);display:block}
#np-lightbox-media video{max-width:90vw;max-height:90vh;border-radius:8px;outline:none}
#np-lightbox-close{position:absolute;top:16px;right:20px;background:rgba(255,255,255,.15);border:none;color:#fff;border-radius:50%;width:36px;height:36px;font-size:20px;line-height:1;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .15s}
#np-lightbox-close:hover{background:rgba(255,255,255,.3)}

/* Hide minimize button on desktop; show only on mobile (fullscreen mode) */
.np-chat-minimize{display:none}
@media(max-width:480px){.np-chat-minimize{display:flex}}

.np-chat-actions{padding:6px 12px 10px;display:flex;gap:6px;flex-wrap:wrap;flex-shrink:0}
.np-chat-action-btn{background:none;border:1px solid #e5e7eb;border-radius:20px;padding:5px 12px;font-size:12px;cursor:pointer;color:#555;transition:.15s;font-family:inherit}
.np-chat-action-btn:hover{border-color:#9D174D;color:#9D174D}

.np-site-picker{background:#f8f9fa;border:1px solid #e5e7eb;border-radius:12px;padding:12px;margin:4px 0;max-width:90%}
.np-site-picker p{font-size:13px;color:#555;margin:0 0 8px;font-weight:500}
.np-site-btn{display:flex;align-items:center;gap:8px;width:100%;background:#fff;border:1.5px solid #e5e7eb;border-radius:8px;padding:9px 12px;margin-bottom:6px;cursor:pointer;font-size:13px;font-family:inherit;text-align:left;transition:.15s;color:#222}
.np-site-btn:last-child{margin-bottom:0}
.np-site-btn:hover{border-color:#9D174D;background:#fdf2f7}
.np-site-btn-name{font-weight:600;flex:1}
.np-site-btn-domain{font-size:11px;color:#999}
.np-site-btn-status{font-size:10px;padding:2px 7px;border-radius:10px;font-weight:600}
.np-site-btn-status.active{background:#dcfce7;color:#16a34a}
.np-site-btn-status.trial{background:#fef9c3;color:#ca8a04}
.np-site-btn-status.suspended{background:#fee2e2;color:#dc2626}
.np-selected-site{display:inline-flex;align-items:center;gap:6px;background:#fdf2f7;border:1px solid #f9a8d4;border-radius:20px;padding:3px 10px 3px 8px;font-size:12px;color:#9D174D;cursor:pointer;margin:4px 0 2px;transition:.15s}
.np-selected-site:hover{background:#fce7f3}
.np-selected-site svg{width:12px;height:12px;fill:currentColor}

.np-chat-welcome{text-align:center;padding:20px 16px 10px}
.np-chat-welcome img{width:52px;height:52px;border-radius:50%;background:#fce7f3;padding:8px;margin-bottom:8px}
.np-chat-welcome p{font-size:13px;color:#555;line-height:1.5;margin:0}

#np-end-overlay{position:absolute;inset:0;background:rgba(0,0,0,.35);z-index:10;display:flex;align-items:center;justify-content:center;opacity:0;pointer-events:none;transition:opacity .2s ease;border-radius:16px}
#np-end-overlay.show{opacity:1;pointer-events:auto}
#np-end-modal{background:#fff;border-radius:14px;padding:24px 22px 20px;width:260px;box-shadow:0 8px 32px rgba(0,0,0,.18);transform:scale(.9) translateY(10px);transition:transform .25s cubic-bezier(.34,1.38,.64,1)}
#np-end-overlay.show #np-end-modal{transform:scale(1) translateY(0)}
#np-end-modal p{font-size:14px;color:#222;margin:0 0 18px;line-height:1.5;text-align:center}
.np-end-modal-btns{display:flex;gap:8px}
.np-end-modal-btns button{flex:1;padding:9px 0;border-radius:8px;font-size:13px;font-weight:600;font-family:inherit;cursor:pointer;border:none;transition:background .15s}
#np-end-cancel{background:#f3f4f6;color:#444}
#np-end-cancel:hover{background:#e5e7eb}
#np-end-confirm{background:#9D174D;color:#fff}
#np-end-confirm:hover{background:#b80046}
.np-hp{position:absolute!important;left:-9999px!important;width:1px!important;height:1px!important;opacity:0!important;pointer-events:none}
.np-msg-bubble a{color:inherit;text-decoration:underline;word-break:break-all}
