/* ============================================
   Lost Kiwi — AI Concierge Chatbot Widget CSS
   Design: Dark Nordic Glassmorphism with Aurora Green Accents
   ============================================ */

/* --- Floating Trigger Button --- */
#kc-chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00D68F 0%, #0ABAB5 100%);
  border: none;
  box-shadow: 0 8px 24px rgba(0, 214, 143, 0.35), 0 0 16px rgba(0, 214, 143, 0.2);
  cursor: pointer;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
  outline: none;
}

#kc-chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 32px rgba(0, 214, 143, 0.45), 0 0 24px rgba(0, 214, 143, 0.3);
}

#kc-chat-toggle:active {
  transform: scale(0.96);
}

#kc-chat-toggle svg {
  width: 26px;
  height: 26px;
  fill: #0A0E17;
  transition: transform 0.3s ease;
}

#kc-chat-toggle.active svg.icon-chat {
  display: none;
}

#kc-chat-toggle:not(.active) svg.icon-close {
  display: none;
}

/* Pulsing Badge on Trigger */
#kc-chat-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  background: #00D68F;
  border: 2px solid #0A0E17;
  border-radius: 50%;
  animation: kc-pulse 2s infinite;
}

@keyframes kc-pulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 214, 143, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(0, 214, 143, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 214, 143, 0); }
}

/* --- Chat Panel Window --- */
#kc-chat-widget {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  height: 540px;
  max-height: calc(100vh - 120px);
  background: rgba(17, 24, 39, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(0, 214, 143, 0.25);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(0, 214, 143, 0.12);
  display: flex;
  flex-direction: column;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: #F1F5F9;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.95);
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

#kc-chat-widget.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Header */
.kc-chat-header {
  padding: 16px 18px;
  background: rgba(26, 31, 46, 0.85);
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kc-chat-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.kc-chat-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00D68F, #0ABAB5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #0A0E17;
}

.kc-chat-title-text {
  display: flex;
  flex-direction: column;
}

.kc-chat-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: #F1F5F9;
  line-height: 1.2;
}

.kc-chat-status {
  font-size: 0.75rem;
  color: #00D68F;
  display: flex;
  align-items: center;
  gap: 5px;

}

.kc-status-dot {
  width: 6px;
  height: 6px;
  background-color: #00D68F;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 6px #00D68F;
}

.kc-chat-close {
  background: transparent;
  border: none;
  color: #94A3B8;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}

.kc-chat-close:hover {
  color: #F1F5F9;
  background: rgba(255, 255, 255, 0.1);
}

/* Messages Area */
.kc-chat-body {
  flex: 1;
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
}

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

.kc-chat-body::-webkit-scrollbar-track {
  background: transparent;
}

.kc-chat-body::-webkit-scrollbar-thumb {
  background: rgba(0, 214, 143, 0.2);
  border-radius: 10px;
}

/* Message Bubbles */
.kc-msg {
  max-width: 86%;
  padding: 12px 15px;
  border-radius: 16px;
  word-wrap: break-word;
  animation: kc-fadeIn 0.25s ease-out;
}

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

.kc-msg-bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #F1F5F9;
  border-bottom-left-radius: 4px;
}

.kc-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, #00D68F 0%, #0ABAB5 100%);
  color: #0A0E17;
  font-weight: 500;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 14px rgba(0, 214, 143, 0.2);
}

/* Markdown formatting inside bot messages */
.kc-msg-bot p {
  margin: 0 0 8px 0;
}
.kc-msg-bot p:last-child {
  margin-bottom: 0;
}
.kc-msg-bot ul, .kc-msg-bot ol {
  margin: 6px 0;
  padding-left: 20px;
}
.kc-msg-bot li {
  margin-bottom: 4px;
}
.kc-msg-bot strong {
  color: #00D68F;
}
.kc-msg-bot a {
  color: #00D68F;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity 0.2s;
}
.kc-msg-bot a:hover {
  opacity: 0.85;
}

/* Typing Indicator */
.kc-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  width: fit-content;
}

.kc-typing-dot {
  width: 6px;
  height: 6px;
  background: #00D68F;
  border-radius: 50%;
  animation: kc-bounce 1.4s infinite ease-in-out both;
}

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

@keyframes kc-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Input Area */
.kc-chat-footer {
  padding: 14px 16px;
  background: rgba(26, 31, 46, 0.85);
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  display: flex;
  gap: 10px;
  align-items: center;
}

#kc-chat-input {
  flex: 1;
  background: rgba(10, 14, 23, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  padding: 10px 14px;
  color: #F1F5F9;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#kc-chat-input:focus {
  border-color: #00D68F;
  box-shadow: 0 0 10px rgba(0, 214, 143, 0.2);
}

#kc-chat-input::placeholder {
  color: #64748B;
}

#kc-chat-send {
  background: linear-gradient(135deg, #00D68F, #0ABAB5);
  border: none;
  border-radius: 12px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s, opacity 0.2s;
  flex-shrink: 0;
}

#kc-chat-send:hover {
  transform: scale(1.05);
}

#kc-chat-send:active {
  transform: scale(0.95);
}

#kc-chat-send svg {
  width: 18px;
  height: 18px;
  fill: #0A0E17;
}

/* Responsive Mobile Layout */
@media (max-width: 480px) {
  #kc-chat-widget {
    right: 16px;
    left: 16px;
    width: auto;
    bottom: 88px;
    height: 75vh;
  }
  #kc-chat-toggle {
    bottom: 16px;
    right: 16px;
  }
}
