/* ================================================
   apnaPR Chatbot — Sleek Cinematic Dark Theme
   ================================================ */

:root {
  --chat-blue:       #0d6efd;
  --chat-blue-glow:  rgba(13, 110, 253, 0.4);
  --chat-bg:         rgba(10, 15, 30, 0.85);
  --chat-border:     rgba(255, 255, 255, 0.08);
  --chat-text:       #f8fafc;
  --chat-text-muted: #94a3b8;
}

/* Chat Trigger Floating Button */
.apnapr-chat-trigger {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--chat-blue) 0%, #0056b3 100%);
  box-shadow: 0 8px 32px var(--chat-blue-glow);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 9999;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.apnapr-chat-trigger:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 40px rgba(13, 110, 253, 0.6);
}

.apnapr-chat-trigger:active {
  transform: scale(0.9);
}

/* Pulse Animation for Trigger Button */
.apnapr-chat-trigger::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 50%;
  border: 2px solid var(--chat-blue);
  animation: chat-pulse 2s infinite;
  opacity: 0;
  pointer-events: none;
}

@keyframes chat-pulse {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  100% {
    transform: scale(1.4);
    opacity: 0;
  }
}

.apnapr-chat-trigger svg {
  width: 26px;
  height: 26px;
  fill: #fff;
  transition: transform 0.3s ease;
}

.apnapr-chat-trigger.active svg {
  transform: rotate(90deg);
}

/* Chat Window Container */
.apnapr-chat-window {
  position: fixed;
  bottom: 105px;
  right: 30px;
  width: 380px;
  height: 550px;
  border-radius: 20px;
  background: var(--chat-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--chat-border);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  font-family: 'Inter', sans-serif;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.apnapr-chat-window.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Chat Header */
.apnapr-chat-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--chat-border);
  background: linear-gradient(90deg, rgba(13, 110, 253, 0.15), transparent);
}

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

.apnapr-chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.apnapr-chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.apnapr-chat-status {
  display: flex;
  flex-direction: column;
}

.apnapr-chat-status h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  margin: 0;
  letter-spacing: 0.5px;
}

.apnapr-chat-online-indicator {
  font-size: 0.75rem;
  color: #10b981;
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}

.apnapr-chat-online-indicator::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background-color: #10b981;
  border-radius: 50%;
  animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.apnapr-chat-close-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--chat-text-muted);
  transition: color 0.2s ease, transform 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

.apnapr-chat-close-btn:hover {
  color: #fff;
  transform: rotate(90deg);
}

/* Chat Messages Box */
.apnapr-chat-messages-box {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

/* Scrollbar Style */
.apnapr-chat-messages-box::-webkit-scrollbar {
  width: 4px;
}
.apnapr-chat-messages-box::-webkit-scrollbar-track {
  background: transparent;
}
.apnapr-chat-messages-box::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}
.apnapr-chat-messages-box::-webkit-scrollbar-thumb:hover {
  background: var(--chat-blue);
}

/* Messages Bubbles */
.apnapr-chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  animation: message-slide 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

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

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

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

.apnapr-chat-bubble {
  padding: 12px 16px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.apnapr-chat-msg.bot .apnapr-chat-bubble {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--chat-text);
  border-radius: 14px 14px 14px 0;
}

.apnapr-chat-msg.user .apnapr-chat-bubble {
  background: linear-gradient(135deg, var(--chat-blue) 0%, #0056b3 100%);
  color: #fff;
  border-radius: 14px 14px 0 14px;
}

.apnapr-chat-timestamp {
  font-size: 0.7rem;
  color: var(--chat-text-muted);
  margin-top: 4px;
  align-self: flex-start;
}

.apnapr-chat-msg.user .apnapr-chat-timestamp {
  align-self: flex-end;
}

/* Typing Indicator */
.apnapr-chat-typing {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 14px 14px 14px 0;
  width: fit-content;
  align-self: flex-start;
}

.apnapr-chat-typing span {
  width: 6px;
  height: 6px;
  background-color: var(--chat-text-muted);
  border-radius: 50%;
  animation: typing-dots 1.4s infinite ease-in-out both;
}

.apnapr-chat-typing span:nth-child(1) { animation-delay: -0.32s; }
.apnapr-chat-typing span:nth-child(2) { animation-delay: -0.16s; }

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

/* Interactive Quick Replies */
.apnapr-chat-quick-replies {
  padding: 0 20px 15px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.apnapr-chat-chip {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--chat-text);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
  outline: none;
}

.apnapr-chat-chip:hover {
  background: rgba(13, 110, 253, 0.1);
  border-color: var(--chat-blue);
  transform: translateY(-1px);
}

.apnapr-chat-chip:active {
  transform: translateY(0);
}

/* Custom Link Button inside bubble */
.apnapr-chat-btn-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--chat-blue);
  color: #fff !important;
  padding: 8px 16px;
  border-radius: 8px;
  margin-top: 10px;
  font-weight: 600;
  font-size: 0.8rem;
  transition: background-color 0.2s ease;
  text-decoration: none;
}

.apnapr-chat-btn-link:hover {
  background: #0056b3;
}

/* Input Area */
.apnapr-chat-input-area {
  padding: 16px;
  border-top: 1px solid var(--chat-border);
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  gap: 8px;
  align-items: center;
}

.apnapr-chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--chat-border);
  border-radius: 12px;
  padding: 10px 14px;
  color: #fff;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.apnapr-chat-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.apnapr-chat-input:focus {
  border-color: var(--chat-blue);
  background: rgba(255, 255, 255, 0.08);
}

.apnapr-chat-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--chat-blue);
  border: none;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.apnapr-chat-send-btn:hover {
  background: #0056b3;
  transform: scale(1.05);
}

.apnapr-chat-send-btn:active {
  transform: scale(0.95);
}

.apnapr-chat-send-btn svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

/* Responsive adjustment */
@media (max-width: 480px) {
  .apnapr-chat-window {
    width: calc(100% - 30px);
    height: calc(100% - 120px);
    bottom: 95px;
    right: 15px;
  }
  .apnapr-chat-trigger {
    bottom: 20px;
    right: 20px;
  }
}
