:root {
  --course-chat-green: #18c757;
  --course-chat-green-dark: #087c3d;
  --course-chat-ink: #17221b;
  --course-chat-muted: #607067;
  --course-chat-surface: #ffffff;
  --course-chat-border: #dce6df;
  --course-chat-soft: #eef8f1;
  --course-chat-shadow: 0 18px 55px rgba(19, 49, 31, 0.24);
}

.course-chat-launcher {
  align-items: center;
  background: var(--course-chat-green-dark);
  border: 0;
  border-radius: 999px;
  bottom: 22px;
  box-shadow: 0 10px 28px rgba(8, 77, 40, 0.3);
  color: #fff;
  cursor: pointer;
  display: flex;
  font: 700 15px/1 Inter, Arial, sans-serif;
  gap: 9px;
  min-height: 52px;
  padding: 0 19px;
  position: fixed;
  right: 22px;
  transition: transform 160ms ease, box-shadow 160ms ease;
  z-index: 2147483000;
}

.course-chat-launcher:hover {
  box-shadow: 0 14px 34px rgba(8, 77, 40, 0.4);
  transform: translateY(-2px);
}

.course-chat-launcher:focus-visible,
.course-chat-panel button:focus-visible,
.course-chat-panel textarea:focus-visible {
  outline: 3px solid #ffcc4d;
  outline-offset: 3px;
}

.course-chat-launcher svg {
  height: 22px;
  width: 22px;
}

.course-chat-panel {
  background: var(--course-chat-surface);
  border: 1px solid var(--course-chat-border);
  border-radius: 20px;
  bottom: 88px;
  box-shadow: var(--course-chat-shadow);
  display: flex;
  flex-direction: column;
  font: 400 15px/1.45 Inter, Arial, sans-serif;
  height: min(640px, calc(100vh - 120px));
  overflow: hidden;
  position: fixed;
  right: 22px;
  transform: translateY(16px) scale(0.98);
  transform-origin: bottom right;
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
  visibility: hidden;
  width: min(400px, calc(100vw - 44px));
  z-index: 2147482999;
}

.course-chat-panel[data-open="true"] {
  opacity: 1;
  transform: translateY(0) scale(1);
  visibility: visible;
}

.course-chat-panel[data-open="false"] {
  opacity: 0;
}

.course-chat-header {
  align-items: center;
  background: linear-gradient(135deg, #075f31, #0b8344);
  color: #fff;
  display: flex;
  justify-content: space-between;
  padding: 18px 18px 16px;
}

.course-chat-title {
  font-size: 17px;
  font-weight: 800;
  margin: 0;
}

.course-chat-subtitle {
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  margin: 3px 0 0;
}

.course-chat-close {
  align-items: center;
  background: rgba(255, 255, 255, 0.14);
  border: 0;
  border-radius: 999px;
  color: #fff;
  cursor: pointer;
  display: flex;
  font-size: 24px;
  height: 36px;
  justify-content: center;
  line-height: 1;
  width: 36px;
}

.course-chat-messages {
  background: #f8fbf9;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding: 16px;
}

.course-chat-message {
  border-radius: 15px;
  max-width: 88%;
  padding: 11px 13px;
  white-space: pre-wrap;
}

.course-chat-message--assistant {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--course-chat-border);
  color: var(--course-chat-ink);
}

.course-chat-message--user {
  align-self: flex-end;
  background: var(--course-chat-green-dark);
  color: #fff;
}

.course-chat-message--status {
  color: var(--course-chat-muted);
  font-size: 13px;
  font-style: italic;
}

.course-chat-sources {
  border-top: 1px solid var(--course-chat-border);
  color: var(--course-chat-muted);
  font-size: 11px;
  margin-top: 9px;
  padding-top: 7px;
}

.course-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 0 16px 12px;
}

.course-chat-suggestion {
  background: var(--course-chat-soft);
  border: 1px solid #bfe1c9;
  border-radius: 999px;
  color: #075f31;
  cursor: pointer;
  font: 600 12px/1.25 Inter, Arial, sans-serif;
  padding: 7px 10px;
  text-align: left;
}

.course-chat-form {
  align-items: flex-end;
  background: #fff;
  border-top: 1px solid var(--course-chat-border);
  display: flex;
  gap: 9px;
  padding: 12px;
}

.course-chat-input {
  border: 1px solid #bdccc1;
  border-radius: 13px;
  color: var(--course-chat-ink);
  flex: 1;
  font: 400 14px/1.4 Inter, Arial, sans-serif;
  max-height: 104px;
  min-height: 44px;
  padding: 10px 12px;
  resize: vertical;
}

.course-chat-send {
  align-items: center;
  background: var(--course-chat-green-dark);
  border: 0;
  border-radius: 12px;
  color: #fff;
  cursor: pointer;
  display: flex;
  height: 44px;
  justify-content: center;
  width: 44px;
}

.course-chat-send:disabled,
.course-chat-input:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.course-chat-privacy {
  background: #fff;
  color: var(--course-chat-muted);
  font-size: 10px;
  margin: 0;
  padding: 0 14px 10px;
  text-align: center;
}

@media (max-width: 560px) {
  .course-chat-launcher {
    bottom: 14px;
    right: 14px;
  }

  .course-chat-launcher span {
    display: none;
  }

  .course-chat-panel {
    border-radius: 16px 16px 0 0;
    bottom: 0;
    height: min(720px, calc(100vh - 28px));
    left: 0;
    right: 0;
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .course-chat-launcher,
  .course-chat-panel {
    transition: none;
  }
}

