/* ── Chatbot Wrapper ── */
#asc-chatbot-wrapper {
  position: fixed;
  bottom: 40px;
  right: 40px;
  z-index: 999999;
  font-family:
    "Inter",
    "Outfit",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* ── Bubble Button ── */
#asc-chatbot-bubble {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #564ac7, #4d4694);
  border-radius: 50%;
  box-shadow: 0 8px 32px rgba(86, 74, 199, 0.4);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition:
    transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
    box-shadow 0.3s;
  animation: asc-pulse-bubble 2.5s ease-in-out infinite;
}

#asc-chatbot-bubble:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 40px rgba(86, 74, 199, 0.6);
  animation: none;
}

#asc-chatbot-bubble svg {
  pointer-events: none;
}

@keyframes asc-pulse-bubble {
  0%,
  100% {
    box-shadow: 0 8px 32px rgba(86, 74, 199, 0.4);
  }
  50% {
    box-shadow: 0 8px 40px rgba(86, 74, 199, 0.7);
  }
}

/* ── Chat Window ── */
#asc-chatbot-window {
  position: absolute;
  bottom: 90px;
  right: 0;
  width: 380px;
  height: 480px;
  max-width: 90vw;
  max-height: calc(100vh - 140px);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 24px;
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.1),
    0 1px 3px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  transition:
    transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1),
    opacity 0.4s ease,
    visibility 0.4s ease;
}

.asc-hidden {
  transform: scale(0.5);
  opacity: 0;
  visibility: hidden;
}

.asc-visible {
  transform: scale(1);
  opacity: 1;
  visibility: visible;
}

/* ── Header ── */
#asc-chatbot-header {
  background: linear-gradient(135deg, #564ac7, #4d4694);
  color: #fff;
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.asc-header-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.asc-header-title {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.3px;
}

.asc-header-status {
  font-size: 12px;
  opacity: 0.9;
  color: #a7f3d0;
  display: flex;
  align-items: center;
  gap: 4px;
}

#asc-chatbot-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition:
    background 0.3s,
    transform 0.2s;
}

#asc-chatbot-close:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: rotate(90deg);
}

/* ── Body ── */
#asc-chatbot-body {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  overflow: hidden;
}

/* ── Messages ── */
#asc-chatbot-messages {
  flex-grow: 1;
  padding: 20px;
  overflow-y: auto;
  background: transparent;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

.asc-message {
  max-width: 85%;
  padding: 14px 18px;
  border-radius: 20px;
  font-size: 14px;
  line-height: 1.6;
  word-wrap: break-word;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.asc-message a {
  color: inherit;
  text-decoration: underline;
  font-weight: 600;
}

.asc-message a:hover {
  opacity: 0.8;
}

.asc-bot {
  background: #ffffff;
  color: #1f2937;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.03);
}

.asc-user {
  background: linear-gradient(135deg, #564ac7, #4d4694);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

/* ── Message slide-in animation ── */
.asc-msg-animate {
  animation: asc-msg-slide 0.3s ease-out;
}

@keyframes asc-msg-slide {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Typing indicator (bouncing dots) ── */
.asc-typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 20px;
  min-width: 60px;
}

.asc-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #9ca3af;
  border-radius: 50%;
  animation: asc-bounce 1.4s infinite ease-in-out both;
}

.asc-dot:nth-child(1) {
  animation-delay: -0.32s;
}
.asc-dot:nth-child(2) {
  animation-delay: -0.16s;
}
.asc-dot:nth-child(3) {
  animation-delay: 0s;
}

@keyframes asc-bounce {
  0%,
  80%,
  100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ── Options Menu (MCQ) ── */
.asc-options-inline {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
  margin-bottom: 16px;
  width: 92%;
  align-self: flex-start;
}

.asc-options-inline:empty {
  margin: 0;
}

.asc-suggestion {
  background: #ffffff;
  color: #564ac7;
  border: 1px solid #e0e7ff;
  border-radius: 50px;
  padding: 12px 18px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 10px rgba(86, 74, 199, 0.05);
  width: 100%;
}

.asc-suggestion:hover {
  background: linear-gradient(135deg, #564ac7, #4d4694);
  color: #fff;
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(86, 74, 199, 0.2);
}

.asc-suggestion[data-query^="⬅️"] {
  background: #f9fafb;
  color: #6b7280;
  border-color: #f3f4f6;
  margin-top: 6px;
  text-align: center;
}

.asc-suggestion[data-query^="⬅️"]:hover {
  background: #f3f4f6;
  color: #374151;
  border-color: #e5e7eb;
  transform: translateY(0);
  box-shadow: none;
}

/* ── Mobile specific adjustments ── */
@media (max-width: 768px) {
  #asc-chatbot-wrapper {
    bottom: 15px;
    right: 15px;
  }

  #asc-chatbot-window {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    z-index: 1000000;
    background: rgba(255, 255, 255, 0.95);
    border: none;
  }

  #asc-chatbot-body {
    flex-grow: 1;
  }

  .asc-options-container {
    padding-bottom: 24px;
  }
}
