/* ── Sleek Academia Chatbot Widget ────────────────────────────────────── */

#sa-chatbot-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #0f172a;
  border: 2.5px solid #f59e0b;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.45);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  color: #f59e0b;
  padding: 0;
}

#sa-chatbot-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(15, 23, 42, 0.6);
}

#sa-chatbot-toggle svg {
  width: 26px;
  height: 26px;
  fill: #f59e0b;
  flex-shrink: 0;
}

/* ── Popup ────────────────────────────────────────────────────────────── */

#sa-chatbot-popup {
  position: fixed;
  bottom: 88px;
  right: 24px;
  z-index: 99998;
  width: 360px;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 10px 48px rgba(0, 0, 0, 0.2), 0 2px 8px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transform: scale(0.94) translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.22s cubic-bezier(0.34, 1.4, 0.64, 1), opacity 0.18s ease;
  max-height: 540px;
}

#sa-chatbot-popup.sa-open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ── Header ───────────────────────────────────────────────────────────── */

#sa-chat-header {
  background: #0f172a;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.sa-chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
  flex-shrink: 0;
  letter-spacing: -0.5px;
}

.sa-chat-header-info {
  flex: 1;
  min-width: 0;
}

.sa-chat-header-info h4 {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 1px;
  line-height: 1.2;
  font-family: inherit;
}

.sa-chat-header-info p {
  font-size: 11.5px;
  color: #f59e0b;
  margin: 0;
  line-height: 1.2;
  font-family: inherit;
}

#sa-chat-close {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 5px;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
  font-family: inherit;
}

#sa-chat-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

/* ── Online dot ───────────────────────────────────────────────────────── */

.sa-online-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  margin-right: 4px;
  vertical-align: middle;
}

/* ── Messages ─────────────────────────────────────────────────────────── */

#sa-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f8fafc;
  min-height: 0;
  max-height: 330px;
  scroll-behavior: smooth;
}

#sa-chat-messages::-webkit-scrollbar {
  width: 4px;
}
#sa-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
#sa-chat-messages::-webkit-scrollbar-thumb {
  background: #e2e8f0;
  border-radius: 4px;
}

.sa-msg {
  max-width: 84%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
  font-family: inherit;
}

.sa-msg-ai {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #e8edf3;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.sa-msg-user {
  background: #0f172a;
  color: #f1f5f9;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.sa-msg-system {
  font-size: 12.5px;
  color: #64748b;
  text-align: center;
  padding: 6px 10px;
  background: #f1f5f9;
  border-radius: 20px;
  align-self: center;
  max-width: 90%;
}

/* ── Typing indicator ─────────────────────────────────────────────────── */

.sa-typing {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 11px 14px;
  background: #ffffff;
  border: 1px solid #e8edf3;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.sa-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f59e0b;
  display: block;
  animation: saDotBounce 1.3s infinite ease-in-out;
}

.sa-typing span:nth-child(2) { animation-delay: 0.18s; }
.sa-typing span:nth-child(3) { animation-delay: 0.36s; }

@keyframes saDotBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.6; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ── Action buttons (Email / WhatsApp) ────────────────────────────────── */

.sa-send-actions {
  display: flex;
  gap: 8px;
  padding: 4px 14px 10px;
  flex-wrap: wrap;
}

.sa-action-btn {
  padding: 8px 16px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid #0f172a;
  background: #ffffff;
  color: #0f172a;
  transition: background 0.15s, color 0.15s, transform 0.1s;
  font-family: inherit;
}

.sa-action-btn:hover {
  background: #0f172a;
  color: #f59e0b;
  transform: translateY(-1px);
}

.sa-action-btn:active {
  transform: translateY(0);
}

/* ── Input row ────────────────────────────────────────────────────────── */

#sa-chat-input-row {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #e8edf3;
  background: #ffffff;
  flex-shrink: 0;
  align-items: flex-end;
}

#sa-chat-input {
  flex: 1;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13.5px;
  color: #1e293b;
  outline: none;
  background: #f8fafc;
  resize: none;
  font-family: inherit;
  line-height: 1.4;
  max-height: 80px;
  overflow-y: auto;
  transition: border-color 0.15s, background 0.15s;
}

#sa-chat-input:focus {
  border-color: #f59e0b;
  background: #ffffff;
}

#sa-chat-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#sa-chat-send {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #f59e0b;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
  flex-shrink: 0;
}

#sa-chat-send:hover {
  background: #d97706;
  transform: translateY(-1px);
}

#sa-chat-send:active {
  transform: translateY(0);
}

#sa-chat-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

#sa-chat-send svg {
  width: 18px;
  height: 18px;
  fill: #0f172a;
}

/* ── Mobile ───────────────────────────────────────────────────────────── */

@media (max-width: 430px) {
  #sa-chatbot-popup {
    right: 8px;
    left: 8px;
    width: auto;
    bottom: 80px;
    border-radius: 14px;
  }

  #sa-chatbot-toggle {
    right: 16px;
    bottom: 16px;
  }
}
