/* Chat Widget Container */
#jakpa-chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: 'Poppins', sans-serif;
}

/* Chat Button (Minimized State) */
.jakpa-chat-button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  border: none;
  box-shadow: 0 4px 20px rgba(30, 58, 138, 0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  position: relative;
}

.jakpa-chat-button:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 25px rgba(30, 58, 138, 0.4);
}

.jakpa-chat-button i {
  color: white;
  font-size: 24px;
}

/* Notification Badge */
.jakpa-chat-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #f97316;
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

/* Chat Window (Expanded State) */
.jakpa-chat-window {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 380px;
  height: 600px;
  background: white;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.3s ease-out;
}

.jakpa-chat-window.open {
  display: flex;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Chat Header */
.jakpa-chat-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  color: white;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.jakpa-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.jakpa-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: #1e3a8a;
}

.jakpa-header-text h3 {
  font-size: 16px;
  font-weight: 800;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.jakpa-header-text p {
  font-size: 10px;
  margin: 2px 0 0;
  opacity: 0.9;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 700;
}

.jakpa-close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.jakpa-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.jakpa-close-btn i {
  color: white;
  font-size: 18px;
}

/* Chat Messages Area */
.jakpa-chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.jakpa-chat-messages::-webkit-scrollbar {
  width: 6px;
}

.jakpa-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.jakpa-chat-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.jakpa-chat-messages::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Message Bubbles */
.jakpa-message {
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: fadeIn 0.3s ease-out;
  margin-bottom: 16px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.jakpa-message.user {
  align-items: flex-end;
}

.jakpa-message.assistant {
  align-items: flex-start;
}

.jakpa-message-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.jakpa-message.user .jakpa-message-header {
  flex-direction: row-reverse;
}

.jakpa-message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
}

.jakpa-message.assistant .jakpa-message-avatar {
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  color: white;
}

.jakpa-message.user .jakpa-message-avatar {
  background: #f97316;
  color: white;
}

.jakpa-message-time {
  font-size: 9px;
  color: #94a3b8;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 1px;
}

.jakpa-message-content {
  max-width: 85%;
}

.jakpa-message-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.5;
  word-wrap: break-word;
}

.jakpa-message.assistant .jakpa-message-bubble {
  background: white;
  color: #334155;
  border: 1px solid #e2e8f0;
  border-top-left-radius: 4px;
}

.jakpa-message.user .jakpa-message-bubble {
  background: #1e3a8a;
  color: white;
  border-top-right-radius: 4px;
}

/* Typing Indicator */
.jakpa-typing {
  display: none;
  align-items: center;
  gap: 10px;
}

.jakpa-typing.active {
  display: flex;
}

.jakpa-typing-dots {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: white;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
}

.jakpa-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94a3b8;
  animation: typingBounce 1.4s infinite;
}

.jakpa-typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.jakpa-typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingBounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-8px);
  }
}

/* Chat Input Area */
.jakpa-chat-input {
  padding: 16px;
  background: white;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 12px;
  align-items: center;
}

.jakpa-input-field {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 13px;
  font-family: 'Poppins', sans-serif;
  outline: none;
  transition: all 0.2s;
}

.jakpa-input-field:focus {
  border-color: #1e3a8a;
  background: #f8fafc;
}

.jakpa-input-field::placeholder {
  color: #94a3b8;
}

.jakpa-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.jakpa-send-btn:hover {
  transform: scale(1.05);
}

.jakpa-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.jakpa-send-btn i {
  color: white;
  font-size: 18px;
}

/* Markdown Formatting in Messages */
.jakpa-message-bubble strong {
  font-weight: 800;
  color: inherit;
}

.jakpa-message-bubble em {
  font-style: italic;
  color: inherit;
}

.jakpa-message-bubble code {
  background: rgba(0, 0, 0, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
}

.jakpa-message.assistant .jakpa-message-bubble code {
  background: #f1f5f9;
  color: #1e3a8a;
}

.jakpa-message.user .jakpa-message-bubble code {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.jakpa-message-bubble ul,
.jakpa-message-bubble ol {
  margin: 8px 0;
  padding-left: 20px;
}

.jakpa-message-bubble li {
  margin: 4px 0;
  line-height: 1.5;
}

.jakpa-message-bubble ul li {
  list-style-type: disc;
}

.jakpa-message-bubble ol li {
  list-style-type: decimal;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .jakpa-chat-window {
    width: calc(100vw - 32px);
    height: calc(100vh - 100px);
    bottom: 16px;
    right: 16px;
  }

  #jakpa-chat-widget {
    bottom: 16px;
    right: 16px;
  }
}
