/* ═══════════════════════════════════════ */
/* MariaShine AI Chat Widget              */
/* ═══════════════════════════════════════ */

/* Chat Toggle Button */
#ms-chat-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5B9A3C 0%, #4a8531 100%);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(91, 154, 60, 0.4);
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
#ms-chat-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(91, 154, 60, 0.55);
}
#ms-chat-btn svg {
  width: 28px;
  height: 28px;
  fill: #fff;
}

/* Chat Panel */
#ms-chat-panel {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 350px;
  height: 500px;
  background: #fff;
  border-radius: 15px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
  z-index: 99998;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
#ms-chat-panel.ms-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Header */
#ms-chat-header {
  background: linear-gradient(135deg, #5B9A3C 0%, #4a8531 100%);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
#ms-chat-header-title {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
#ms-chat-header-title svg {
  width: 20px;
  height: 20px;
  fill: #fff;
}
#ms-chat-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  opacity: 0.85;
  transition: opacity 0.2s;
}
#ms-chat-close:hover {
  opacity: 1;
}

/* Messages Area */
#ms-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f7f8fa;
}
#ms-chat-messages::-webkit-scrollbar {
  width: 5px;
}
#ms-chat-messages::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

/* Message Bubbles */
.ms-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 14px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 13.5px;
  line-height: 1.45;
  word-wrap: break-word;
  animation: ms-fade-in 0.25s ease;
}
.ms-msg a {
  color: inherit;
  text-decoration: underline;
}
.ms-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, #5B9A3C 0%, #4a8531 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ms-msg-bot {
  align-self: flex-start;
  background: #e9ecef;
  color: #222;
  border-bottom-left-radius: 4px;
}

/* Typing Indicator */
.ms-typing {
  align-self: flex-start;
  display: flex;
  gap: 5px;
  padding: 12px 18px;
  background: #e9ecef;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}
.ms-typing-dot {
  width: 7px;
  height: 7px;
  background: #999;
  border-radius: 50%;
  animation: ms-bounce 1.2s infinite;
}
.ms-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.ms-typing-dot:nth-child(3) { animation-delay: 0.3s; }

/* Input Area */
#ms-chat-input-area {
  display: flex;
  padding: 10px 12px;
  border-top: 1px solid #e5e5e5;
  background: #fff;
  gap: 8px;
  flex-shrink: 0;
}
#ms-chat-input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 9px 15px;
  font-size: 13.5px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  outline: none;
  transition: border-color 0.2s;
}
#ms-chat-input:focus {
  border-color: #5B9A3C;
}
#ms-chat-input::placeholder {
  color: #aaa;
}
#ms-chat-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5B9A3C 0%, #4a8531 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s;
}
#ms-chat-send:hover {
  transform: scale(1.08);
}
#ms-chat-send svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

/* Animations */
@keyframes ms-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes ms-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-5px); }
}

/* Mobile Responsive */
@media (max-width: 480px) {
  #ms-chat-panel {
    width: calc(100vw - 16px);
    height: calc(100vh - 120px);
    bottom: 80px;
    right: 8px;
    border-radius: 12px;
  }
  #ms-chat-btn {
    bottom: 14px;
    right: 14px;
  }
}
