/* Embeddable chat + page feedback widgets — include after injecting widget HTML */
.chat-widget-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10050;
  display: flex;
  flex-direction: row-reverse;
  align-items: flex-end;
  gap: 0;
  pointer-events: none;
}
.chat-widget-root > * { pointer-events: auto; }
.chat-widget-panel {
  overflow: hidden;
  width: 0;
  max-width: min(400px, calc(100vw - 96px));
  height: min(520px, calc(100vh - 100px));
  min-height: 320px;
  transition: width 0.32s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.24s ease;
  opacity: 0;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  flex-shrink: 0;
}
.chat-widget-root[data-open="true"] .chat-widget-panel {
  width: min(400px, calc(100vw - 96px));
  opacity: 1;
}
.chat-widget-root[data-open="false"] .chat-widget-panel { pointer-events: none; }
.chat-widget-panel-inner {
  width: min(400px, calc(100vw - 96px));
  height: 100%;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #e5e5e5;
}
.chat-widget-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 0;
  background: #ff6b35;
  color: #fff;
  font-size: 26px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(255, 107, 53, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.chat-widget-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid #e5e5e5;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.chat-widget-header-text h2 { margin: 0; font-size: 1.1rem; }
.chat-widget-header-text p { margin: 6px 0 0; font-size: 13px; color: #555; }
.chat-widget-header-actions { display: flex; gap: 8px; }
.chat-widget-close, .chat-widget-trash {
  border: 0;
  background: #f0f0f0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
}
.chat-widget-root .ixchat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fafafa;
}
.chat-widget-root .ixchat-message {
  max-width: 88%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chat-widget-root .ixchat-message-text { white-space: pre-wrap; }
.chat-widget-root .ixchat-choice-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.chat-widget-root .ixchat-choice-btn {
  border: 1px solid #635bff;
  background: #fff;
  color: #635bff;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  line-height: 1.3;
  cursor: pointer;
  font-family: inherit;
}
.chat-widget-root .ixchat-choice-btn:hover:not(:disabled) {
  background: #eef0ff;
}
.chat-widget-root .ixchat-choice-btn:disabled {
  opacity: 0.55;
  cursor: default;
}
.chat-widget-root .ixchat-timestamp { font-size: 10px; align-self: flex-end; opacity: 0.8; }
.chat-widget-root .ixchat-user-message { align-self: flex-end; background: #635bff; color: #fff; }
.chat-widget-root .ixchat-bot-message { align-self: flex-start; background: #eef0ff; color: #222; }
.chat-widget-root .ixchat-human-message {
  align-self: flex-start;
  background: #e8f5e9;
  color: #1b5e20;
  border-left: 3px solid #2e7d32;
}
.chat-widget-root .ixchat-human-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: #2e7d32;
}
.chat-widget-composer {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid #e5e5e5;
  align-items: flex-end;
}
.chat-widget-composer textarea {
  flex: 1;
  min-height: 40px;
  font-family: inherit;
  font-size: 14px;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 8px;
}
.chat-widget-composer .ixchat-send {
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  background: #635bff;
  color: #fff;
  cursor: pointer;
}
.chat-widget-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- Page feedback tab (feedback_page scenario) --- */
.feedback-widget-root {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10040;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  pointer-events: none;
}
.feedback-widget-root > * {
  pointer-events: auto;
}

.feedback-widget-tab {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background: #fff;
  border: 1px solid #d8dee8;
  border-right: 0;
  border-radius: 8px 0 0 8px;
  box-shadow: -2px 2px 12px rgba(0, 40, 100, 0.12);
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  min-width: 44px;
}
.feedback-widget-tab:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}
.feedback-widget-tab-chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 8px 6px;
  color: #1e4d8c;
  border-bottom: 1px solid #e8ecf2;
}
.feedback-widget-tab-chevron svg {
  transition: transform 0.2s ease;
}
.feedback-widget-root[data-open="true"] .feedback-widget-tab-chevron svg {
  transform: rotate(180deg);
}
.feedback-widget-tab-label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  padding: 12px 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #1e4d8c;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.feedback-widget-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 10041;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s;
}
.feedback-widget-root[data-open="true"] .feedback-widget-overlay {
  opacity: 1;
  visibility: visible;
}

.feedback-widget-modal {
  position: fixed;
  right: 24px;
  top: 50%;
  transform: translate(12px, -50%);
  width: min(420px, calc(100vw - 80px));
  max-height: min(90vh, 640px);
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 16px 48px rgba(0, 40, 100, 0.2);
  z-index: 10042;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
}
.feedback-widget-root[data-open="true"] .feedback-widget-modal {
  opacity: 1;
  visibility: visible;
  transform: translate(0, -50%);
}

.feedback-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: #0f2744;
  color: #fff;
}
.feedback-widget-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}
.feedback-widget-close {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
}
.feedback-widget-close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.feedback-widget-body {
  padding: 20px 22px 24px;
  overflow-y: auto;
  flex: 1;
}
.feedback-widget-body h3 {
  margin: 0 0 12px;
  font-size: 1.05rem;
  color: #0f2744;
  line-height: 1.35;
}
.feedback-widget-hint {
  margin: 0 0 18px;
  font-size: 13px;
  color: #475569;
  line-height: 1.45;
}

.feedback-widget-scope-btn {
  display: flex;
  align-items: center;
  width: 100%;
  text-align: left;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  border: 1px solid #c5d4e8;
  border-left: 4px solid #3b82f6;
  background: #fff;
  color: #1e4d8c;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.15s, border-color 0.15s;
}
.feedback-widget-scope-btn:hover {
  background: #f0f6ff;
  border-color: #93b4e0;
}
.feedback-widget-scope-btn .feedback-widget-arrow {
  margin-left: auto;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.feedback-widget-stars {
  display: flex;
  gap: 6px;
  margin: 8px 0 16px;
}
.feedback-widget-star {
  border: 0;
  background: transparent;
  padding: 4px;
  cursor: pointer;
  font-size: 32px;
  line-height: 1;
  color: #cbd5e1;
  transition: color 0.12s, transform 0.12s;
}
.feedback-widget-star:hover,
.feedback-widget-star:focus-visible {
  transform: scale(1.08);
}
.feedback-widget-star[aria-pressed="true"],
.feedback-widget-star.feedback-widget-star--on {
  color: #f59e0b;
}

.feedback-widget-comment label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}
.feedback-widget-comment textarea {
  width: 100%;
  min-height: 88px;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  resize: vertical;
  box-sizing: border-box;
}
.feedback-widget-comment textarea:focus {
  outline: 2px solid #2563eb;
  outline-offset: 0;
  border-color: #2563eb;
}

.feedback-widget-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.feedback-widget-btn-primary {
  flex: 1;
  min-width: 120px;
  padding: 12px 18px;
  border: 0;
  border-radius: 6px;
  background: #2563eb;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.feedback-widget-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.feedback-widget-btn-secondary {
  padding: 12px 16px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #475569;
  font-size: 14px;
  cursor: pointer;
}

.feedback-widget-step[hidden] {
  display: none !important;
}

.feedback-widget-thanks {
  text-align: center;
  padding: 12px 0 8px;
}
.feedback-widget-thanks-icon {
  font-size: 40px;
  margin-bottom: 12px;
}
.feedback-widget-thanks p {
  margin: 0;
  color: #334155;
  line-height: 1.5;
}

.feedback-widget-error {
  margin-top: 12px;
  padding: 10px 12px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 13px;
  border-radius: 6px;
}

@media (max-width: 480px) {
  .feedback-widget-modal {
    right: 12px;
    left: 12px;
    width: auto;
  }
}
