
/* Profile link, QR, and private chat styles */
/* --- General Page Centering & Responsiveness --- */
.profile-link-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

.top-action-row {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 30px;
  flex-wrap: wrap;
  width: 100%;
}

/* --- QR Section Styles --- */
.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #f8fafc;
  padding: 30px;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  width: 100%;
  max-width: 600px;
  margin-bottom: 40px;
}

.qr-url-row {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
}

.qr-url-row input {
  flex: 1;
  min-width: 250px;
  text-align: center;
}

.qr-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 25px;
  flex-wrap: wrap;
  width: 100%;
}

.qr-actions a,
.qr-actions button {
  flex: 0 1 auto;
}

.qr-ai-jump-btn {
  background-color: #10b981 !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: bold;
  animation: heartPulse 2.5s infinite cubic-bezier(0.4, 0, 0.2, 1);
  transition: background-color 0.3s;
}

.qr-ai-jump-btn:hover,
.qr-ai-jump-btn:focus {
  background-color: #059669 !important;
  animation: none;
}

/* Minimized QR by ~30% */
.qr-image {
  max-width: 180px; /* Reduced size */
  width: 100%;
  height: auto;
  margin: 0 auto 15px auto;
  display: block;
}

/* --- Private Chat Widget Styles --- */
.private-chat-wrapper {
  width: 100%;
  max-width: 700px;
  margin: 0 auto 40px auto;
  scroll-margin-top: 24px;
}

.chat-container {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: auto;
  text-align: right;
}

.chat-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.chat-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.chat-title h2 {
  font-size: 1.1rem;
  margin: 0;
  color: #1e293b;
}

.chat-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ecfdf5; /* Light green background */
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1px solid #a7f3d0;
}

.chat-status {
  font-size: 0.8rem;
  color: #16a34a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-status::before {
  content: '';
  display: block;
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
}

.chat-messages {
  flex: 0 0 auto;
  height: clamp(500px, 64vh, 780px);
  min-height: 360px;
  max-height: 82vh;
  overflow: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  resize: vertical;
  scrollbar-gutter: stable;
}

.message {
  display: flex;
  max-width: 85%;
}

.ai-message {
  align-self: flex-start;
}

.user-message {
  align-self: flex-end;
}

.message-content {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1.6;
  text-align: start;
  unicode-bidi: plaintext;
  overflow-wrap: anywhere;
}

.ai-message .message-content {
  background: #f1f5f9;
  color: #334155;
  border-top-right-radius: 4px;
}

.user-message .message-content {
  background: #0f172a;
  color: #ffffff;
  border-top-left-radius: 4px;
}

.message-content.is-formatted {
  display: block;
}

.message-content.is-formatted p {
  margin: 0 0 10px;
}

.message-content.is-formatted p:last-child,
.message-content.is-formatted ul:last-child,
.message-content.is-formatted ol:last-child {
  margin-bottom: 0;
}

.message-content.is-formatted h3,
.message-content.is-formatted h4,
.message-content.is-formatted h5,
.message-content.is-formatted h6 {
  margin: 12px 0 6px;
  color: #0f172a;
  line-height: 1.35;
}

.message-content.is-formatted h3:first-child,
.message-content.is-formatted h4:first-child,
.message-content.is-formatted h5:first-child,
.message-content.is-formatted h6:first-child {
  margin-top: 0;
}

.message-content.is-formatted ul,
.message-content.is-formatted ol {
  margin: 0 0 10px;
  padding-inline-start: 22px;
}

.message-content.is-formatted li {
  margin-bottom: 4px;
}

.message-content.is-formatted hr {
  border: 0;
  border-top: 1px solid #cbd5e1;
  margin: 12px 0;
}

.ai-table-wrap {
  max-width: 100%;
  margin: 10px 0;
  overflow-x: auto;
}

.ai-table {
  width: 100%;
  min-width: 360px;
  border-collapse: collapse;
  background: #ffffff;
  font-size: 0.9rem;
}

.ai-table th,
.ai-table td {
  padding: 8px 10px;
  border: 1px solid #d7dee8;
  text-align: start;
  vertical-align: top;
}

.ai-table th {
  background: #eef8f5;
  color: #0f172a;
  font-weight: 700;
}

.chat-disclaimer {
  text-align: center;
  font-size: 0.75rem;
  color: #64748b;
  padding: 8px 20px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

.chat-input-area {
  padding: 16px 20px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
}

.chat-form {
  display: flex;
  gap: 10px;
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  outline: none;
  text-align: right;
  unicode-bidi: plaintext;
}

.chat-input::placeholder {
  text-align: right;
}

.chat-input:focus {
  border-color: #10b981; /* Green focus */
}

.chat-send-btn {
  padding: 10px 20px;
  background: #0f172a;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

/* --- Heart Rhythm Pulse Animation for Green Button --- */
@keyframes heartPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  15% { transform: scale(1.02); box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
  30% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
  45% { transform: scale(1.02); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.chat-summary-btn {
  background-color: #10b981 !important; /* Site Green */
  color: #ffffff !important;
  border: none !important;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: bold;
  cursor: pointer;
  flex: 0 0 auto;
  max-width: 280px;
  animation: heartPulse 2.5s infinite cubic-bezier(0.4, 0, 0.2, 1);
  transition: background-color 0.3s;
  text-align: center;
}

.chat-summary-btn:hover {
  background-color: #059669 !important; /* Darker green on hover */
  animation: none; /* Pause pulse on hover */
}

.chat-header-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 10px;
}

.chat-export-menu {
  position: relative;
}

.chat-export-menu summary {
  list-style: none;
  padding: 10px 12px;
  background: #ffffff;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
}

.chat-export-menu summary::-webkit-details-marker {
  display: none;
}

.chat-export-menu summary::after {
  content: '▾';
  margin-inline-start: 8px;
  font-size: 0.75rem;
}

.chat-export-options {
  position: absolute;
  z-index: 10;
  inset-inline-end: 0;
  top: calc(100% + 6px);
  min-width: 150px;
  padding: 6px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.14);
}

.chat-export-options button {
  display: block;
  width: 100%;
  padding: 9px 10px;
  background: transparent;
  color: #334155;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  text-align: start;
}

.chat-export-options button:hover,
.chat-export-options button:focus {
  background: #f1f5f9;
}

.typing-indicator {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 8px 12px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: #94a3b8;
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Mobile adjustments */
@media (max-width: 600px) {
  .qr-url-row { flex-direction: column; }
  .qr-actions { flex-direction: column; width: 100%; }
  .qr-actions a, .qr-actions button { width: 100%; text-align: center; }
  .top-action-row { flex-direction: column; }
  .top-action-row a { width: 100%; text-align: center; }
  .chat-header { align-items: stretch; flex-direction: column; }
  .chat-summary-btn { max-width: none; width: 100%; }
  .chat-header-actions { align-items: stretch; flex-direction: column; }
  .chat-export-menu summary { text-align: center; }
  .chat-export-options { position: static; margin-top: 6px; }
  .chat-messages {
    height: min(60vh, 560px);
    min-height: 340px;
    max-height: none;
    resize: none;
  }
  .message { max-width: 100%; }
  .ai-table { min-width: 300px; }
}
