/**
 * chatbot.css - Nordic Parfume Club Luxury Assistant & Order Tracker
 */

/* Floating Launcher Button */
.npc-chat-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #181a20 0%, #0d0e12 100%);
  border: 1.5px solid #C5A059;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4), 0 0 15px rgba(197, 160, 89, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 100001;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.npc-chat-launcher:hover {
  transform: scale(1.06);
  border-color: #E2C98C;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(197, 160, 89, 0.4);
}

.npc-chat-launcher svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: #C5A059;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.3s ease;
}

.npc-chat-launcher:hover svg {
  stroke: #E2C98C;
  transform: rotate(5deg);
}

/* Unread / Notification Pulse Badge */
.npc-chat-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 18px;
  height: 18px;
  background: #C5A059;
  color: #0b0d11;
  font-size: 11px;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #0d0e12;
  box-shadow: 0 0 8px rgba(197, 160, 89, 0.6);
  animation: npcPulse 2.5s infinite;
}

@keyframes npcPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(197, 160, 89, 0.7); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 8px rgba(197, 160, 89, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(197, 160, 89, 0); }
}

/* Chat Tooltip / Teaser Bubble */
.npc-chat-teaser {
  position: fixed;
  bottom: 94px;
  right: 24px;
  background: #181a20;
  border: 1px solid #C5A059;
  border-radius: 12px;
  padding: 10px 14px;
  color: #f3f4f6;
  font-size: 13px;
  font-family: inherit;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  z-index: 9997;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  animation: npcSlideUpFade 0.4s ease-out;
  max-width: 260px;
  line-height: 1.35;
}

.npc-chat-teaser::after {
  content: '';
  position: absolute;
  bottom: -6px;
  right: 24px;
  width: 10px;
  height: 10px;
  background: #181a20;
  border-right: 1px solid #C5A059;
  border-bottom: 1px solid #C5A059;
  transform: rotate(45deg);
}

.npc-chat-teaser-close {
  color: #9ca3af;
  font-size: 14px;
  margin-left: 6px;
  cursor: pointer;
  padding: 2px;
  line-height: 1;
}

.npc-chat-teaser-close:hover {
  color: #fff;
}

/* Chat Main Window */
.npc-chat-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  height: 580px;
  max-height: calc(100vh - 120px);
  background: #0f1117;
  border: 1.5px solid rgba(197, 160, 89, 0.5);
  border-radius: 18px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.65), 0 0 25px rgba(197, 160, 89, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 100002;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.28s;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.npc-chat-window.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Header */
.npc-chat-header {
  padding: 14px 16px;
  background: linear-gradient(135deg, #181b24 0%, #10121a 100%);
  border-bottom: 1px solid rgba(197, 160, 89, 0.3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.npc-chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #1f232e;
  border: 1px solid #C5A059;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #C5A059;
  position: relative;
  flex-shrink: 0;
}

.npc-chat-status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 9px;
  height: 9px;
  background: #10b981;
  border: 2px solid #10121a;
  border-radius: 50%;
}

.npc-chat-title-group h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #f9fafb;
  letter-spacing: 0.3px;
}

.npc-chat-title-group p {
  margin: 2px 0 0;
  font-size: 11px;
  color: #9ca3af;
  display: flex;
  align-items: center;
  gap: 4px;
}

.npc-chat-close-btn {
  background: transparent;
  border: none;
  color: #9ca3af;
  font-size: 18px;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.npc-chat-close-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* Chat Messages Container */
.npc-chat-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #0f1117;
  scroll-behavior: smooth;
}

.npc-chat-body::-webkit-scrollbar {
  width: 5px;
}
.npc-chat-body::-webkit-scrollbar-thumb {
  background: rgba(197, 160, 89, 0.2);
  border-radius: 4px;
}

/* Messages */
.npc-msg {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  animation: npcFadeIn 0.25s ease-out;
}

@keyframes npcFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.npc-msg-bot {
  align-self: flex-start;
}

.npc-msg-user {
  align-self: flex-end;
}

.npc-msg-bubble {
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.45;
  word-break: break-word;
}

.npc-msg-bot .npc-msg-bubble {
  background: #1a1e28;
  color: #e5e7eb;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom-left-radius: 4px;
}

.npc-msg-user .npc-msg-bubble {
  background: linear-gradient(135deg, #C5A059 0%, #9F7E3B 100%);
  color: #0b0d11;
  font-weight: 500;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(197, 160, 89, 0.25);
}

.npc-msg-time {
  font-size: 10px;
  color: #6b7280;
  margin-top: 3px;
  padding: 0 4px;
}

.npc-msg-bot .npc-msg-time {
  text-align: left;
}

.npc-msg-user .npc-msg-time {
  text-align: right;
  color: #9ca3af;
}

/* Quick Action Chips */
.npc-quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.npc-chip {
  background: rgba(197, 160, 89, 0.1);
  border: 1px solid rgba(197, 160, 89, 0.4);
  color: #E2C98C;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-family: inherit;
}

.npc-chip:hover {
  background: #C5A059;
  color: #0b0d11;
  border-color: #C5A059;
  transform: translateY(-1px);
}

/* Rich Order Card inside Bot Message */
.npc-order-card {
  margin-top: 8px;
  background: #141720;
  border: 1px solid rgba(197, 160, 89, 0.35);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.npc-order-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 8px;
}

.npc-order-num {
  font-weight: 700;
  color: #C5A059;
  font-size: 13.5px;
}

.npc-order-date {
  font-size: 11px;
  color: #9ca3af;
}

.npc-order-status-badge {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.npc-order-desc {
  font-size: 12.5px;
  color: #d1d5db;
  line-height: 1.4;
}

/* Order Item List */
.npc-order-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 150px;
  overflow-y: auto;
  padding-right: 4px;
}

.npc-order-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  padding: 6px 8px;
  border-radius: 6px;
}

.npc-order-item-img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  background: #fff;
  border-radius: 4px;
  flex-shrink: 0;
}

