/* Trail Print Support Chat Widget */

#tpSupportWidget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99990;
  font-family: 'DM Sans', -apple-system, sans-serif;
}

/* ── Toggle button ── */
#tpSupportToggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #f97316;
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(249, 115, 22, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
}
#tpSupportToggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(249, 115, 22, 0.5);
}

/* ── Chat panel ── */
#tpSupportPanel {
  display: none;
  flex-direction: column;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 500px;
  max-height: calc(100vh - 100px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  position: absolute;
  bottom: 0;
  right: 0;
}

/* ── Header ── */
#tpSupportHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #1a2332;
  color: #fff;
  font-size: 15px;
  flex-shrink: 0;
}
#tpSupportClose {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 22px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
#tpSupportClose:hover { color: #fff; }

/* ── Messages area ── */
#tpSupportMessages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f9fafb;
}

.tps-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.tps-bot {
  background: #fff;
  color: #1a2332;
  align-self: flex-start;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 4px;
}
.tps-user {
  background: #f97316;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.tps-typing {
  color: #9ca3af;
  font-style: italic;
  border-color: transparent;
  background: transparent;
  padding: 4px 0;
}

/* ── Action buttons ── */
.tps-action-btn {
  align-self: flex-start;
  background: #f0f6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.tps-action-btn:hover {
  background: #dbeafe;
}

/* ── Input area ── */
#tpSupportInput {
  display: flex;
  padding: 12px;
  gap: 8px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
  flex-shrink: 0;
}
#tpSupportText {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
#tpSupportText:focus {
  border-color: #f97316;
}
#tpSupportSend {
  padding: 10px 18px;
  background: #f97316;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}
#tpSupportSend:hover {
  background: #ea580c;
}

/* ── Mobile ── */
@media (max-width: 480px) {
  #tpSupportPanel {
    width: calc(100vw - 24px);
    height: calc(100vh - 80px);
    border-radius: 12px 12px 0 0;
    bottom: -12px;
    right: -12px;
  }
  #tpSupportWidget {
    bottom: 16px;
    right: 16px;
  }
}

/* ── Don't show on designer pages (they have their own AI) ── */
body.designer-active #tpSupportWidget {
  display: none;
}
