/* ── UM Course Chatbot Widget — chatbot.css ───────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

/* ── CSS Variables — Light / White Theme ──────────────────────────────────── */
:root {
  --umcc-primary: #6c3ef3;
  --umcc-primary-dark: #5228d9;
  --umcc-primary-light: #8b63f7;
  --umcc-gradient: linear-gradient(135deg, #8a73ce 0%, #4ab3b2 100%);

  /* White theme surfaces */
  --umcc-bg: #f5f5fb;
  --umcc-surface: #ffffff;
  --umcc-surface-2: #f0f0fa;
  --umcc-border: #e2e2f0;

  /* Text */
  --umcc-text: #1a1a2e;
  --umcc-text-muted: #7777a0;

  /* Bubbles */
  --umcc-bot-bubble: #f0f0fa;
  --umcc-bot-text: #1a1a2e;

  /* Shadow */
  --umcc-shadow: 0 24px 64px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(108, 62, 243, 0.10);

  --umcc-radius: 20px;
  --umcc-font: 'Outfit', system-ui, -apple-system, sans-serif;
  --umcc-launcher-h: 52px;
  --umcc-w: 380px;
  --umcc-h: 560px;
  --umcc-z: 99999;
}

/* ── Launcher Button (Rectangle, LEFT side) ──────────────────────────────── */
.umcc-launcher {
  position: fixed;
  bottom: 28px;
  left: 28px;
  /* LEFT side */
  height: var(--umcc-launcher-h);
  padding: 0 22px;
  border-radius: 14px;
  /* Rectangle with rounded corners */
  background: linear-gradient(90deg, #077170 0%, #40A7A6 100%);
  box-shadow: 0 8px 28px rgba(108, 62, 243, 0.40), 0 2px 8px rgba(0, 0, 0, 0.12);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  z-index: var(--umcc-z);
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.22s ease;
  user-select: none;
  outline: none;
  font-family: var(--umcc-font);
  white-space: nowrap;
}

.umcc-launcher:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 36px rgba(108, 62, 243, 0.55), 0 4px 12px rgba(0, 0, 0, 0.15);
}

.umcc-launcher:active {
  transform: translateY(0);
}

/* Subtle pulse glow on the launcher */
.umcc-launcher::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 18px;
  border: 2px solid rgba(108, 62, 243, 0.4);
  animation: umcc-pulse 2.8s ease-out infinite;
  pointer-events: none;
}

@keyframes umcc-pulse {
  0% {
    opacity: 1;
    transform: scale(1);
  }

  70% {
    opacity: 0;
    transform: scale(1.12);
  }

  100% {
    opacity: 0;
    transform: scale(1.12);
  }
}

/* Launcher label text */
.umcc-launcher-label {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.01em;
  transition: opacity 0.2s;
}

.umcc-launcher-icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s;
}

.umcc-launcher-icon.umcc-icon-close {
  font-style: normal;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

/* Unread badge */
.umcc-unread-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ff3d71;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  animation: umcc-bounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes umcc-bounce {
  0% {
    transform: scale(0);
  }

  100% {
    transform: scale(1);
  }
}

/* ── Chat Window (LEFT side) ─────────────────────────────────────────────── */
.umcc-window {
  position: fixed;
  bottom: 94px;
  left: 28px;
  /* LEFT side */
  width: var(--umcc-w);
  height: var(--umcc-h);
  background: var(--umcc-surface);
  border-radius: var(--umcc-radius);
  box-shadow: var(--umcc-shadow);
  border: 1px solid var(--umcc-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: var(--umcc-z);
  font-family: var(--umcc-font);
  animation: umcc-slide-in 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: bottom left;
  /* Animates from bottom-left */
}

@keyframes umcc-slide-in {
  0% {
    opacity: 0;
    transform: scale(0.75) translateY(24px);
  }

  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ── Header ────────────────────────────────────────────────────────────────── */
.umcc-header {
  background: var(--umcc-gradient);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.umcc-header-avatar {
  width: 32px;
  height: 32px;
  border-radius: 12px;
  /* Rectangle avatar */
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

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

.umcc-header-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.01em;
}

.umcc-header-subtitle {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.umcc-online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 6px #4ade80;
  animation: umcc-blink 2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes umcc-blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.45;
  }
}

.umcc-header-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.umcc-header-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s ease;
  font-family: var(--umcc-font);
}

.umcc-header-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* ── Messages Area ─────────────────────────────────────────────────────────── */
.umcc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--umcc-bg);
  scroll-behavior: smooth;
}

