/* EdificeX AI chatbot widget — floating bottom-right launcher + chat panel.
   Themed to match the dark navy + teal/blue gradient of the dashboard. */

.edx-chat-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px 12px 14px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  color: #fff;
  font: 600 14px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(135deg, #2b8cff 0%, #38d9a9 100%);
  box-shadow: 0 8px 24px rgba(43, 140, 255, 0.35),
    0 2px 8px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.edx-chat-launcher:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(43, 140, 255, 0.45),
    0 3px 10px rgba(0, 0, 0, 0.3);
}
.edx-chat-launcher__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
}
.edx-chat-launcher.is-hidden {
  display: none;
}

.edx-chat-panel {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10000;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 16px;
  background: linear-gradient(180deg, #0f1a33 0%, #0a1226 100%);
  border: 1px solid rgba(77, 171, 247, 0.25);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55),
    0 4px 14px rgba(0, 0, 0, 0.35);
  color: #e6ecf6;
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.edx-chat-panel.is-hidden {
  display: none;
}

.edx-chat-panel__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(43, 140, 255, 0.18), rgba(56, 217, 169, 0.12));
  border-bottom: 1px solid rgba(77, 171, 247, 0.2);
}
.edx-chat-panel__title {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.2px;
}
.edx-chat-panel__sub {
  font-size: 11px;
  opacity: 0.7;
}
.edx-chat-panel__close {
  margin-left: auto;
  background: transparent;
  color: #e6ecf6;
  border: 0;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 18px;
  line-height: 1;
}
.edx-chat-panel__close:hover {
  background: rgba(255, 255, 255, 0.08);
}

.edx-chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.edx-chat-log::-webkit-scrollbar {
  width: 8px;
}
.edx-chat-log::-webkit-scrollbar-thumb {
  background: rgba(77, 171, 247, 0.25);
  border-radius: 8px;
}

.edx-chat-msg {
  max-width: 85%;
  padding: 10px 12px;
  border-radius: 12px;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 13.5px;
}
.edx-chat-msg--bot {
  align-self: flex-start;
  background: rgba(77, 171, 247, 0.12);
  border: 1px solid rgba(77, 171, 247, 0.25);
  border-bottom-left-radius: 4px;
}
.edx-chat-msg--user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(43, 140, 255, 0.45), rgba(56, 217, 169, 0.35));
  border: 1px solid rgba(56, 217, 169, 0.35);
  border-bottom-right-radius: 4px;
  color: #fff;
}
.edx-chat-msg--system {
  align-self: center;
  background: rgba(255, 169, 77, 0.12);
  border: 1px solid rgba(255, 169, 77, 0.35);
  color: #ffd8a8;
  font-size: 12px;
  font-style: italic;
}
.edx-chat-msg__updates {
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(56, 217, 169, 0.18);
  border: 1px solid rgba(56, 217, 169, 0.4);
  color: #c3fae8;
  font-size: 12px;
}
.edx-chat-msg__updates strong {
  color: #fff;
}
.edx-chat-msg__updates ul {
  margin: 4px 0 0;
  padding-left: 16px;
}

.edx-chat-typing {
  align-self: flex-start;
  display: inline-flex;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(77, 171, 247, 0.1);
  border: 1px solid rgba(77, 171, 247, 0.25);
}
.edx-chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4dabf7;
  animation: edxBounce 1.2s infinite ease-in-out;
}
.edx-chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.edx-chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes edxBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40% { transform: translateY(-4px); opacity: 1; }
}

.edx-chat-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid rgba(77, 171, 247, 0.2);
  background: rgba(0, 0, 0, 0.2);
}
.edx-chat-form textarea {
  flex: 1;
  resize: none;
  min-height: 38px;
  max-height: 120px;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid rgba(77, 171, 247, 0.3);
  background: rgba(15, 26, 51, 0.85);
  color: #e6ecf6;
  font: inherit;
  outline: none;
}
.edx-chat-form textarea:focus {
  border-color: #4dabf7;
  box-shadow: 0 0 0 2px rgba(77, 171, 247, 0.2);
}
.edx-chat-form button {
  align-self: flex-end;
  padding: 9px 14px;
  border-radius: 10px;
  border: 0;
  cursor: pointer;
  background: linear-gradient(135deg, #2b8cff, #38d9a9);
  color: #0a1226;
  font-weight: 700;
  font-size: 13px;
}
.edx-chat-form button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.edx-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 10px;
}
.edx-chat-suggestions button {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(77, 171, 247, 0.1);
  border: 1px solid rgba(77, 171, 247, 0.3);
  color: #c5d4ec;
  font-size: 12px;
  cursor: pointer;
}
.edx-chat-suggestions button:hover {
  background: rgba(77, 171, 247, 0.2);
}
