/* ============================================================
   NANDIKA FASTENERS — AI SALES ASSISTANT WIDGET CSS
   Matching website industrial aesthetic (Inter, #000, #EA580C)
   ============================================================ */

/* Standard Accessible UI Vector Icons */
.ui-icon {
  display: inline-block;
  vertical-align: -0.18em;
  width: 1.15em;
  height: 1.15em;
  stroke-width: 2;
  stroke: currentColor;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  margin-right: 0.35em;
}

.ui-icon-no-margin {
  margin-right: 0;
}

.ui-icon-success {
  color: #22c55e;
}

.ui-icon-warning {
  color: #f59e0b;
}

.ui-icon-danger {
  color: #ef4444;
}

.ui-icon-primary {
  color: #ea580c;
}

/* Floating Trigger Button - Styled identically to WhatsApp float */
.nf-chat-trigger {
  position: fixed;
  bottom: 10.2rem;
  right: 3rem;
  width: 6rem;
  height: 6rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(234, 88, 12, 0.4), 0 0 0 0 rgba(234, 88, 12, 0);
  cursor: pointer;
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease, opacity 0.4s ease;
  user-select: none;
}

.nf-chat-trigger.visible {
  opacity: 1;
  pointer-events: all;
}

.nf-chat-trigger:hover {
  transform: scale(1.14) translateY(-2px);
  box-shadow: 0 10px 40px rgba(234, 88, 12, 0.6), 0 0 0 0 rgba(234, 88, 12, 0);
}

.nf-chat-trigger svg {
  width: 3.2rem;
  height: 3.2rem;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
  transition: transform 0.3s ease;
}

.nf-chat-trigger:hover svg {
  transform: scale(1.08) rotate(-4deg);
}

/* Pulse animation ring - exact same 2.2s pulse wave as WhatsApp */
.nf-chat-trigger::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(234, 88, 12, 0.5);
  animation: nf-ai-pulse 2.2s ease-out infinite;
  pointer-events: none;
}

@keyframes nf-ai-pulse {
  0% { transform: scale(1); opacity: 0.8; }
  70% { transform: scale(1.4); opacity: 0; }
  100% { transform: scale(1.4); opacity: 0; }
}

/* Welcoming Teaser Popup */
.nf-teaser-popup {
  position: fixed;
  bottom: 10.2rem;
  right: 10.2rem;
  width: 270px;
  background: rgba(24, 24, 27, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(234, 88, 12, 0.4);
  border-radius: 16px;
  padding: 1.2rem 1.4rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85), 0 0 1px 1px rgba(234, 88, 12, 0.3);
  z-index: 499;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateX(12px) scale(0.95);
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.35s,
              border-color 0.2s,
              box-shadow 0.2s;
  user-select: none;
}

.nf-teaser-popup.nf-visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(0) scale(1);
}

.nf-teaser-popup:hover {
  border-color: #ea580c;
  box-shadow: 0 18px 48px rgba(234, 88, 12, 0.3), 0 4px 16px rgba(0, 0, 0, 0.95);
}

/* Arrow pointing towards the AI button */
.nf-teaser-popup::after {
  content: '';
  position: absolute;
  top: 50%;
  right: -8px;
  transform: translateY(-50%);
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 8px solid #18181b;
}

.nf-teaser-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: none;
  color: #71717a;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.nf-teaser-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.nf-teaser-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: #a1a1aa;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.nf-teaser-text {
  font-size: 1.35rem;
  font-weight: 500;
  color: #fafafa;
  line-height: 1.45;
  margin-bottom: 0.6rem;
}

.nf-teaser-action {
  font-size: 1.15rem;
  color: #ea580c;
  font-weight: 500;
}

/* Tooltip Badge - Styled identically to WhatsApp tooltip */
.nf-chat-tooltip {
  position: absolute;
  right: calc(100% + 1.2rem);
  top: 50%;
  transform: translateY(-50%) scale(0.9);
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.7rem 1.4rem;
  border-radius: 0.8rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.nf-chat-tooltip::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 100%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-left-color: rgba(0, 0, 0, 0.82);
}

.nf-online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px #22c55e;
}

.nf-chat-trigger:hover .nf-chat-tooltip {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

/* Active indicator notification dot */
.nf-chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #000;
}

/* Main Chat Modal Window */
.nf-chat-window {
  position: fixed;
  bottom: 3rem;
  right: 3rem;
  width: 410px;
  max-width: calc(100vw - 3.2rem);
  height: 620px;
  max-height: calc(100vh - 6rem);
  background: #09090b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(234, 88, 12, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1000;
  overscroll-behavior: contain;
  touch-action: pan-y;
  pointer-events: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.96);
  transform-origin: bottom right;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.3s;
  font-family: 'Inter', -apple-system, sans-serif;
  color: #f4f4f5;
}

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

