/* chatbot.css — widget-only styles; uses CSS variables from styles.css */

/* ---- Bubble ---- */
.lte-chatbot-bubble {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 55;
  box-shadow: 0 4px 20px rgba(10, 104, 71, 0.35);
  transition: opacity 280ms var(--ease-out);
}

@media (min-width: 768px) {
  .lte-chatbot-bubble {
    right: 24px;
    bottom: 24px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .lte-chatbot-bubble:hover {
    transform: scale(1.06);
  }
}

.lte-chatbot-bubble.is-hidden {
  opacity: 0;
  pointer-events: none;
}

/* ---- Panel ---- */
.lte-chatbot-panel {
  position: fixed;
  right: 20px;
  bottom: 90px;
  width: 400px;
  height: 600px;
  background: var(--paper);
  border-radius: 20px;
  box-shadow: 0 40px 80px -20px rgba(21, 34, 28, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 65;
}

.lte-chatbot-panel[hidden] {
  display: none;
}

@media (min-width: 768px) {
  .lte-chatbot-panel {
    right: 24px;
    bottom: 96px;
  }
}

@media (max-width: 639px) {
  .lte-chatbot-panel,
  .lte-chatbot-panel.is-mobile {
    inset: 0;
    width: auto;
    height: auto;
    border-radius: 0;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .lte-chatbot-panel.is-opening {
    animation: lte-chatbot-open 280ms var(--ease-out) forwards;
  }
}

@keyframes lte-chatbot-open {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

/* ---- Header ---- */
.lte-chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.lte-chatbot-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
}

.lte-chatbot-subtitle {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.lte-chatbot-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  color: var(--ink-2);
  transition: background 200ms var(--ease);
  flex-shrink: 0;
}

.lte-chatbot-close:hover {
  background: var(--line);
}

/* ---- Messages ---- */
.lte-chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

/* ---- Message bubbles ---- */
.lte-chatbot-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

.lte-chatbot-msg--user {
  align-self: flex-end;
  background: var(--green);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.lte-chatbot-msg--bot {
  align-self: flex-start;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
  border-bottom-left-radius: 4px;
}

.lte-chatbot-msg--refused {
  background: var(--bg-2);
  border-color: var(--line-soft);
  font-style: italic;
}

/* Bot message + sources wrapper */
.lte-chatbot-msg-wrap {
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 85%;
}

.lte-chatbot-refusal-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: rgba(212, 96, 58, 0.1);
  border-radius: 999px;
  padding: 2px 8px;
  margin-bottom: 4px;
}

/* ---- Sources ---- */
.lte-chatbot-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.lte-chatbot-source {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  background: var(--bg-2);
  border-radius: 999px;
  padding: 2px 8px;
}

/* ---- Suggestions ---- */
.lte-chatbot-suggestions {
  padding: 0 16px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.lte-chatbot-suggestions[hidden] {
  display: none;
}

.lte-chatbot-suggestion {
  font-size: 13px;
  color: var(--green);
  border: 1px solid rgba(10, 104, 71, 0.2);
  border-radius: 999px;
  padding: 5px 12px;
  background: var(--green-soft);
  transition: background 200ms var(--ease);
}

.lte-chatbot-suggestion:hover {
  background: rgba(10, 104, 71, 0.14);
}

/* ---- Input bar ---- */
.lte-chatbot-input-bar {
  padding: 12px 16px 8px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 8px;
  row-gap: 4px;
  align-items: end;
  flex-shrink: 0;
}

.lte-chatbot-textarea {
  grid-column: 1;
  grid-row: 1;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 12px;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  outline: none;
  overflow-y: auto;
  transition: border-color 200ms var(--ease);
}

.lte-chatbot-textarea:focus {
  border-color: var(--green);
}

.lte-chatbot-textarea::placeholder {
  color: var(--muted);
}

.lte-chatbot-send {
  grid-column: 2;
  grid-row: 1;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 200ms var(--ease);
}

.lte-chatbot-send:hover {
  background: var(--green-deep);
}

.lte-chatbot-send:disabled {
  background: var(--sage);
  cursor: not-allowed;
}

.lte-chatbot-counter {
  grid-column: 1;
  grid-row: 2;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  padding-right: 4px;
}

.lte-chatbot-counter--warn {
  color: var(--accent);
}

/* ---- Footer ---- */
.lte-chatbot-footer {
  padding: 6px 16px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}

.lte-chatbot-quota {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.lte-chatbot-quota--low {
  color: var(--accent);
}

.lte-chatbot-howlink {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  text-decoration: underline;
  white-space: nowrap;
}

.lte-chatbot-howlink:hover {
  color: var(--ink);
}

/* ---- Typing indicator ---- */
.lte-chatbot-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}

.lte-chatbot-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  display: inline-block;
}

@media (prefers-reduced-motion: no-preference) {
  .lte-chatbot-typing span {
    animation: lte-chatbot-pulse 1.4s infinite;
  }
  .lte-chatbot-typing span:nth-child(2) { animation-delay: 0.16s; }
  .lte-chatbot-typing span:nth-child(3) { animation-delay: 0.32s; }
}

@keyframes lte-chatbot-pulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40%            { opacity: 1;   transform: scale(1); }
}

/* ---- Still thinking state (shows after 6s) ---- */
.lte-chatbot-thinking {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  font-size: 13px;
  color: var(--muted);
  width: fit-content;
}

.lte-chatbot-cancel {
  font-size: 12px;
  color: var(--accent);
  text-decoration: underline;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
}
