/* ==========================================================================
   ASK NIKOLAS CHAT WIDGET
   ========================================================================== */

/* Container - hidden by default, shown via JS */
#chat-widget {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 9999;
  font-family: 'Lato', sans-serif;
  display: none; /* JS controls visibility */
}

#chat-widget.visible {
  display: block;
}

/* --------------------------------------------------------------------------
   FLOATING BUBBLE
   -------------------------------------------------------------------------- */
.chat-bubble {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #1a1a1a;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease, background 0.2s ease;
  position: relative;
}

.chat-bubble:hover {
  transform: scale(1.1);
  background: #333;
}

.chat-bubble svg {
  width: 24px;
  height: 24px;
  color: #fff;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.chat-bubble .icon-close {
  display: none;
}

#chat-widget.open .chat-bubble .icon-chat {
  display: none;
}

#chat-widget.open .chat-bubble .icon-close {
  display: block;
}

/* Notification dot */
.chat-bubble-dot {
  position: absolute;
  top: 0;
  right: 0;
  width: 12px;
  height: 12px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid #fff;
  animation: pulse 2s infinite;
}

#chat-widget.open .chat-bubble-dot {
  display: none;
}

.chat-bubble-beta {
  position: absolute;
  bottom: -6px;
  right: -6px;
  background: #f59e0b;
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  padding: 2px 4px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-family: 'Lato', sans-serif;
  border: 1.5px solid #fff;
  white-space: nowrap;
}

#chat-widget.open .chat-bubble-beta {
  display: none;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; }
}

/* --------------------------------------------------------------------------
   CHAT WINDOW
   -------------------------------------------------------------------------- */
.chat-window {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 380px;
  height: 500px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  border: 1px solid #e5e7eb;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

#chat-widget.open .chat-window {
  display: flex;
  animation: slideUp 0.3s ease;
}

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

/* Header */
.chat-header {
  background: #1a1a1a;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  font-style: italic;
}

.chat-header-text h3 {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  font-family: 'Poppins', sans-serif;
  display: flex;
  align-items: center;
  gap: 8px;
}

.beta-badge {
  display: inline-block;
  background: #f59e0b;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: 'Lato', sans-serif;
}

.chat-header-text p {
  color: #9ca3af;
  font-size: 12px;
  margin: 0;
}

.chat-close {
  margin-left: auto;
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

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

/* Messages area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: #f9fafb;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-message {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.4;
}

.chat-message.assistant {
  background: #fff;
  color: #374151;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

.chat-message.user {
  background: #1a1a1a;
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

/* Typing indicator */
.typing-indicator {
  display: none;
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e5e7eb;
  padding: 12px 16px;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
}

.typing-indicator.visible {
  display: flex;
  gap: 4px;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: #9ca3af;
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out;
}

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

@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}

/* Suggested questions */
.chat-suggestions {
  padding: 8px 12px;
  border-top: 1px solid #f3f4f6;
  background: #fff;
}

.chat-suggestions p {
  font-size: 11px;
  color: #6b7280;
  margin: 0 0 6px 0;
}

.chat-suggestions-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.suggestion-btn {
  background: #f3f4f6;
  border: none;
  padding: 6px 10px;
  border-radius: 12px;
  font-size: 12px;
  color: #374151;
  cursor: pointer;
  transition: background 0.2s;
}

.suggestion-btn:hover {
  background: #e5e7eb;
}

/* Input area */
.chat-input-area {
  padding: 12px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
  display: flex;
  gap: 8px;
}

.chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
}

.chat-input:focus {
  border-color: #1a1a1a;
}

.chat-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #1a1a1a;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.chat-send:hover {
  background: #333;
}

.chat-send:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

.chat-send svg {
  width: 16px;
  height: 16px;
  color: #fff;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

/* --------------------------------------------------------------------------
   RESPONSIVE
   -------------------------------------------------------------------------- */
@media (max-width: 400px) {
  .chat-window {
    width: calc(100vw - 32px);
    right: 0;
  }
}

