/* ============================================================
   MD Science & Technology – Chatbot Widget Styles
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
#md-chatbot {
  --cb-primary: #01485e;
  --cb-secondary: #01c38e;
  --cb-bg: #f5f9fa;
  --cb-white: #ffffff;
  --cb-text: #2c3e50;
  --cb-border: #ddeef2;
  --cb-shadow: rgba(1, 72, 94, 0.18);
  font-family: 'Urbanist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Toggle Button ─────────────────────────────────────────── */
#chatbot-toggle {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cb-primary) 0%, var(--cb-secondary) 100%);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px var(--cb-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  color: white;
  padding: 0;
}

#chatbot-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(1, 195, 142, 0.45);
}

#chatbot-toggle.pulse {
  animation: cb-pulse 2.5s infinite;
}

@keyframes cb-pulse {
  0%   { box-shadow: 0 4px 20px var(--cb-shadow); }
  50%  { box-shadow: 0 4px 20px var(--cb-shadow), 0 0 0 12px rgba(1, 195, 142, 0.12); }
  100% { box-shadow: 0 4px 20px var(--cb-shadow); }
}

.chatbot-toggle-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #e74c3c;
  color: white;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2.5px solid white;
  font-family: 'Urbanist', sans-serif;
  pointer-events: none;
}

/* ── Chat Window ───────────────────────────────────────────── */
#chatbot-window {
  position: fixed;
  bottom: 108px;
  right: 30px;
  width: 370px;
  height: 535px;
  background: var(--cb-white);
  border-radius: 22px;
  box-shadow: 0 14px 52px rgba(1, 72, 94, 0.2), 0 2px 8px rgba(0, 0, 0, 0.07);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10000;
  animation: cb-slideUp 0.35s cubic-bezier(0.34, 1.4, 0.64, 1);
}

@keyframes cb-slideUp {
  from { opacity: 0; transform: translateY(25px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Header ────────────────────────────────────────────────── */
#chatbot-header {
  background: linear-gradient(135deg, var(--cb-primary) 0%, #016b85 50%, #019e78 100%);
  padding: 13px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chatbot-header-info {
  display: flex;
  align-items: center;
  gap: 11px;
}

.chatbot-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  border: 2px solid rgba(255, 255, 255, 0.38);
  color: white;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.chatbot-header-text .chatbot-name {
  font-weight: 700;
  font-size: 14.5px;
  color: white;
  line-height: 1.2;
}

.chatbot-header-text .chatbot-status {
  font-size: 11.5px;
  color: rgba(168, 240, 216, 0.9);
  margin-top: 2px;
}

#chatbot-close {
  background: rgba(255, 255, 255, 0.14);
  border: none;
  color: white;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
  padding: 0;
}

#chatbot-close:hover {
  background: rgba(255, 255, 255, 0.26);
}

/* ── Messages ──────────────────────────────────────────────── */
#chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 15px 13px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--cb-bg);
  scroll-behavior: smooth;
}

#chatbot-messages::-webkit-scrollbar { width: 4px; }
#chatbot-messages::-webkit-scrollbar-track { background: transparent; }
#chatbot-messages::-webkit-scrollbar-thumb { background: #c0d8de; border-radius: 2px; }

.chatbot-message {
  display: flex;
  max-width: 90%;
}

.chatbot-message.bot  { align-self: flex-start; }
.chatbot-message.user { align-self: flex-end; }

.chatbot-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 13.5px;
  line-height: 1.58;
  word-break: break-word;
}

.chatbot-message.bot .chatbot-bubble {
  background: var(--cb-white);
  color: var(--cb-text);
  border-bottom-left-radius: 5px;
  box-shadow: 0 2px 8px rgba(1, 72, 94, 0.08);
}

.chatbot-message.user .chatbot-bubble {
  background: linear-gradient(135deg, var(--cb-primary), var(--cb-secondary));
  color: white;
  border-bottom-right-radius: 5px;
}

/* Typing indicator */
.typing-indicator .chatbot-bubble {
  padding: 12px 16px;
}

.typing-dots {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 16px;
}

.typing-dots span {
  width: 7px;
  height: 7px;
  background: var(--cb-secondary);
  border-radius: 50%;
  animation: cb-bounce 1.3s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.18s; }
.typing-dots span:nth-child(3) { animation-delay: 0.36s; }

@keyframes cb-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.7; }
  30%            { transform: translateY(-7px); opacity: 1; }
}

/* ── Quick Replies ─────────────────────────────────────────── */
#chatbot-quick-replies {
  padding: 8px 11px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  background: var(--cb-bg);
  border-top: 1px solid var(--cb-border);
}

#chatbot-quick-replies:empty {
  display: none;
  padding: 0;
}

.chatbot-quick-reply {
  background: var(--cb-white);
  border: 1.5px solid var(--cb-secondary);
  color: var(--cb-primary);
  border-radius: 20px;
  padding: 6px 13px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Urbanist', sans-serif;
  line-height: 1.3;
}

.chatbot-quick-reply:hover {
  background: var(--cb-secondary);
  color: white;
  border-color: var(--cb-secondary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(1, 195, 142, 0.3);
}

/* ── Input Area ────────────────────────────────────────────── */
#chatbot-input-area {
  padding: 11px 13px;
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--cb-white);
  border-top: 1px solid var(--cb-border);
  flex-shrink: 0;
}

#chatbot-input {
  flex: 1;
  border: 1.5px solid var(--cb-border);
  border-radius: 24px;
  padding: 9px 16px;
  font-size: 13.5px;
  font-family: 'Urbanist', sans-serif;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  background: var(--cb-bg);
  color: var(--cb-text);
  min-width: 0;
}

#chatbot-input:focus {
  border-color: var(--cb-secondary);
  background: var(--cb-white);
}

#chatbot-input::placeholder { color: #a0b8c0; }

#chatbot-input:disabled {
  background: #f0f0f0;
  color: #b0b0b0;
  cursor: not-allowed;
  border-color: #e0e0e0;
}

#chatbot-send {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cb-primary), var(--cb-secondary));
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
  padding: 0;
}

#chatbot-send:hover:not(:disabled) {
  transform: scale(1.1);
  box-shadow: 0 4px 16px rgba(1, 195, 142, 0.4);
}

#chatbot-send:disabled {
  background: #ced8db;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 480px) {
  #chatbot-toggle {
    bottom: 20px;
    right: 16px;
    width: 56px;
    height: 56px;
  }

  #chatbot-window {
    bottom: 86px;
    right: 10px;
    width: calc(100vw - 20px);
    height: calc(100dvh - 106px);
    max-height: 530px;
    border-radius: 18px;
  }
}
