/* Nexus AI Chat — Widget Styles */

#nexus-chat-widget {
	--nx-primary: #6366F1;
	--nx-secondary: #8B5CF6;
	--nx-radius: 16px;
	--nx-bg: #FFFFFF;
	--nx-text: #1F2937;
	--nx-text-muted: #6B7280;
	--nx-bubble-bot: #F3F4F6;
	position: fixed;
	bottom: 24px;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	line-height: 1.5;
}
#nexus-chat-widget.nx-pos-right { right: 24px; }
#nexus-chat-widget.nx-pos-left { left: 24px; }
#nexus-chat-widget * { box-sizing: border-box; }
#nexus-chat-widget.nx-dark { --nx-bg: #1F2937; --nx-text: #F3F4F6; --nx-text-muted: #9CA3AF; --nx-bubble-bot: #374151; }

/* Launcher button */
.nx-launcher {
	display: flex; align-items: center; gap: 10px;
	background: linear-gradient(135deg, var(--nx-primary), var(--nx-secondary));
	color: #fff; border: none; cursor: pointer;
	padding: 16px; border-radius: 50%;
	box-shadow: 0 10px 30px -8px rgba(99,102,241,.55);
	transition: transform .2s ease, box-shadow .2s ease, border-radius .2s ease;
	animation: nx-pop-in .4s ease;
}
.nx-launcher:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 14px 34px -6px rgba(99,102,241,.65); }
.nx-launcher.nx-has-text { border-radius: 999px; padding: 14px 22px 14px 16px; }
.nx-launcher svg { width: 26px; height: 26px; flex-shrink: 0; }
.nx-launcher__text { font-size: 14px; font-weight: 600; white-space: nowrap; }
.nx-launcher__badge {
	position: absolute; top: -4px; right: -4px; width: 16px; height: 16px; border-radius: 50%;
	background: #34D399; border: 2px solid #fff;
}

