/* ===== NetLayers Live Chat Widget ===== */
:root {
  --nl-chat-blue: #1e6fd9;
  --nl-chat-blue-dark: #185db5;
  --nl-chat-radius: 18px;
  --nl-chat-shadow: 0 8px 40px rgba(11,31,58,0.18);
}

#nl-chat-root {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Bubble */
#nl-chat-bubble {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--nl-chat-blue) 0%, var(--nl-chat-blue-dark) 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(30,111,217,0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  color: #fff;
}
#nl-chat-bubble:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(30,111,217,0.5);
}
.nl-bubble-icon svg {
  width: 26px;
  height: 26px;
}
#nl-unread-dot {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 12px;
  height: 12px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid #fff;
  display: none;
}
#nl-unread-dot.visible { display: block; }

/* Chat Window */
#nl-chat-window {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 360px;
  max-height: 540px;
  background: #fff;
  border-radius: var(--nl-chat-radius);
  box-shadow: var(--nl-chat-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.92) translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.22s cubic-bezier(0.34,1.56,0.64,1), opacity 0.18s ease;
  transform-origin: bottom right;
}
#nl-chat-window.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* Header */
#nl-chat-header {
  background: linear-gradient(135deg, var(--nl-chat-blue) 0%, var(--nl-chat-blue-dark) 100%);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  flex-shrink: 0;
}
.nl-header-avatar {
  width: 42px;
  height: 42px;
  background: transparent;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nl-header-cloud-img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.nl-header-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.nl-header-info strong { font-size: 0.9rem; font-weight: 700; line-height: 1; }
.nl-status-line {
  display: flex;
  align-items: center;
  gap: 5px;
}
.nl-online-dot {
  width: 7px;
  height: 7px;
  background: #4ade80;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.nl-online-text {
  font-size: 0.72rem;
  opacity: 0.9;
}
#nl-chat-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #fff;
  padding: 4px;
  opacity: 0.8;
  transition: opacity 0.15s;
}
#nl-chat-close:hover { opacity: 1; }
#nl-chat-close svg { width: 18px; height: 18px; }

/* Messages */
#nl-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
#nl-chat-messages::-webkit-scrollbar { width: 4px; }
#nl-chat-messages::-webkit-scrollbar-track { background: transparent; }
#nl-chat-messages::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }

.nl-msg {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  animation: nl-msg-in 0.2s ease;
}
@keyframes nl-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.nl-msg.bot { align-self: flex-start; }
.nl-msg.user { align-self: flex-end; }

.nl-msg-bubble {
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 0.855rem;
  line-height: 1.5;
  word-break: break-word;
}
.nl-msg.bot  .nl-msg-bubble {
  background: #f3f6fb;
  color: #1e293b;
  border-bottom-left-radius: 4px;
}
.nl-msg.user .nl-msg-bubble {
  background: var(--nl-chat-blue);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.nl-msg-time {
  font-size: 0.68rem;
  color: #94a3b8;
  margin-top: 3px;
  padding: 0 2px;
}
.nl-msg.user .nl-msg-time { text-align: right; }

/* Typing indicator */
.nl-typing .nl-msg-bubble {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
}
.nl-typing-dot {
  width: 7px;
  height: 7px;
  background: #94a3b8;
  border-radius: 50%;
  animation: nl-typing 1.2s infinite ease-in-out;
}
.nl-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.nl-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes nl-typing {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* Quick replies */
#nl-quick-replies {
  padding: 0 12px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}
.nl-quick-btn {
  font-size: 0.76rem;
  padding: 5px 10px;
  border-radius: 20px;
  border: 1px solid #dbeafe;
  background: #eff6ff;
  color: var(--nl-chat-blue);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.nl-quick-btn:hover {
  background: var(--nl-chat-blue);
  color: #fff;
  border-color: var(--nl-chat-blue);
}

/* Input */
#nl-chat-input-area {
  padding: 10px 12px;
  border-top: 1px solid #e5eaf2;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
  background: #fff;
}
#nl-chat-input {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 22px;
  padding: 9px 14px;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s;
  color: #1e293b;
  background: #f8fafc;
}
#nl-chat-input:focus {
  border-color: var(--nl-chat-blue);
  background: #fff;
}
#nl-chat-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--nl-chat-blue);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.15s;
}
#nl-chat-send:hover { background: var(--nl-chat-blue-dark); transform: scale(1.06); }
#nl-chat-send svg { width: 16px; height: 16px; }

/* Mobile */
@media (max-width: 480px) {
  #nl-chat-root { bottom: 16px; right: 16px; }
  #nl-chat-window { width: calc(100vw - 32px); right: -16px; bottom: 68px; }
}
