/* ============================================
   MYERS COLLEGE CHATBOT — PREMIUM WIDGET
   Matches Maroon / Black / Gold theme
   ============================================ */

/* ── PROACTIVE TOOLTIP (The pop-up question) ── */
#chatbot-tooltip {
  position: fixed;
  bottom: 42px;
  right: 105px; /* positioned to the left of the button */
  background: #fff;
  color: var(--black-rich);
  padding: 12px 18px;
  border-radius: 16px 16px 4px 16px;
  box-shadow: 0 10px 40px -10px rgba(0,0,0,0.3);
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.4;
  z-index: 9989;
  opacity: 0;
  transform: translateX(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid rgba(196, 151, 58, 0.3);
}
#chatbot-tooltip.show {
  opacity: 1;
  transform: translateX(0) scale(1);
  pointer-events: auto;
  animation: float-tooltip 4s ease-in-out infinite;
}
@keyframes float-tooltip {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
/* Little triangle pointing to the button */
#chatbot-tooltip::after {
  content: '';
  position: absolute;
  right: -8px;
  bottom: 12px;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 8px solid #fff;
}
.tooltip-close {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 1.2rem;
  color: rgba(0,0,0,0.4);
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}
.tooltip-close:hover {
  color: var(--maroon);
}

/* ── CHATBOT TOGGLE BUTTON ── */
#chatbot-toggle {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9990;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
  background: linear-gradient(135deg, #b01a24 0%, #701017 100%);
  color: #ffffff;
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 30px -4px rgba(176, 26, 36, 0.7), inset 0 2px 4px rgba(255, 255, 255, 0.15);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: chatbot-pulse 3s ease-in-out infinite;
}
#chatbot-toggle:hover {
  transform: scale(1.08) translateY(-4px);
  box-shadow: 0 16px 40px -4px rgba(176, 26, 36, 0.9);
  background: linear-gradient(135deg, #c91d29 0%, #87131b 100%);
}
#chatbot-toggle.active {
  animation: none;
  background: linear-gradient(135deg, #b01a24 0%, #701017 100%);
  border-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  transform: rotate(90deg);
}
@keyframes chatbot-pulse {
  0%, 100% { box-shadow: 0 12px 30px -4px rgba(176, 26, 36, 0.7), 0 0 0 0 rgba(176, 26, 36, 0.5); }
  50% { box-shadow: 0 12px 30px -4px rgba(176, 26, 36, 0.7), 0 0 0 20px rgba(176, 26, 36, 0); }
}

/* ── CHATBOT WINDOW ── */
#chatbot-window {
  position: fixed;
  bottom: 110px;
  right: 28px;
  z-index: 9991;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 620px;
  max-height: calc(100vh - 140px);
  border-radius: 24px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: rgba(18, 18, 18, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(196, 151, 58, 0.18);
  box-shadow: 0 30px 90px -12px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.96);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#chatbot-window.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* ── HEADER ── */
#chatbot-window .chatbot-header {
  padding: 18px 20px;
  background: linear-gradient(135deg, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.2) 100%);
  border-bottom: 1px solid rgba(196, 151, 58, 0.14);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.chatbot-header-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(196, 151, 58, 0.2), rgba(196, 151, 58, 0.05));
  border: 1px solid rgba(196, 151, 58, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.2rem;
}
.chatbot-header-info {
  flex-grow: 1;
}
.chatbot-header-info h4 {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 2px;
  line-height: 1;
}
.chatbot-header-info p {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.50);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.chatbot-header-info .online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
  box-shadow: 0 0 8px #22c55e;
  animation: online-blink 2s ease-in-out infinite;
}
@keyframes online-blink {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px #22c55e; }
  50% { opacity: 0.5; box-shadow: 0 0 2px #22c55e; }
}

.chatbot-close-btn {
  margin-left: auto;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.4rem;
  transition: all 0.2s;
}
.chatbot-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* ── MESSAGES AREA ── */
#chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(196, 151, 58, 0.25) transparent;
}
#chatbot-messages::-webkit-scrollbar { width: 5px; }
#chatbot-messages::-webkit-scrollbar-track { background: transparent; }
#chatbot-messages::-webkit-scrollbar-thumb { background: rgba(196, 151, 58, 0.25); border-radius: 10px; }

