/* ==================================================
   MAZVERSE AI CHATBOT - GLASSMORPHISM DESIGN SYSTEM
   ================================================== */

/* Variables */
:root {
  --chat-bg: rgba(23, 12, 6, 0.95);
  --chat-border: rgba(255, 255, 255, 0.08);
  --chat-header-grad: linear-gradient(135deg, #2b1d14 0%, #170C06 100%);
  --chat-bot-bubble: rgba(255, 255, 255, 0.04);
  --chat-user-bubble: #FF9500;
  --chat-text-white: #ffffff;
  --chat-text-gray: #a69a91;
  --chat-accent: #FF9500;
  --chat-font: 'Plus Jakarta Sans', 'PP Neue Montreal', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* --- Floating Toggle Button --- */
.chatbot-toggle {
  position: fixed;
  bottom: 25px;
  right: 25px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  /* background-color: var(--chat-accent);
  color: var(--chat-text-white); */
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(255, 149, 0, 0.4);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-toggle:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 12px 28px rgba(255, 149, 0, 0.6);
}

.chatbot-toggle.active {
  display: none !important;
}

.chatbot-toggle img.chatbot-toggle-img {
  /* width: 32px !important; */
  /* height: 32px !important; */
  object-fit: contain;
  /* filter: brightness(0) invert(1) !important; */
}

.chatbot-toggle.active img.chatbot-toggle-img {
  display: none !important;
}

.chatbot-toggle.active i.chatbot-toggle-close-icon {
  display: block !important;
}

/* --- Chatbot Main Container --- */
.chatbot-container {
  position: fixed;
  bottom: 95px;
  right: 25px;
  width: 380px;
  height: 600px;
  background-color: var(--chat-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid var(--chat-border);
  border-radius: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  z-index: 998;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--chat-font);
  opacity: 0;
  transform: translateY(30px) scale(0.95);
  pointer-events: none;
  transition: all 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chatbot-container.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* --- Chat Header --- */
.chatbot-header {
  padding: 16px 20px;
  background: var(--chat-header-grad);
  border-bottom: 1px solid var(--chat-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.chatbot-bot-logo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.chatbot-bot-logo img {
  width: 20px;
  height: auto;
}

.chatbot-bot-details h3 {
  color: var(--chat-text-white);
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.3px;
}

.chatbot-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  color: var(--chat-text-gray);
  margin-top: 2px;
}

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

.chatbot-close {
  background: none;
  border: none;
  color: var(--chat-text-gray);
  font-size: 1.25rem;
  cursor: pointer;
  transition: color 0.2s;
  padding: 4px;
}

.chatbot-close:hover {
  color: var(--chat-text-white);
}

/* --- Chat Body (Messages Area) --- */
.chatbot-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

/* Custom Scrollbar for Messages */
.chatbot-messages::-webkit-scrollbar {
  width: 5px;
}

.chatbot-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Message Bubble Container */
.chat-message {
  max-width: 80%;
  display: flex;
  flex-direction: column;
}

.chat-message.bot {
  align-self: flex-start;
  align-items: flex-start;
}

.chat-message.user {
  align-self: flex-end;
  align-items: flex-end;
}

/* Message Bubble Box */
.chat-message .message-content {
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 0.92rem;
  line-height: 1.45;
}

.chat-message.bot .message-content {
  background-color: var(--chat-bot-bubble);
  border: 1px solid var(--chat-border);
  color: var(--chat-text-white);
  border-bottom-left-radius: 4px;
}

.chat-message.user .message-content {
  background-color: var(--chat-user-bubble);
  color: #170C06;
  font-weight: 500;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(255, 149, 0, 0.15);
}

.chat-message .message-time {
  font-size: 0.72rem;
  color: var(--chat-text-gray);
  margin-top: 5px;
  padding: 0 4px;
}

/* Formatting within bubbles */
.message-content p {
  margin: 0 0 8px 0;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-content strong {
  font-weight: 600;
}

.message-content ul,
.message-content ol {
  margin: 8px 0;
  padding-left: 20px;
}

.message-content li {
  margin-bottom: 4px;
}

.message-content li:last-child {
  margin-bottom: 0;
}

.message-content h1,
.message-content h2,
.message-content h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 12px 0 6px 0;
  color: var(--chat-accent);
}

.message-content h1:first-child,
.message-content h2:first-child,
.message-content h3:first-child {
  margin-top: 0;
}

/* Code Blocks Styling */
.message-content code {
  font-family: 'Courier New', Courier, monospace;
  background-color: rgba(255, 255, 255, 0.08);
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 0.85rem;
  color: #ff7b72;
}

.message-content pre {
  background-color: rgba(0, 0, 0, 0.35) !important;
  border: 1px solid var(--chat-border);
  border-radius: 8px;
  padding: 10px 14px;
  overflow-x: auto;
  margin: 10px 0;
}

.message-content pre code {
  background: none !important;
  padding: 0 !important;
  color: #e6edf3 !important;
  display: block;
  line-height: 1.4;
  white-space: pre;
}

/* Code Syntax Highlighting colors */
.hl-keyword {
  color: #ff7b72;
  font-weight: bold;
}

.hl-string {
  color: #a5d6ff;
}

.hl-comment {
  color: #8b949e;
  font-style: italic;
}

.hl-number {
  color: #79c0ff;
}

.hl-function {
  color: #d2a8ff;
}

.hl-tag {
  color: #7ee787;
}

.hl-attr {
  color: #d2a8ff;
}

/* --- Chat Input Footer --- */
.chatbot-input-form {
  padding: 14px 20px;
  background-color: rgba(43, 29, 20, 0.4);
  border-top: 1px solid var(--chat-border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.chatbot-input-form input {
  flex: 1;
  background: rgba(0, 0, 0, 0.2);
  border: 1.5px solid var(--chat-border);
  border-radius: 50px;
  padding: 12px 18px;
  color: var(--chat-text-white);
  font-size: 0.9rem;
  outline: none;
  font-family: var(--chat-font);
  transition: border-color 0.25s;
}

.chatbot-input-form input:focus {
  border-color: var(--chat-accent);
}

.chatbot-input-form input::placeholder {
  color: var(--chat-text-gray);
  opacity: 0.7;
}

.chatbot-input-form button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--chat-accent);
  color: #170C06;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: transform 0.2s, background-color 0.2s;
}

.chatbot-input-form button:hover {
  transform: scale(1.05);
  background-color: #ffaa33;
}

.chatbot-input-form button:disabled {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--chat-text-gray);
  cursor: not-allowed;
  transform: none;
}

/* --- Typing Indicator Animation --- */
.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
}

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

.typing-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typingBounce {

  0%,
  80%,
  100% {
    transform: scale(0);
  }

  40% {
    transform: scale(1);
  }
}

/* --- RESPONSIVE LAYOUTS --- */

/* Laptop Specific sizing */
@media (min-width: 769px) {
  .chatbot-container {
    width: 385px;
    height: 600px;
  }
}

/* Laptop (max-width: 1200px) */
@media (max-width: 1200px) {
  .chat-message .message-content {
    font-size: 0.9rem;
  }
  .chatbot-bot-details h3 {
    font-size: 1rem;
  }
  .chatbot-input-form input {
    font-size: 0.88rem;
  }
}

/* Tablet (max-width: 768px) */
@media (max-width: 768px) {
  .chatbot-container {
    width: 340px;
    height: 550px;
    bottom: 85px;
    right: 20px;
  }

  .chatbot-toggle {
    bottom: 20px;
    right: 20px;
  }

  .chat-message .message-content {
    font-size: 0.85rem;
  }
  .chatbot-bot-details h3 {
    font-size: 0.98rem;
  }
  .chatbot-input-form input {
    font-size: 0.85rem;
  }
}

/* Mobile (max-width: 480px) */
@media (max-width: 480px) {
  .chatbot-toggle {
    bottom: 16px;
    right: 16px;
    width: 50px;
    height: 50px;
    font-size: 1.35rem;
  }

  .chatbot-container {
    width: calc(100% - 32px); /* Floating card layout on mobile */
    max-width: 350px;
    height: 500px;
    bottom: 80px;
    right: 16px;
    border-radius: 24px;
    border: 1.5px solid var(--chat-border);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
  }

  .chatbot-container.active {
    transform: translateY(0) scale(1);
  }

  .chatbot-header {
    padding: 14px 16px;
    border-radius: 24px 24px 0 0; /* Keep top corners rounded */
  }

  .chatbot-messages {
    padding: 16px;
  }

  .chatbot-input-form {
    padding: 12px 16px;
  }

  .chat-message .message-content {
    font-size: 0.82rem;
  }
  .chatbot-bot-details h3 {
    font-size: 0.95rem;
  }
  .chatbot-input-form input {
    font-size: 0.82rem;
  }
}

/* Small Mobile (max-width: 375px) */
@media (max-width: 375px) {
  .chat-message .message-content {
    font-size: 0.78rem;
  }
  .chatbot-bot-details h3 {
    font-size: 0.9rem;
  }
  .chatbot-input-form input {
    font-size: 0.78rem;
  }
}

/* Extra Small Mobile (max-width: 320px) */
@media (max-width: 320px) {
  .chat-message .message-content {
    font-size: 0.75rem;
  }
  .chatbot-bot-details h3 {
    font-size: 0.85rem;
  }
  .chatbot-input-form input {
    font-size: 0.75rem;
  }
}