/* Header */
.nf-chat-header {
  padding: 1.4rem 1.8rem;
  background: linear-gradient(180deg, #18181b 0%, #111113 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nf-chat-brand {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

.nf-brand-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #18181b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.nf-brand-avatar svg {
  width: 30px;
  height: 30px;
}

.nf-brand-info h4 {
  font-size: 1.45rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.nf-brand-sub {
  font-size: 1.15rem;
  color: #a1a1aa;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2px;
}

.nf-header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.nf-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a1a1aa;
  background: transparent;
  transition: background 0.2s, color 0.2s;
}

.nf-icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nf-icon-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* Chat Body & Messages */
.nf-chat-body {
  flex: 1 1 auto;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: auto !important;
  padding: 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  background: #09090b;
  position: relative;
  pointer-events: auto;
  will-change: scroll-position;
}

.nf-chat-body::-webkit-scrollbar {
  width: 5px;
}

.nf-chat-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
}

/* Message Bubble */
.nf-msg {
  display: flex;
  flex-direction: column;
  max-width: 86%;
  animation: nfFadeIn 0.25s ease-out;
}

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

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

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

.nf-bubble {
  padding: 1.1rem 1.4rem;
  border-radius: 14px;
  font-size: 1.35rem;
  line-height: 1.5;
  word-break: break-word;
}

.nf-msg-bot .nf-bubble {
  background: #18181b;
  color: #e4e4e7;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-bottom-left-radius: 4px;
}

.nf-msg-user .nf-bubble {
  background: #ea580c;
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.25);
}

.nf-bubble p { margin-bottom: 0.6rem; }
.nf-bubble p:last-child { margin-bottom: 0; }
.nf-bubble strong { color: #fff; font-weight: 600; }
.nf-msg-user .nf-bubble strong { color: #fff; }
.nf-bubble ul { margin: 0.6rem 0; padding-left: 1.6rem; }
.nf-bubble li { margin-bottom: 0.3rem; }
.nf-bubble a { color: #f97316; text-decoration: underline; }

/* Typing animation */
.nf-typing-dots {
  display: inline-flex;
  gap: 4px;
  padding: 4px 6px;
}
.nf-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a1a1aa;
  animation: nfBlink 1.4s infinite both;
}
.nf-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.nf-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes nfBlink {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1.1); }
}

/* Product Cards Container */
.nf-product-cards {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-top: 0.8rem;
}

.nf-product-card {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  background: #141417;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.9rem;
  border-radius: 12px;
  transition: border-color 0.2s, background 0.2s;
}

.nf-product-card:hover {
  border-color: #ea580c;
  background: #1c1917;
}

.nf-card-thumb {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  background: #27272a;
  flex-shrink: 0;
}

.nf-card-details {
  flex: 1;
  min-width: 0;
}

.nf-card-name {
  font-size: 1.25rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nf-card-sub {
  font-size: 1.1rem;
  color: #a1a1aa;
  margin-top: 2px;
}

.nf-card-act {
  font-size: 1.15rem;
  color: #ea580c;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 4px;
}

/* Suggestion Chips */
.nf-suggestions-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.8rem;
}

.nf-chip {
  background: #1c1917;
  border: 1px solid rgba(234, 88, 12, 0.4);
  color: #fdba74;
  font-size: 1.18rem;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.15s;
}

.nf-chip:hover {
  background: #ea580c;
  color: #fff;
  transform: translateY(-1px);
}

/* In-Chat Quote Form */
.nf-quote-form {
  background: #18181b;
  border: 1px solid rgba(234, 88, 12, 0.3);
  border-radius: 12px;
  padding: 1.2rem;
  margin-top: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.nf-quote-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #ea580c;
}

.nf-quote-input {
  width: 100%;
  padding: 0.7rem 1rem;
  background: #09090b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #fff;
  font-size: 1.2rem;
  font-family: inherit;
  outline: none;
}

.nf-quote-input:focus {
  border-color: #ea580c;
}

.nf-quote-submit {
  background: #ea580c;
  color: #fff;
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 1.25rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  text-align: center;
}

.nf-quote-submit:hover {
  background: #f97316;
}

/* Chat Input Footer */
.nf-chat-footer {
  padding: 1.2rem 1.4rem;
  background: #111113;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.nf-input-bar {
  display: flex;
  align-items: center;
  background: #18181b;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9999px;
  padding: 0.4rem 0.5rem 0.4rem 1.4rem;
  transition: border-color 0.2s;
}

.nf-input-bar:focus-within {
  border-color: #ea580c;
}

.nf-chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 1.3rem;
  font-family: inherit;
}

.nf-chat-input::placeholder {
  color: #71717a;
}

.nf-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #ea580c;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}

.nf-send-btn:hover {
  background: #f97316;
  transform: scale(1.05);
}

.nf-send-btn svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

/* Mobile Breakpoint */
@media (max-width: 768px) {
  .nf-chat-trigger {
    bottom: 78px;
    right: 14px;
    width: 52px;
    height: 52px;
  }
  .nf-chat-trigger svg {
    width: 32px;
    height: 32px;
  }
  .nf-chat-tooltip {
    display: none;
  }
  .nf-teaser-popup {
    bottom: 78px;
    right: 76px;
    width: 220px;
    padding: 1rem 1.1rem;
  }
  .nf-teaser-text {
    font-size: 1.25rem;
  }
  .nf-chat-window {
    bottom: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    height: 90vh;
    max-height: 90vh;
    border-radius: 20px 20px 0 0;
    transform-origin: bottom center;
  }
}
