/* LIRENO Chatbot — Web surface (floating widget) */

.lireno-chatbot {
  --lcb-accent: #059669;
  --lcb-accent-dark: #047857;
  --lcb-bg: #ffffff;
  --lcb-surface: #f5f4ee;
  --lcb-border: #dedad4;
  --lcb-text: #1a1a1a;
  --lcb-muted: #6b6a63;
  --lcb-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  --lcb-radius: 14px;
  --lcb-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 99990;
  font-family: var(--lcb-font);
  color: var(--lcb-text);
  line-height: 1.45;
}

.lireno-chatbot[hidden] {
  display: none !important;
}

.lireno-chatbot__fab {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  background: var(--lcb-accent);
  color: #fff;
  cursor: pointer;
  box-shadow: var(--lcb-shadow);
  transition: transform 0.15s ease, background 0.15s ease;
}

.lireno-chatbot__fab:hover {
  background: var(--lcb-accent-dark);
  transform: scale(1.04);
}

.lireno-chatbot__fab-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.lireno-chatbot__panel {
  position: absolute;
  right: 0;
  bottom: 68px;
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100vw - 32px));
  max-height: min(520px, calc(100vh - 120px));
  background: var(--lcb-bg);
  border: 1px solid var(--lcb-border);
  border-radius: var(--lcb-radius);
  box-shadow: var(--lcb-shadow);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.98);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  pointer-events: none;
}

.lireno-chatbot.is-open .lireno-chatbot__panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.lireno-chatbot.is-open .lireno-chatbot__fab {
  opacity: 0.85;
}

.lireno-chatbot__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 16px;
  background: var(--lcb-surface);
  border-bottom: 1px solid var(--lcb-border);
}

.lireno-chatbot__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.lireno-chatbot__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--lcb-muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.lireno-chatbot__close:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--lcb-text);
}

.lireno-chatbot__messages {
  flex: 1 1 auto;
  min-height: 200px;
  max-height: 340px;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--lcb-bg);
}

.lireno-chatbot__msg {
  display: flex;
}

.lireno-chatbot__msg--user {
  justify-content: flex-end;
}

.lireno-chatbot__msg--assistant {
  justify-content: flex-start;
}

.lireno-chatbot__bubble {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.92rem;
  word-break: break-word;
}

.lireno-chatbot__msg--user .lireno-chatbot__bubble {
  background: var(--lcb-accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.lireno-chatbot__msg--assistant .lireno-chatbot__bubble {
  background: var(--lcb-surface);
  border: 1px solid var(--lcb-border);
  border-bottom-left-radius: 4px;
}

.lireno-chatbot__form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
  padding: 12px;
  border-top: 1px solid var(--lcb-border);
  background: var(--lcb-surface);
}

.lireno-chatbot__input {
  width: 100%;
  min-height: 42px;
  max-height: 120px;
  padding: 10px 12px;
  border: 1px solid var(--lcb-border);
  border-radius: 10px;
  resize: vertical;
  font: inherit;
  color: var(--lcb-text);
  background: #fff;
}

.lireno-chatbot__input:focus {
  outline: 2px solid rgba(5, 150, 105, 0.35);
  border-color: var(--lcb-accent);
}

.lireno-chatbot__send {
  min-height: 42px;
  padding: 0 14px;
  border: none;
  border-radius: 10px;
  background: var(--lcb-accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.lireno-chatbot__send:hover:not(:disabled) {
  background: var(--lcb-accent-dark);
}

.lireno-chatbot__send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (max-width: 480px) {
  .lireno-chatbot__panel {
    width: calc(100vw - 24px);
    right: -4px;
    bottom: 64px;
    max-height: calc(100vh - 100px);
  }

  .lireno-chatbot__form {
    grid-template-columns: 1fr;
  }

  .lireno-chatbot__send {
    width: 100%;
  }
}
