/* JSoft Chat — chatbot UI shared between widget and standalone */

.jchat {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background: #fff;
  font-family: var(--font, -apple-system, BlinkMacSystemFont, "SF Pro Display",
      "Segoe UI", "Helvetica Neue", Arial, sans-serif);
  color: #1d1d1f;
}

.jchat-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  background: linear-gradient(135deg, #0071e3, #6c5ce7);
  color: #fff;
}

.jchat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.jchat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.02em;
}

.jchat-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.jchat-status {
  font-size: 12px;
  opacity: 0.85;
}

.jchat-status .dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4cd964;
  margin-right: 5px;
  vertical-align: middle;
  box-shadow: 0 0 0 2px rgba(76, 217, 100, 0.25);
}

.jchat-close {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  transition: background 0.2s ease;
}

.jchat-close:hover {
  background: rgba(255, 255, 255, 0.28);
}

.jchat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fafafc;
  scroll-behavior: smooth;
}

.jchat-msg {
  max-width: 85%;
  padding: 11px 15px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: -0.005em;
  white-space: pre-wrap;
  word-wrap: break-word;
  animation: msg-in 0.3s ease;
}

@keyframes msg-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.jchat-msg.user {
  align-self: flex-end;
  background: #0071e3;
  color: #fff;
  border-bottom-right-radius: 6px;
}

.jchat-msg.assistant {
  align-self: flex-start;
  background: #fff;
  color: #1d1d1f;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-bottom-left-radius: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.jchat-msg.system-note {
  align-self: center;
  background: transparent;
  color: #86868b;
  font-size: 12px;
  text-align: center;
  max-width: 100%;
}

.jchat-typing {
  align-self: flex-start;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 18px;
  border-bottom-left-radius: 6px;
  padding: 13px 16px;
  display: inline-flex;
  gap: 4px;
  animation: msg-in 0.3s ease;
}

.jchat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #b0b0b6;
  animation: typing 1.2s infinite ease-in-out;
}

.jchat-typing span:nth-child(2) {
  animation-delay: 0.18s;
}

.jchat-typing span:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes typing {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.jchat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 20px 12px;
  background: #fafafc;
}

.jchat-suggestion {
  font-size: 13px;
  padding: 7px 13px;
  border-radius: 980px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: #1d1d1f;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.jchat-suggestion:hover {
  background: #f0f0f3;
  border-color: rgba(0, 0, 0, 0.16);
}

.jchat-input-row {
  padding: 12px 14px 14px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: #fff;
}

.jchat-input {
  flex: 1;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 22px;
  padding: 10px 16px;
  font-size: 15px;
  font-family: inherit;
  resize: none;
  max-height: 120px;
  line-height: 1.4;
  background: #f5f5f7;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.jchat-input:focus {
  border-color: rgba(0, 113, 227, 0.5);
  background: #fff;
}

.jchat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #0071e3;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  transition: background 0.2s ease, transform 0.15s ease;
}

.jchat-send:hover:not(:disabled) {
  background: #0077ed;
}

.jchat-send:active:not(:disabled) {
  transform: scale(0.94);
}

.jchat-send:disabled {
  background: #d2d2d7;
  cursor: not-allowed;
}

/* Standalone full-page layout */
.jchat-fullpage {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f5f5f7 0%, #e8e8ed 100%);
  padding: 24px;
}

.jchat-fullpage .jchat-shell {
  width: 100%;
  max-width: 720px;
  height: 100%;
  max-height: 880px;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  background: #fff;
}

@media (max-width: 480px) {
  .jchat-fullpage {
    padding: 0;
  }
  .jchat-fullpage .jchat-shell {
    border-radius: 0;
    max-height: none;
  }
}

/* Subtle markdown-ish formatting */
.jchat-msg.assistant strong {
  font-weight: 600;
}

.jchat-msg.assistant code {
  background: rgba(0, 0, 0, 0.06);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}

.jchat-msg.assistant a {
  color: #0071e3;
  text-decoration: underline;
}
