/* ================================================================
   MASIF CHATBOT — PREMIUM DESIGN SYSTEM
   Matches : Obsidian Black × Warm Cream × Amber Gold
   ================================================================ */

.ms-chatbot-container {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 9999;
  font-family: var(--font-body, 'DM Sans', sans-serif);
}

/* --- Floating Action Button --- */
.ms-chatbot-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--accent, #c9a26c);
  border: none;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(201, 162, 108, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.4s var(--ease-spring, cubic-bezier(0.34, 1.56, 0.64, 1));
  position: relative;
}

.ms-chatbot-toggle:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 15px 40px rgba(201, 162, 108, 0.45);
}

.ms-chatbot-toggle svg {
  width: 28px;
  height: 28px;
  color: var(--bg-primary, #0c0b09);
  transition: transform 0.4s ease;
}

.ms-chatbot-toggle.active svg {
  transform: rotate(90deg);
}

/* Pulse Animation */
.ms-chatbot-toggle::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.4;
  z-index: -1;
  animation: ms-pulse 2.5s infinite;
}

@keyframes ms-pulse {
  0% { transform: scale(1); opacity: 0.5; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* --- Chat Window --- */
.ms-chat-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 380px;
  height: 550px;
  background: var(--glass, rgba(12, 11, 9, 0.95));
  backdrop-filter: blur(25px) saturate(180%);
  -webkit-backdrop-filter: blur(25px) saturate(180%);
  border: 1px solid var(--glass-border, rgba(201, 162, 108, 0.14));
  border-radius: var(--radius-lg, 14px);
  box-shadow: var(--shadow-xl, 0 40px 80px rgba(0,0,0,0.72));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.5s var(--ease, cubic-bezier(0.25, 0.46, 0.45, 0.94));
  transform-origin: bottom right;
}

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

/* --- Chat Header --- */
.ms-chat-header {
  padding: 24px;
  background: linear-gradient(to right, rgba(201, 162, 108, 0.1), transparent);
  border-bottom: 1px solid var(--border-strong, rgba(201, 162, 108, 0.16));
  display: flex;
  align-items: center;
  gap: 15px;
}

.ms-chat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--bg-card, #191610);
  border: 1px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--accent);
  font-weight: 500;
}

.ms-chat-header-info h4 {
  margin: 0;
  font-family: var(--font-display);
  color: var(--text-primary, #f2e8d8);
  font-size: 1.1rem;
}

.ms-chat-header-info p {
  margin: 0;
  font-size: 0.75rem;
  color: var(--accent);
  opacity: 0.8;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* --- Chat Body --- */
.ms-chat-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-mid) transparent;
}

.ms-chat-body::-webkit-scrollbar {
  width: 4px;
}

.ms-chat-body::-webkit-scrollbar-thumb {
  background: var(--accent-mid);
  border-radius: 10px;
}

/* Messages */
.ms-message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
  animation: ms-fadeIn 0.4s ease forwards;
}

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

.ms-message.bot {
  align-self: flex-start;
  background: var(--bg-card, #191610);
  color: var(--text-primary);
  border-bottom-left-radius: 2px;
  border: 1px solid rgba(242, 232, 216, 0.05);
}

.ms-message.user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--bg-primary);
  border-bottom-right-radius: 2px;
}

/* Quick Replies */
.ms-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 5px;
}

.ms-quick-btn {
  background: rgba(201, 162, 108, 0.08);
  border: 1px solid rgba(201, 162, 108, 0.2);
  color: var(--text-primary);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.ms-quick-btn:hover {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
}

/* --- Chat Footer --- */
.ms-chat-footer {
  padding: 20px;
  border-top: 1px solid var(--border-strong);
  display: flex;
  gap: 10px;
}

.ms-chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 10px 15px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.3s ease;
}

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

.ms-chat-send {
  background: var(--accent);
  color: var(--bg-primary);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.ms-chat-send:hover {
  transform: scale(1.05);
}

/* --- Typing Indicator --- */
.ms-typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
  background: var(--bg-card, #191610);
  border: 1px solid rgba(242, 232, 216, 0.05);
  border-radius: 12px;
  border-bottom-left-radius: 2px;
  align-self: flex-start;
  animation: ms-fadeIn 0.3s ease forwards;
}

.ms-typing-indicator span {
  width: 7px;
  height: 7px;
  background: var(--accent, #c9a26c);
  border-radius: 50%;
  opacity: 0.4;
  animation: ms-bounce 1.2s infinite ease-in-out;
}

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

@keyframes ms-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.3; }
  40%           { transform: scale(1);   opacity: 1; }
}

/* Mobile Responsive */
@media (max-width: 480px) {
  .ms-chat-window {
    width: calc(100vw - 40px);
    height: calc(100vh - 120px);
    bottom: 80px;
    right: -10px;
  }
  .ms-chatbot-container {
    bottom: 20px;
    right: 20px;
  }
}