.umcc-messages::-webkit-scrollbar {
  width: 4px;
}

.umcc-messages::-webkit-scrollbar-track {
  background: transparent;
}

.umcc-messages::-webkit-scrollbar-thumb {
  background: #d0d0e8;
  border-radius: 4px;
}

/* ── Message Rows ─────────────────────────────────────────────────────────── */
.umcc-msg {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  animation: umcc-msg-in 0.22s ease;
  max-width: 100%;
}

@keyframes umcc-msg-in {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.umcc-msg.umcc-msg-user {
  flex-direction: row-reverse;
}

/* Avatars */
.umcc-msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  /* Rectangle avatar */
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.umcc-msg-bot .umcc-msg-avatar {
  background: #ede9fe;
  border: 1px solid #d8d0fa;
}

.umcc-msg-user .umcc-msg-avatar {
  background: var(--umcc-gradient);
  font-size: 12px;
  color: #fff;
  font-weight: 700;
}

/* Bubbles */
.umcc-bubble {
  padding: 11px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.55;
  max-width: 78%;
  word-break: break-word;
}

.umcc-msg-bot .umcc-bubble {
  background: var(--umcc-bot-bubble);
  color: var(--umcc-bot-text);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--umcc-border);
}

.umcc-msg-user .umcc-bubble {
  background: var(--umcc-gradient);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 14px rgba(108, 62, 243, 0.25);
}

/* Links inside bubbles */
.umcc-bubble a {
  color: var(--umcc-primary);
  text-decoration: underline;
  font-weight: 500;
}

.umcc-msg-user .umcc-bubble a {
  color: rgba(255, 255, 255, 0.9);
}

/* Bold inside bubbles */
.umcc-bubble strong,
.umcc-bubble b {
  font-weight: 600;
  color: var(--umcc-primary-dark);
}

.umcc-msg-user .umcc-bubble strong,
.umcc-msg-user .umcc-bubble b {
  color: rgba(255, 255, 255, 0.95);
}

/* Typing indicator */
.umcc-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
}

.umcc-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--umcc-primary-light);
  display: inline-block;
  animation: umcc-typing-dot 1.2s ease-in-out infinite;
}

.umcc-typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.umcc-typing span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes umcc-typing-dot {

  0%,
  80%,
  100% {
    transform: scale(0.7);
    opacity: 0.35;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Error message */
.umcc-error-bubble {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #e11d48;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  text-align: center;
  margin: 4px 0;
}

/* ── Input Area ────────────────────────────────────────────────────────────── */
.umcc-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 16px;
  background: var(--umcc-surface);
  border-top: 1px solid var(--umcc-border);
  flex-shrink: 0;
}

.umcc-input {
  flex: 1;
  background: var(--umcc-surface-2);
  border: 1.5px solid var(--umcc-border);
  border-radius: 12px;
  color: var(--umcc-text);
  font-family: var(--umcc-font);
  font-size: 14px;
  line-height: 1.5;
  padding: 10px 14px;
  resize: none;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  max-height: 100px;
  overflow-y: auto;
}

.umcc-input::placeholder {
  color: var(--umcc-text-muted);
}

.umcc-input:focus {
  border-color: var(--umcc-primary-light);
  box-shadow: 0 0 0 3px rgba(108, 62, 243, 0.12);
  background: #fff;
}

.umcc-send-btn {
  height: 42px;
  border-radius: 12px;
  /* Rectangle send button */
  border: none;
  background: var(--umcc-gradient);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 14px rgba(108, 62, 243, 0.35);
}

.umcc-send-btn svg {
  width: 18px;
  height: 18px;
}

.umcc-send-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(108, 62, 243, 0.50);
}

.umcc-send-btn:active {
  transform: scale(0.96);
}