/* ── MESSAGE BUBBLES ── */
.chat-msg {
  display: flex;
  gap: 12px;
  max-width: 90%;
  animation: msg-slide-in 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes msg-slide-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Bot messages — left */
.chat-msg.bot {
  align-self: flex-start;
}
.chat-msg.bot .chat-bubble {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px 18px 18px 18px;
  padding: 14px 18px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.9rem;
  line-height: 1.6;
  font-family: var(--font-body);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.chat-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(196, 151, 58, 0.15), rgba(196, 151, 58, 0.05));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.85rem;
  color: var(--gold);
  margin-top: 2px;
  border: 1px solid rgba(196, 151, 58, 0.2);
}

/* User messages — right */
.chat-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.chat-msg.user .chat-bubble {
  background: linear-gradient(135deg, var(--maroon), var(--maroon-deep));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px 6px 18px 18px;
  padding: 14px 18px;
  color: #fff;
  font-size: 0.9rem;
  line-height: 1.6;
  font-family: var(--font-body);
  box-shadow: 0 6px 16px rgba(107, 20, 20, 0.3);
}

/* ── TYPING INDICATOR ── */
.typing-indicator {
  display: flex;
  gap: 5px;
  padding: 8px 4px;
  align-items: center;
}
.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  opacity: 0.4;
  animation: typing-bounce 1.4s infinite ease-in-out both;
}
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
@keyframes typing-bounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ── QUICK SUGGESTIONS ── */
.chatbot-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 16px;
}
.chatbot-suggestions button {
  background: rgba(196, 151, 58, 0.08);
  border: 1px solid rgba(196, 151, 58, 0.25);
  color: var(--gold-light);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
  font-family: var(--font-body);
}
.chatbot-suggestions button:hover {
  background: rgba(196, 151, 58, 0.25);
  border-color: rgba(196, 151, 58, 0.6);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(196, 151, 58, 0.15);
}

/* ── INPUT AREA ── */
.chatbot-input-area {
  padding: 16px;
  background: rgba(0, 0, 0, 0.4);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  gap: 12px;
  align-items: center;
  flex-shrink: 0;
}
#chatbot-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 12px 18px;
  color: #fff;
  font-size: 0.95rem;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
  resize: none;
  max-height: 80px;
  line-height: 1.5;
}
#chatbot-input::-webkit-scrollbar { width: 4px; }
#chatbot-input::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 10px; }
#chatbot-input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}
#chatbot-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(196, 151, 58, 0.15);
}
#chatbot-send {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--black-rich);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.3s ease;
}
#chatbot-send:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(196, 151, 58, 0.4);
}
#chatbot-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* ── MOBILE RESPONSIVE ── */
@media (max-width: 768px) {
  #chatbot-window {
    right: 0;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    max-width: 100%;
    max-height: 100dvh;
    border-radius: 0;
    border: none;
    background: #0A0A0A; /* True deep black for mobile */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    transform: translateY(100%);
  }
  #chatbot-window.open {
    transform: translateY(0);
  }
  #chatbot-toggle {
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
  }
  .chat-msg {
    max-width: 92%;
  }
  .chatbot-input-area {
    padding: 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom)); /* Native iOS app feel */
  }
  #chatbot-tooltip {
    right: 90px;
    bottom: 28px;
    max-width: calc(100vw - 110px);
    font-size: 0.8rem;
    padding: 10px 14px;
  }
}

/* ── PRINT HIDE ── */
@media print {
  #chatbot-toggle, #chatbot-window, #chatbot-tooltip { display: none !important; }
}
