/* ── NURU Chat – Frontend Styles ─────────────────────────────────────────── */

/* ── Floating Widget ─────────────────────────────────────────────────────── */

#nuru-chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Toggle Button */
#nuru-chat-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
  transition: background 0.2s, transform 0.2s;
}

#nuru-chat-toggle:hover {
  background: #1d4ed8;
  transform: scale(1.06);
}

#nuru-chat-toggle .nuru-icon-close {
  display: none;
}

#nuru-chat-widget.is-open #nuru-chat-toggle .nuru-icon-open {
  display: none;
}

#nuru-chat-widget.is-open #nuru-chat-toggle .nuru-icon-close {
  display: block;
}

/* Chat Window */
#nuru-chat-window {
  display: none;
  flex-direction: column;
  position: absolute;
  bottom: 68px;
  right: 0;
  width: 360px;
  height: 500px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.16);
  overflow: hidden;
  animation: nuru-slide-up 0.22s ease;
}

@keyframes nuru-slide-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

#nuru-chat-widget.is-open #nuru-chat-window {
  display: flex;
}

/* Header */
#nuru-chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  background: #2563eb;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  flex-shrink: 0;
}

#nuru-chat-header::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #4ade80;
  flex-shrink: 0;
}

/* Messages */
#nuru-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

#nuru-chat-messages::-webkit-scrollbar       { width: 4px; }
#nuru-chat-messages::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 2px; }

/* Input Area */
#nuru-chat-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid #e2e8f0;
  flex-shrink: 0;
}

#nuru-chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.4;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}

#nuru-chat-input:focus { border-color: #2563eb; }

#nuru-chat-send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
}

#nuru-chat-send:hover    { background: #1d4ed8; }
#nuru-chat-send:disabled { background: #94a3b8; cursor: not-allowed; }

/* ── Inline Chat (Shortcode) ─────────────────────────────────────────────── */

.nuru-chat-inline {
  display: flex;
  flex-direction: column;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  max-width: 640px;
  height: 480px;
  margin: 0 auto;
}

.nuru-chat-inline-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: #2563eb;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  flex-shrink: 0;
}

.nuru-chat-inline-header::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #4ade80;
  flex-shrink: 0;
}

.nuru-chat-inline-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.nuru-chat-inline-messages::-webkit-scrollbar       { width: 4px; }
.nuru-chat-inline-messages::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 2px; }

.nuru-chat-inline-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.nuru-chat-inline-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}

.nuru-chat-inline-input:focus { border-color: #2563eb; }

.nuru-chat-inline-send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
}

.nuru-chat-inline-send:hover    { background: #1d4ed8; }
.nuru-chat-inline-send:disabled { background: #94a3b8; cursor: not-allowed; }

/* ── Shared: Message Bubbles ─────────────────────────────────────────────── */

.nuru-message {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  word-wrap: break-word;
  animation: nuru-fade-in 0.18s ease;
}

@keyframes nuru-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.nuru-message.user {
  background: #2563eb;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.nuru-message.bot {
  background: #f1f5f9;
  color: #1e293b;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.nuru-message.error {
  background: #fef2f2;
  color: #991b1b;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  font-size: 13px;
}

/* ── Typing Indicator ────────────────────────────────────────────────────── */

.nuru-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
  background: #f1f5f9;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

.nuru-typing span {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  animation: nuru-bounce 1.2s infinite ease-in-out;
}

.nuru-typing span:nth-child(2) { animation-delay: 0.2s; }
.nuru-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes nuru-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%            { transform: translateY(-6px); }
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  #nuru-chat-window {
    width: calc(100vw - 16px);
    right: -8px;
    height: 70vh;
  }
}