@keyframes nx-pop-in { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Chat window */
.nx-window {
	position: absolute; bottom: 78px; width: 380px; max-width: calc(100vw - 40px);
	height: 600px; max-height: calc(100vh - 140px);
	background: var(--nx-bg); border-radius: var(--nx-radius);
	box-shadow: 0 24px 60px -12px rgba(0,0,0,.28);
	display: none; flex-direction: column; overflow: hidden;
	border: 1px solid rgba(0,0,0,.06);
}
#nexus-chat-widget.nx-pos-right .nx-window { right: 0; transform-origin: bottom right; }
#nexus-chat-widget.nx-pos-left .nx-window { left: 0; transform-origin: bottom left; }
.nx-window.nx-open { display: flex; animation: nx-window-in .28s cubic-bezier(.2,1,.3,1); }

@keyframes nx-window-in {
	from { opacity: 0; transform: scale(.92) translateY(16px); }
	to { opacity: 1; transform: scale(1) translateY(0); }
}

@media (max-width: 480px) {
	.nx-window { position: fixed; inset: 0; width: 100%; height: 100%; max-height: 100%; border-radius: 0; bottom: 0; }
}

/* Header */
.nx-header {
	background: linear-gradient(135deg, var(--nx-primary), var(--nx-secondary));
	color: #fff; padding: 18px 20px; display: flex; align-items: center; gap: 12px; flex-shrink: 0;
}
.nx-header__avatar {
	width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,.22);
	display: flex; align-items: center; justify-content: center; font-size: 19px; overflow: hidden; flex-shrink: 0;
}
.nx-header__avatar img { width: 100%; height: 100%; object-fit: cover; }
.nx-header__info { flex: 1; min-width: 0; }
.nx-header__name { font-weight: 700; font-size: 14.5px; }
.nx-header__status { font-size: 11.5px; opacity: .9; display: flex; align-items: center; gap: 5px; }
.nx-header__status .dot { width: 6px; height: 6px; border-radius: 50%; background: #34D399; }
.nx-header__actions { display: flex; gap: 4px; }
.nx-header__btn { background: rgba(255,255,255,.18); border: none; color: #fff; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .15s; }
.nx-header__btn:hover { background: rgba(255,255,255,.32); }

/* Body / messages */
.nx-body { flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 12px; background: var(--nx-bg); }
.nx-body::-webkit-scrollbar { width: 6px; }
.nx-body::-webkit-scrollbar-thumb { background: rgba(0,0,0,.15); border-radius: 999px; }

.nx-msg-row { display: flex; gap: 8px; max-width: 88%; animation: nx-msg-in .25s ease; }
.nx-msg-row.user { align-self: flex-end; flex-direction: row-reverse; }
@keyframes nx-msg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.nx-bubble {
	padding: 10px 14px; border-radius: 16px; font-size: 13.8px; color: var(--nx-text);
	background: var(--nx-bubble-bot); border-bottom-left-radius: 4px; word-wrap: break-word;
}
.nx-msg-row.user .nx-bubble {
	background: linear-gradient(135deg, var(--nx-primary), var(--nx-secondary));
	color: #fff; border-bottom-left-radius: 16px; border-bottom-right-radius: 4px;
}
.nx-bubble a { color: inherit; text-decoration: underline; }
.nx-bubble p { margin: 0 0 6px; }
.nx-bubble p:last-child { margin-bottom: 0; }

.nx-avatar-mini { width: 26px; height: 26px; border-radius: 50%; background: var(--nx-bubble-bot); display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; overflow: hidden; }
.nx-avatar-mini img { width: 100%; height: 100%; object-fit: cover; }

/* Suggested questions */
.nx-suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.nx-suggestion-chip {
	background: var(--nx-bg); border: 1px solid rgba(99,102,241,.35); color: var(--nx-primary);
	padding: 7px 13px; border-radius: 999px; font-size: 12.5px; cursor: pointer; transition: all .15s ease;
}
.nx-suggestion-chip:hover { background: var(--nx-primary); color: #fff; }

/* Live data badge */
.nx-live-badge {
	display: inline-flex; align-items: center; gap: 4px; margin-top: 4px;
	font-size: 10.5px; font-weight: 600; color: var(--nx-primary);
	background: rgba(99,102,241,.1); padding: 3px 9px; border-radius: 999px; width: fit-content;
}

.nx-msg-row.bot { align-items: flex-start; }
.nx-msg-col { display: flex; flex-direction: column; gap: 6px; max-width: 100%; }

/* Content link chips (product / post / taxonomy) */
.nx-links-row { display: flex; flex-wrap: wrap; gap: 6px; }
.nx-link-chip {
	display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600;
	padding: 7px 12px; border-radius: 10px; text-decoration: none;
	background: linear-gradient(135deg, var(--nx-primary), var(--nx-secondary)); color: #fff;
	box-shadow: 0 4px 12px -4px rgba(99,102,241,.5); transition: transform .15s ease;
}
.nx-link-chip:hover { transform: translateY(-1px); color: #fff; }

/* Quick action buttons (call, whatsapp, email, custom url) */
.nx-actions-row { display: flex; flex-wrap: wrap; gap: 6px; }
.nx-action-chip {
	display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600;
	padding: 7px 12px; border-radius: 10px; text-decoration: none; color: var(--nx-text);
	background: var(--nx-bubble-bot); border: 1px solid rgba(0,0,0,.08); transition: all .15s ease;
}
.nx-action-chip:hover { background: rgba(0,0,0,.06); color: var(--nx-text); }
.nx-action-chip--whatsapp:hover { background: #E7F9EF; border-color: #A7E8C1; color: #0F7A3D; }
.nx-action-chip--phone:hover { background: #EEF2FF; border-color: #C7D2FE; color: var(--nx-primary); }
.nx-action-chip--maps:hover { background: #FEF3E7; border-color: #FBD8A8; color: #B45309; }

/* Typing indicator */
.nx-typing { display: flex; gap: 4px; padding: 12px 14px; background: var(--nx-bubble-bot); border-radius: 16px; border-bottom-left-radius: 4px; width: fit-content; }
.nx-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--nx-text-muted); animation: nx-bounce 1.2s infinite ease-in-out; }
.nx-typing span:nth-child(2) { animation-delay: .15s; }
.nx-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes nx-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

/* Input */
.nx-input-bar { border-top: 1px solid rgba(0,0,0,.08); padding: 12px 14px; display: flex; align-items: flex-end; gap: 10px; flex-shrink: 0; background: var(--nx-bg); }
.nx-input-bar textarea {
	flex: 1; border: 1px solid rgba(0,0,0,.12); border-radius: 12px; padding: 10px 12px;
	font-size: 13.5px; resize: none; max-height: 90px; font-family: inherit;
	background: var(--nx-bg); color: var(--nx-text);
}
.nx-input-bar textarea:focus { outline: none; border-color: var(--nx-primary); }
.nx-send-btn {
	background: linear-gradient(135deg, var(--nx-primary), var(--nx-secondary)); border: none; color: #fff;
	width: 40px; height: 40px; border-radius: 50%; cursor: pointer; flex-shrink: 0;
	display: flex; align-items: center; justify-content: center; transition: transform .15s ease;
}
.nx-send-btn:hover { transform: scale(1.08); }
.nx-send-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.nx-footer-brand { text-align: center; padding: 6px 0 10px; font-size: 10.5px; color: var(--nx-text-muted); }

/* Consent screen */
.nx-consent { padding: 24px 20px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; flex: 1; justify-content: center; }
.nx-consent p { font-size: 13px; color: var(--nx-text-muted); margin: 0; }
.nx-consent button { background: linear-gradient(135deg, var(--nx-primary), var(--nx-secondary)); color: #fff; border: none; padding: 10px 20px; border-radius: 10px; font-weight: 600; cursor: pointer; font-size: 13px; }

.nx-error-msg { color: #EF4444; font-size: 12.5px; text-align: center; padding: 8px; }
