/* ═══════════════════════════════════════════════
   MasterCode Chatbot Widget
   ═══════════════════════════════════════════════ */

#mc-chatbot {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  font-family: 'Tajawal', 'Cairo', sans-serif;
}

/* ── Toggle button ── */
#mc-chat-toggle {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#mc-chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.45);
}

/* ── Chat window ── */
#mc-chat-window {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 360px;
  max-height: 540px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: mc-slideUp 0.25s ease;
}

@keyframes mc-slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Header ── */
#mc-chat-header {
  background: linear-gradient(135deg, #1a1a2e 0%, #0f3460 100%);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

#mc-chat-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

#mc-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  flex-shrink: 0;
}

#mc-chat-name {
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}

#mc-chat-status {
  color: rgba(255,255,255,0.75);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 1px;
}

.mc-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  display: inline-block;
  animation: mc-pulse 2s infinite;
}

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

#mc-chat-close {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.8);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: background 0.15s;
}

#mc-chat-close:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

/* ── Messages area ── */
#mc-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f7f8fc;
  min-height: 200px;
  max-height: 300px;
}

#mc-chat-messages::-webkit-scrollbar {
  width: 4px;
}
#mc-chat-messages::-webkit-scrollbar-thumb {
  background: #dde;
  border-radius: 4px;
}

/* ── Message rows ── */
.mc-msg-row {
  display: flex;
  max-width: 88%;
}

.mc-msg-row.mc-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.mc-msg-row.mc-bot {
  align-self: flex-start;
}

/* ── Bubbles ── */
.mc-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
}

.mc-user .mc-bubble {
  background: linear-gradient(135deg, #0f3460, #1a1a2e);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.mc-bot .mc-bubble {
  background: #fff;
  color: #1a1a2e;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.08);
}

/* ── Typing indicator ── */
.mc-typing-bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
}

.mc-typing-bubble span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #0f3460;
  display: inline-block;
  animation: mc-bounce 1.2s infinite;
}

.mc-typing-bubble span:nth-child(2) { animation-delay: 0.2s; }
.mc-typing-bubble span:nth-child(3) { animation-delay: 0.4s; }

@keyframes mc-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40%            { transform: translateY(-6px); opacity: 1; }
}

/* ── Quick replies ── */
#mc-quick-replies {
  padding: 8px 12px 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: #f7f8fc;
  border-top: 1px solid #eee;
  flex-shrink: 0;
}

.mc-qr-btn {
  padding: 5px 12px;
  border: 1.5px solid #0f3460;
  background: #fff;
  color: #0f3460;
  border-radius: 20px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.mc-qr-btn:hover {
  background: #0f3460;
  color: #fff;
}

/* ── Input area ── */
#mc-chat-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid #eee;
  flex-shrink: 0;
}

#mc-chat-input {
  flex: 1;
  border: 1.5px solid #dde;
  border-radius: 22px;
  padding: 9px 14px;
  font-size: 16px;
  font-family: inherit;
  outline: none;
  color: #1a1a2e;
  transition: border-color 0.15s;
}

#mc-chat-input:focus {
  border-color: #0f3460;
}

#mc-chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0f3460, #1a1a2e);
  border: none;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s, box-shadow 0.15s;
}

#mc-chat-send:hover {
  transform: scale(1.07);
  box-shadow: 0 3px 12px rgba(15, 52, 96, 0.4);
}

/* ── Responsive ── */
@media (max-width: 420px) {
  #mc-chatbot {
    bottom: 16px;
    right: 16px;
  }

  #mc-chat-window {
    width: calc(100vw - 32px);
    right: -16px;
  }
}
