.lesson-aside#edu-ai-tutor {
  position: fixed;
  bottom: 24px;
  width: 380px;
  max-width: calc(100vw - 48px);
  z-index: 9999;
  transition: width .25s ease;
}

html[dir="ltr"] .lesson-aside#edu-ai-tutor {
  right: 24px;
  left: auto;
}

html[dir="rtl"] .lesson-aside#edu-ai-tutor {
  left: 24px;
  right: auto;
}

.lesson-aside#edu-ai-tutor.is-expanded {
  width: min(760px, calc(100vw - 48px));
}

.edu-ai-fab {
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  padding: 13px 20px;
  background: #2563eb;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(37, 99, 235, .25);
  display: block;
}

.ai-sidebar {
  display: none;
  flex-direction: column;
  background: #fff;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .08);
}

.ai-sidebar-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid #eee;
}

.ai-avatar {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.meta {
  flex: 1;
  min-width: 0;
}

.meta h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
}

.meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  font-size: 13px;
  color: #10b981;
}

.meta span::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
}

.btn-icon {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: #f3f4f6;
  color: #64748b;
  cursor: pointer;
  font-size: 18px;
}

.btn-icon:hover {
  background: #e5e7eb;
  color: #0f172a;
}

.ai-sidebar-body {
  height: 50vh;
  overflow-y: auto;
  padding: 18px;
}

.chat-bubble {
  padding: 14px 16px;
  border-radius: 18px;
  margin-bottom: 14px;
  line-height: 1.7;
  font-size: 14px;
}

.chat-bubble.ai {
  background: #f1f5f9;
  color: #0f172a;
  margin-inline-end: auto;
  max-width: 88%;
}

.chat-bubble.user {
  background: #2563eb;
  color: #fff;
  margin-inline-start: auto;
  width: fit-content;
  max-width: 85%;
}

.chat-bubble.error {
  background: #fee2e2;
  color: #991b1b;
}

/* .ai-quick {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 18px;
  border-top: 1px solid #eee;
  background: #fff;
} */

.ai-quick {
  padding: 0 18px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.ai-chip {
  white-space: nowrap;
  border: 1px solid #dbeafe;
  background: #fff;
  color: #2563eb;
  border-radius: 999px;
  padding: 9px 14px;
  cursor: pointer;
  font-size: 13px;
}

.ai-chip:hover {
  background: #eff6ff;
}

.ai-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px 18px;
  border-top: 1px solid #eee;
  background: #fff;
}

#edu-ai-question {
  flex: 1;
  min-width: 0;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  padding: 12px 16px;
  outline: none;
}

#edu-ai-question:focus {
  border-color: #2563eb;
}

.ai-send {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 50%;
  border: 0;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-sm {
  width: 18px;
  height: 18px;
}

.lesson-aside#edu-ai-tutor.is-expanded .ai-sidebar-body {
  max-height: 520px;
}

@media (max-width: 768px) {

  .lesson-aside#edu-ai-tutor,
  .lesson-aside#edu-ai-tutor.is-expanded {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    left: 12px !important;
    right: 12px !important;
    bottom: 12px;
  }
}