.npc-order-item-info {
  flex: 1;
  min-width: 0;
}

.npc-order-item-name {
  font-size: 12px;
  color: #f3f4f6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.npc-order-item-meta {
  font-size: 11px;
  color: #9ca3af;
}

.npc-order-card-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #d1d5db;
}

.npc-order-total-val {
  font-weight: 700;
  color: #C5A059;
}

.npc-order-track-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #C5A059;
  color: #0b0d11;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 8px;
  margin-top: 4px;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
  text-align: center;
}

.npc-order-track-btn:hover {
  background: #E2C98C;
  transform: translateY(-1px);
}

/* Inline Contact Form inside Bot Message */
.npc-contact-card {
  margin-top: 8px;
  background: #141720;
  border: 1px solid rgba(197, 160, 89, 0.35);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.npc-contact-input {
  width: 100%;
  box-sizing: border-box;
  background: #0f1117;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 8px 10px;
  color: #fff;
  font-size: 12.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.npc-contact-input:focus {
  border-color: #C5A059;
}

.npc-contact-textarea {
  min-height: 60px;
  resize: vertical;
}

.npc-contact-submit {
  background: #C5A059;
  color: #0b0d11;
  font-weight: 600;
  font-size: 12.5px;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

.npc-contact-submit:hover {
  background: #E2C98C;
}

/* Typing Indicator */
.npc-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: #1a1e28;
  border-radius: 14px;
  width: fit-content;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.npc-typing-dot {
  width: 6px;
  height: 6px;
  background: #C5A059;
  border-radius: 50%;
  animation: npcTyping 1.4s infinite ease-in-out both;
}

.npc-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.npc-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes npcTyping {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Chat Footer / Input Form */
.npc-chat-footer {
  padding: 10px 12px;
  background: #141720;
  border-top: 1px solid rgba(197, 160, 89, 0.25);
}

.npc-chat-input-form {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #0f1117;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 4px 6px 4px 14px;
  transition: border-color 0.2s;
}

.npc-chat-input-form:focus-within {
  border-color: #C5A059;
}

.npc-chat-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

.npc-chat-input::placeholder {
  color: #6b7280;
}

.npc-chat-send-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #C5A059;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #0b0d11;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.npc-chat-send-btn:hover {
  background: #E2C98C;
  transform: scale(1.05);
}

.npc-chat-send-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* Responsive Mobile Layout */
@media (max-width: 480px) {
  .npc-chat-launcher {
    bottom: 18px;
    right: 16px;
    width: 50px;
    height: 50px;
  }

  .npc-chat-teaser {
    bottom: 74px;
    right: 14px;
    max-width: 220px;
    padding: 8px 12px;
    font-size: 11.5px;
    line-height: 1.3;
  }

  .npc-chat-window {
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100vw;
    height: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    border: none;
    z-index: 100005;
  }

  .npc-chat-header {
    padding-top: max(14px, env(safe-area-inset-top));
  }

  .npc-chat-footer {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
}
