/* Navi Echo Widget */
:root {
  --ns-primary: #2563eb;
  --ns-primary-dark: #1d4ed8;
  --ns-bg: #ffffff;
  --ns-text: #111827;
  --ns-muted: #6b7280;
  --ns-border: #e5e7eb;
  --ns-bubble-customer: #f3f4f6;
  --ns-bubble-supporter: #2563eb;
  --ns-radius: 12px;
  --ns-shadow: 0 4px 24px rgba(0,0,0,0.15);
  --ns-z: 2147483647;
}

/* FAB button */
#ns-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--ns-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: var(--ns-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--ns-z);
  transition: background 0.2s, transform 0.2s;
}
#ns-fab:hover { background: var(--ns-primary-dark); transform: scale(1.08); }
#ns-fab svg { width: 26px; height: 26px; }

/* Chat container */
#ns-widget {
  position: fixed;
  bottom: 90px;
  right: 24px;
  width: 360px;
  max-height: 560px;
  background: var(--ns-bg);
  border-radius: var(--ns-radius);
  box-shadow: var(--ns-shadow);
  display: flex;
  flex-direction: column;
  z-index: var(--ns-z);
  overflow: hidden;
  transition: opacity 0.2s, transform 0.2s;
}
#ns-widget.ns-hidden { opacity: 0; pointer-events: none; transform: translateY(16px); }

/* Header */
#ns-header {
  background: var(--ns-primary);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 15px;
}
#ns-header-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 400;
  opacity: 0.85;
}
.ns-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #9ca3af;
}
.ns-dot.online { background: #22c55e; }
.ns-dot.away { background: #f59e0b; }

#ns-close-btn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px;
  opacity: 0.8;
  line-height: 1;
}
#ns-close-btn:hover { opacity: 1; }

/* Messages */
#ns-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ns-msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}
.ns-msg.customer {
  background: var(--ns-bubble-customer);
  color: var(--ns-text);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.ns-msg.supporter {
  background: var(--ns-bubble-supporter);
  color: #fff;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.ns-msg.system {
  background: none;
  color: var(--ns-muted);
  font-size: 12px;
  text-align: center;
  align-self: center;
  padding: 4px 8px;
}
.ns-msg img {
  max-width: 100%;
  border-radius: 8px;
  display: block;
}

/* Input form */
#ns-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--ns-border);
}
.ns-form-row { display: flex; gap: 8px; }
#ns-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--ns-border);
  border-radius: 24px;
  font-size: 14px;
  outline: none;
  resize: none;
  font-family: inherit;
}
#ns-input:focus { border-color: var(--ns-primary); }
#ns-send-btn {
  background: var(--ns-primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  align-self: flex-end;
}
#ns-send-btn:hover { background: var(--ns-primary-dark); }
#ns-send-btn svg { width: 18px; height: 18px; }

/* Email form */
#ns-email-form {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#ns-email-form p { font-size: 14px; color: var(--ns-muted); margin: 0; }
#ns-email-input, #ns-name-input, #ns-first-msg-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--ns-border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  box-sizing: border-box;
  outline: none;
}
#ns-email-input:focus, #ns-name-input:focus, #ns-first-msg-input:focus {
  border-color: var(--ns-primary);
}
#ns-start-btn {
  background: var(--ns-primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}
#ns-start-btn:hover { background: var(--ns-primary-dark); }
#ns-start-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.ns-error { color: #ef4444; font-size: 13px; }

@media (max-width: 480px) {
  #ns-widget { right: 0; bottom: 70px; width: 100vw; border-radius: 12px 12px 0 0; max-height: 75vh; }
  #ns-fab { bottom: 16px; right: 16px; }
}
