/* Default container (used by floating popup mode) */
.lms-chat-container {
  position: static;
  bottom: auto;
  right: auto;
  max-width: 100%;
  margin: 0 auto 24px;
  font-family: system-ui, sans-serif;
}

.lms-chat-button {
  border-radius: 999px;
  padding: 10px 16px;
  border: none;
  background: #2563eb;
  color: white;
  cursor: pointer;
}

/* Floating-mode panel (popup over the page) */
.lms-chat-panel {
  position: fixed;
  bottom: 64px;
  right: 16px;
  width: 100%;
  max-height: calc(100vh - 220px);
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  display: flex;
  padding: 8px;
  flex-direction: column;
  overflow: hidden;
}

/* INLINE mode (used on /chat) ------------------------------------ */
.lms-chat-container.lms-mode-inline {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  margin: 0;
}
.lms-chat-container.lms-mode-inline .lms-chat-button { display: none; }
.lms-chat-container.lms-mode-inline .lms-chat-panel {
  position: static;
  bottom: auto;
  right: auto;
  width: 100%;
  flex: 1;
  min-height: 480px;          /* keep input pinned to bottom on empty state */
  max-height: none;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
}

/* DOCK mode (footer slide-out panel on logged-in pages) ---------- */
.lms-chat-container.lms-mode-dock {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
  margin: 0;
}
.lms-chat-container.lms-mode-dock .lms-chat-button { display: none; }
.lms-chat-container.lms-mode-dock .lms-chat-panel {
  position: static;
  bottom: auto;
  right: auto;
  width: 100%;
  flex: 1;
  min-height: 0;
  max-height: none;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
}

/* Shared inner layout — messages grow, input stays at bottom */
.lms-chat-header {
  padding: 8px 12px;
  border-bottom: 1px solid #e5e7eb;
  font-weight: 600;
  flex-shrink: 0;
}
.lms-chat-messages {
  flex: 1;
  min-height: 0;              /* allow scroll inside flex parent */
  padding: 12px;
  overflow-y: auto;
  font-size: 14px;
}
.lms-chat-input {
  border-top: 1px solid #e5e7eb;
  padding: 8px;
  display: flex;
  gap: 8px;
  flex-shrink: 0;             /* never collapse — always anchored at bottom */
  background: #ffffff;
}
.lms-chat-input textarea {
  flex: 1;
  max-height: 120px;
  resize: none;
  font-size: 14px;
  border: none;
  outline: none;
}
.lms-chat-input textarea:focus { border: none; }
.lms-chat-input button {
  border: none;
  background: #2563eb;
  color: white;
  padding: 0 12px;
  border-radius: 6px;
  cursor: pointer;
}

/* Empty-state placed inside .lms-chat-messages until the first message */
.lms-empty-state {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 20px;
  background:
    radial-gradient(circle at 50% 0%, rgba(37, 99, 235, 0.06) 0%, transparent 60%),
    linear-gradient(180deg, #f9fafb 0%, #ffffff 60%);
  color: #4b5563;
  border-radius: 8px;
}
.lms-empty-icon {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  background: linear-gradient(135deg, #eef2ff, #ffffff);
  border: 1px solid rgba(37, 99, 235, 0.18);
  color: #2563eb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.12);
}
.lms-empty-icon svg { width: 24px; height: 24px; }
.lms-empty-title {
  font-size: 17px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.lms-empty-lead {
  font-size: 13px;
  line-height: 1.55;
  color: #4b5563;
  margin: 0 0 16px;
  max-width: 360px;
}
.lms-empty-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  max-width: 460px;
}
.lms-empty-chip {
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  color: #1d4ed8;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.lms-empty-chip:hover {
  background: #eef2ff;
  border-color: #2563eb;
  color: #1d4ed8;
}
.lms-empty-hint {
  font-size: 11px;
  color: #9ca3af;
  margin: 14px 0 0;
}

/* Smaller empty-state in the dock variant (cramped) */
.lms-mode-dock .lms-empty-state { padding: 16px 12px; }
.lms-mode-dock .lms-empty-icon { width: 40px; height: 40px; margin-bottom: 10px; }
.lms-mode-dock .lms-empty-icon svg { width: 20px; height: 20px; }
.lms-mode-dock .lms-empty-title { font-size: 15px; }
.lms-mode-dock .lms-empty-lead { font-size: 12px; margin-bottom: 12px; }
.lms-mode-dock .lms-empty-chip { font-size: 11px; padding: 5px 10px; }

.lms-msg-user { text-align: right; margin: 4px 0; }
.lms-msg-bot { text-align: left; margin: 4px 0; }
.lms-msg-bot .title { font-weight: 600; }
.lms-steps { padding-left: 16px; }
.lms-snippets { margin-top: 8px; font-size: 12px; color: #4b5563; }

/* Disambiguation options (clarify mode) */
.lms-clarify-options { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.lms-clarify-option {
  border: 1px solid #c7d2fe;
  background: #eef2ff;
  color: #1e3a8a;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.lms-clarify-option:hover { background: #e0e7ff; }
.lms-clarify-option:disabled { opacity: 0.55; cursor: default; }

/* Search-mode reference list (e.g. call recordings) */
.lms-ref-list { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.lms-ref-card {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}
.lms-ref-title a { font-weight: 600; color: #1d4ed8; text-decoration: none; }
.lms-ref-title a:hover { text-decoration: underline; }
.lms-faq-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #5b21b6;
  background: #ede9fe;
  border-radius: 999px;
  vertical-align: middle;
}
.lms-ref-meta { font-size: 12px; color: #6b7280; margin-top: 2px; }
.lms-ref-snippet {
  font-size: 12.5px;
  color: #374151;
  margin-top: 6px;
  line-height: 1.45;
  border-left: 2px solid #e5e7eb;
  padding-left: 8px;
}
.lms-ref-keywords { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.lms-ref-chip {
  font-size: 11px;
  color: #4b5563;
  background: #f3f4f6;
  border-radius: 999px;
  padding: 2px 8px;
}
.lms-ref-watch {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  color: #1d4ed8;
  text-decoration: none;
}
.lms-ref-watch:hover { text-decoration: underline; }

.lms-feedback {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #e5e7eb;
  font-size: 12px;
  color: #4b5563;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lms-feedback-prompt { font-weight: 600; }

.lms-feedback-buttons { display: flex; gap: 8px; }

.lms-feedback-btn {
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 8px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 14px;
}

.lms-feedback-btn.selected {
  background: #e0e7ff;
  border-color: #a5b4fc;
  cursor: default;
}

.lms-feedback-btn:disabled { cursor: default; opacity: 0.6; }

.lms-feedback-form { display: flex; flex-direction: column; gap: 6px; }
.lms-feedback-form[hidden] { display: none; }

.lms-feedback-input {
  width: 100%;
  resize: vertical;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 6px;
  font-size: 12px;
}

.lms-feedback-submit {
  align-self: flex-start;
  border: none;
  background: #2563eb;
  color: #fff;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}

.lms-feedback-status { font-size: 11px; color: #6b7280; }
