/* NRB Consultancy Services — AI Chat Widget Styles */

#nrb-chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: 'Inter', -apple-system, sans-serif;
}

/* ── Toggle button ──────────────────────────────────────────────────────── */
#nrb-chat-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #2B7BB5;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(43, 123, 181, 0.45);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  z-index: 1;
}

#nrb-chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(43, 123, 181, 0.55);
}

#nrb-chat-toggle svg {
  width: 22px;
  height: 22px;
  stroke: #fff;
}

#nrb-chat-toggle.nrb-pulse {
  animation: nrb-pulse 1s ease-in-out 3;
}

@keyframes nrb-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 4px 20px rgba(43,123,181,.45); }
  50% { transform: scale(1.12); box-shadow: 0 6px 32px rgba(43,123,181,.65); }
}

/* Notification dot */
#nrb-chat-toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  right: 3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #C8302B;
  border: 2px solid #fff;
  animation: nrb-dot-pulse 2s infinite;
}

@keyframes nrb-dot-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Chat panel ─────────────────────────────────────────────────────────── */
#nrb-chat-panel {
  position: absolute;
  bottom: 68px;
  right: 0;
  width: 360px;
  max-height: 520px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(26, 35, 64, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.22s, transform 0.22s;
  transform-origin: bottom right;
}

#nrb-chat-panel.nrb-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
#nrb-chat-header {
  background: #1A2340;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

#nrb-chat-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

#nrb-chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #2B7BB5;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#nrb-chat-avatar svg {
  width: 16px;
  height: 16px;
  stroke: #fff;
}

#nrb-chat-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.01em;
}

#nrb-chat-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.5);
  margin-top: 1px;
}

#nrb-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2E9E38;
  display: inline-block;
}

#nrb-chat-close {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  transition: opacity 0.15s;
}

#nrb-chat-close:hover { opacity: 1; }

#nrb-chat-close svg {
  width: 16px;
  height: 16px;
  stroke: #fff;
}

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

#nrb-chat-messages::-webkit-scrollbar { width: 4px; }
#nrb-chat-messages::-webkit-scrollbar-track { background: transparent; }
#nrb-chat-messages::-webkit-scrollbar-thumb { background: #e2e6f0; border-radius: 2px; }

.nrb-msg {
  display: flex;
  animation: nrb-msg-in 0.18s ease-out;
}

@keyframes nrb-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.nrb-msg-user { justify-content: flex-end; }
.nrb-msg-bot { justify-content: flex-start; }

.nrb-msg-bubble {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 0.84rem;
  line-height: 1.6;
  font-weight: 300;
}

.nrb-msg-user .nrb-msg-bubble {
  background: #2B7BB5;
  color: #fff;
  border-bottom-right-radius: 3px;
}

.nrb-msg-bot .nrb-msg-bubble {
  background: #f5f7fb;
  color: #1a2340;
  border-bottom-left-radius: 3px;
}

/* Typing indicator */
.nrb-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px !important;
}

.nrb-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2B7BB5;
  animation: nrb-bounce 1.2s infinite;
}

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

@keyframes nrb-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ── Suggestions ────────────────────────────────────────────────────────── */
#nrb-chat-suggestions {
  padding: 0 12px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}

.nrb-suggestion {
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  color: #2B7BB5;
  background: #f0f7ff;
  border: 1px solid #c8dff0;
  border-radius: 20px;
  padding: 5px 11px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.nrb-suggestion:hover {
  background: #2B7BB5;
  color: #fff;
  border-color: #2B7BB5;
}

/* ── Input area ─────────────────────────────────────────────────────────── */
#nrb-chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #e2e6f0;
  flex-shrink: 0;
}

#nrb-chat-input {
  flex: 1;
  font-family: 'Inter', sans-serif;
  font-size: 0.84rem;
  font-weight: 300;
  color: #1a2340;
  background: #f5f7fb;
  border: 1px solid #e2e6f0;
  border-radius: 8px;
  padding: 8px 12px;
  resize: none;
  outline: none;
  line-height: 1.5;
  max-height: 100px;
  transition: border-color 0.2s;
}

#nrb-chat-input:focus { border-color: #2B7BB5; }
#nrb-chat-input::placeholder { color: #a0aab8; }

#nrb-chat-send {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #2B7BB5;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}

#nrb-chat-send:hover { background: #1a5f8f; }

#nrb-chat-send svg {
  width: 15px;
  height: 15px;
  stroke: #fff;
}

/* ── Footer ─────────────────────────────────────────────────────────────── */
#nrb-chat-footer {
  font-size: 0.65rem;
  color: #a0aab8;
  text-align: center;
  padding: 5px 12px 8px;
  flex-shrink: 0;
}

#nrb-chat-footer a {
  color: #2B7BB5;
  text-decoration: none;
}

/* ── Mobile ─────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #nrb-chat-widget {
    bottom: 16px;
    right: 16px;
  }

  #nrb-chat-panel {
    width: calc(100vw - 32px);
    right: 0;
    max-height: 70vh;
  }
}
