/* ═══════════════════════════════════════════
   Chat Widget — New Indo Trading Co.
   Floating bubble + expandable window
   ═══════════════════════════════════════════ */

/* ─── Floating Bubble ───────────────────── */
.ni-chat-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #3A7CB8;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  z-index: 9999;
  transition: transform 0.2s, background 0.2s;
}
.ni-chat-bubble:hover { background: #2D6A9F; transform: scale(1.08); }
.ni-chat-bubble-open { transform: scale(0); pointer-events: none; }

/* ─── Chat Window ───────────────────────── */
.ni-chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 48px);
  background: #FCFAF7;
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.16);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10000;
  font-family: 'Source Sans 3', 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  color: #4A4A4A;
  transition: opacity 0.2s, transform 0.2s;
}
.ni-chat-hidden {
  display: none !important;
}

/* ─── Header ────────────────────────────── */
.ni-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #3A7CB8;
  color: #fff;
  flex-shrink: 0;
}
.ni-chat-header-info strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
}
.ni-chat-status {
  font-size: 11px;
  opacity: 0.85;
}
.ni-chat-status::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  background: #5EE08A;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}
.ni-chat-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  opacity: 0.8;
}
.ni-chat-close:hover { opacity: 1; }

/* ─── Messages Area ─────────────────────── */
.ni-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ni-chat-msg {
  display: flex;
  max-width: 85%;
}
.ni-chat-msg-user {
  align-self: flex-end;
  justify-content: flex-end;
}
.ni-chat-msg-assistant {
  align-self: flex-start;
}
.ni-chat-bubble-msg {
  padding: 10px 14px;
  border-radius: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.ni-chat-msg-user .ni-chat-bubble-msg {
  background: #3A7CB8;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ni-chat-msg-assistant .ni-chat-bubble-msg {
  background: #EDE0C8;
  color: #4A4A4A;
  border-bottom-left-radius: 4px;
}

/* ─── Typing Indicator ──────────────────── */
.ni-chat-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 18px;
  min-width: 56px;
}
.ni-chat-typing span {
  width: 7px;
  height: 7px;
  background: #9A7B2E;
  border-radius: 50%;
  animation: ni-chat-dot 1.4s infinite;
}
.ni-chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.ni-chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes ni-chat-dot {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
  30% { opacity: 1; transform: scale(1); }
}

/* ─── Input Bar ─────────────────────────── */
.ni-chat-input-bar {
  display: flex;
  align-items: flex-end;
  padding: 10px 12px;
  border-top: 1px solid #EDE0C8;
  background: #fff;
  gap: 8px;
  flex-shrink: 0;
}
.ni-chat-input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  max-height: 80px;
  line-height: 1.4;
}
.ni-chat-input:focus { border-color: #3A7CB8; }
.ni-chat-send {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: #3A7CB8;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}
.ni-chat-send:hover { background: #2D6A9F; }
.ni-chat-send:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── Handover Form ─────────────────────── */
.ni-chat-form {
  padding: 14px 16px;
  border-top: 1px solid #EDE0C8;
  background: #fff;
  flex-shrink: 0;
}
.ni-chat-form-title {
  font-size: 13px;
  color: #6B6B6B;
  margin: 0 0 10px;
}
.ni-chat-field {
  display: block;
  width: 100%;
  padding: 8px 10px;
  margin-bottom: 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
}
.ni-chat-field:focus { border-color: #3A7CB8; }
.ni-chat-note { resize: none; }
.ni-chat-submit {
  display: block;
  width: 100%;
  padding: 10px;
  background: #9A7B2E;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.ni-chat-submit:hover { background: #B08E3A; }
.ni-chat-submit:disabled { opacity: 0.6; cursor: not-allowed; }

/* ─── Mobile ────────────────────────────── */
@media (max-width: 480px) {
  .ni-chat-widget {
    bottom: 0;
    right: 0;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }
  .ni-chat-bubble {
    bottom: 16px;
    right: 16px;
    width: 50px;
    height: 50px;
  }
}