.umcc-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.umcc-upload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--umcc-surface-2);
  border: 1px solid var(--umcc-border);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.umcc-upload-btn:hover {
  background: #fff;
  border-color: var(--umcc-primary-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.umcc-upload-btn:active {
  transform: translateY(0);
}

.umcc-upload-btn svg {
  color: var(--umcc-primary);
  opacity: 0.7;
}

.umcc-upload-btn:hover svg {
  opacity: 1;
}

/* ── Divider / date chips ─────────────────────────────────────────────────── */
.umcc-chip {
  text-align: center;
  font-size: 11px;
  color: var(--umcc-text-muted);
  padding: 2px 0;
  letter-spacing: 0.04em;
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  :root {
    --umcc-w: calc(100vw - 24px);
    --umcc-h: calc(100vh - 130px);
  }

  .umcc-window {
    left: 12px;
    bottom: 90px;
  }

  .umcc-launcher {
    left: 12px;
    bottom: 20px;
  }
}

/* ── Markdown-like formatting inside bot bubbles ──────────────────────────── */
.umcc-bubble p {
  margin: 0 0 6px;
}

.umcc-bubble p:last-child {
  margin-bottom: 0;
}

.umcc-bubble ul,
.umcc-bubble ol {
  margin: 6px 0 6px 16px;
  padding: 0;
  color: var(--umcc-text);
}

.umcc-bubble li {
  margin-bottom: 3px;
}

.umcc-bubble code {
  background: #ede9fe;
  color: var(--umcc-primary-dark);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 13px;
  font-family: monospace;
}

/* ── Inline Search Banner ────────────────────────────────────────────────── */
.umcc-search-container {
  background: #fffffff00;
  padding: 20px 0;
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
  font-family: var(--umcc-font, 'Outfit', sans-serif);
}

.umcc-search-box {
  position: relative;
  max-width: 600px;
  margin: 0 auto 15px;
  display: flex;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
  border-radius: 40px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #edf2f7;
}

.umcc-search-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: #999;
  pointer-events: none;
}

#umcc-inline-search-input {
  flex: 1;
  border: none;
  padding: 18px 20px 18px 50px;
  font-size: 16px;
  outline: none;
  background: transparent;
  color: #333;
}

#umcc-inline-search-input::placeholder {
  color: #a0aec0;
}

#umcc-inline-search-btn {
  background: linear-gradient(135deg, #2b9d8f 0%, #21867a 100%);
  color: #fff;
  border: none;
  padding: 0 30px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

#umcc-inline-search-btn:hover {
  background: linear-gradient(135deg, #21867a 0%, #1a6d63 100%);
}

.umcc-search-chips {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.umcc-chips-label {
  font-size: 14px;
  color: #4a5568;
  font-weight: 500;
}

button.umcc-chip {
  background: #edf2f7;
  color: #4a5568;
  border: none;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

button.umcc-chip:hover {
  background: #cbd5e1;
  color: #1e293b;
}

/* ── Inline Search Modal ─────────────────────────────────────────────────── */
.umcc-search-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.umcc-search-modal {
  background: #fff;
  width: 90%;
  max-width: 600px;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

.umcc-search-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid #edf2f7;
  background: #f8fafc;
}

.umcc-search-modal-header h3 {
  margin: 0;
  font-size: 18px;
  color: #2d3748;
}

#umcc-search-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #a0aec0;
}

#umcc-search-close:hover {
  color: #4a5568;
}

.umcc-search-modal-content {
  padding: 20px;
  max-height: 70vh;
  overflow-y: auto;
}

.umcc-course-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  transition: box-shadow 0.2s;
}

.umcc-course-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.umcc-course-card h4 {
  margin: 0 0 8px;
  font-size: 16px;
  color: #2b6cb0;
}

.umcc-course-card p {
  margin: 0 0 12px;
  font-size: 14px;
  color: #4a5568;
  line-height: 1.5;
}

.umcc-course-card a {
  display: inline-block;
  background: #edf2f7;
  color: #2b6cb0;
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}

.umcc-course-card a:hover {
  background: #e2e8f0;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}