/* ============================================================
 * Ask Jessy - AI search assistant page
 * Loaded site-wide via ClientResources.cshtml.
 * All rules are scoped under .ask-jessy so they only affect that page.
 * ============================================================ */

.ask-jessy { max-width: 860px; margin: 32px auto; padding: 0 16px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; color: #1f2937; }
.ask-jessy *, .ask-jessy *::before, .ask-jessy *::after { box-sizing: border-box; }

/* ------- Header ------- */
.ask-jessy .aj-header { display: flex; align-items: center; gap: 16px; padding: 20px 24px; background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%); border-radius: 12px 12px 0 0; color: white; }
.ask-jessy .aj-avatar { width: 56px; height: 56px; border-radius: 50%; background: white; color: #1e3a8a; display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 700; flex-shrink: 0; }
.ask-jessy .aj-header h1 { margin: 0; font-size: 20px; font-weight: 600; color: white; }
.ask-jessy .aj-header p { margin: 4px 0 0; font-size: 13px; opacity: 0.9; color: white; }
.ask-jessy .aj-beta-tag { display: inline-block; padding: 2px 8px; background: rgba(255, 255, 255, 0.2); border-radius: 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; margin-left: 8px; vertical-align: middle; }

/* ------- Chat surface ------- */
.ask-jessy .aj-surface { background: #ffffff; border: 1px solid #e5e7eb; border-top: none; border-radius: 0 0 12px 12px; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08); display: flex; flex-direction: column; min-height: 520px; }

/* ------- Welcome / empty state ------- */
.ask-jessy .aj-welcome { padding: 32px 24px; text-align: center; }
.ask-jessy .aj-welcome p { font-size: 15px; color: #4b5563; margin: 0 0 24px; line-height: 1.6; }
.ask-jessy .aj-prompts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.ask-jessy .aj-prompt-chip { padding: 10px 16px; background: #f3f4f6; border: 1px solid #e5e7eb; border-radius: 999px; font-size: 13px; cursor: pointer; color: #374151; transition: all 0.15s; font-family: inherit; }
.ask-jessy .aj-prompt-chip:hover { background: #2563eb; border-color: #2563eb; color: white; }

/* ------- Message list ------- */
.ask-jessy .aj-messages { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; max-height: 60vh; }
.ask-jessy .aj-msg { display: flex; gap: 12px; max-width: 90%; }
.ask-jessy .aj-msg.assistant { align-self: flex-start; }
.ask-jessy .aj-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.ask-jessy .aj-msg-avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; }
.ask-jessy .aj-msg.assistant .aj-msg-avatar { background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%); color: white; }
.ask-jessy .aj-msg.user .aj-msg-avatar { background: #e5e7eb; color: #4b5563; }
.ask-jessy .aj-msg-bubble { padding: 12px 16px; border-radius: 16px; font-size: 14px; line-height: 1.55; white-space: pre-wrap; }
.ask-jessy .aj-msg.assistant .aj-msg-bubble { background: #f3f4f6; color: #1f2937; border-top-left-radius: 4px; }
.ask-jessy .aj-msg.user .aj-msg-bubble { background: #2563eb; color: white; border-top-right-radius: 4px; }

/* ------- Typing indicator ------- */
.ask-jessy .aj-typing { display: flex; gap: 4px; padding: 14px 18px; background: #f3f4f6; border-radius: 16px; border-top-left-radius: 4px; width: fit-content; }
.ask-jessy .aj-typing span { width: 8px; height: 8px; background: #9ca3af; border-radius: 50%; animation: aj-typing-bounce 1.4s infinite; }
.ask-jessy .aj-typing span:nth-child(2) { animation-delay: 0.2s; }
.ask-jessy .aj-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes aj-typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* ------- Product cards ------- */
.ask-jessy .aj-product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 12px; }
.ask-jessy .aj-product-card { display: flex; flex-direction: column; border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden; background: white; text-decoration: none; color: inherit; transition: all 0.15s; position: relative; }
.ask-jessy .aj-product-card:hover { border-color: #2563eb; box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15); transform: translateY(-1px); text-decoration: none; }
.ask-jessy .aj-product-img { width: 100%; height: 140px; background: #f9fafb; display: flex; align-items: center; justify-content: center; padding: 12px; }
.ask-jessy .aj-product-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.ask-jessy .aj-product-img-placeholder { color: #9ca3af; font-size: 12px; font-style: italic; }
.ask-jessy .aj-product-body { padding: 12px; flex: 1; display: flex; flex-direction: column; }
.ask-jessy .aj-product-pn { font-size: 11px; color: #6b7280; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.ask-jessy .aj-product-title { font-size: 13px; font-weight: 600; color: #1f2937; margin-top: 4px; line-height: 1.3; }
.ask-jessy .aj-product-headline { font-size: 12px; color: #6b7280; margin-top: 6px; line-height: 1.4; flex: 1; }
.ask-jessy .aj-best-seller { position: absolute; top: 8px; right: 8px; padding: 2px 8px; background: #ef4444; color: white; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; border-radius: 4px; z-index: 1; }

/* ------- KB citation pills ------- */
/* Compact "source" chips that appear at the bottom of Jessy's answer when he
 * drew on a knowledge-base article. Pattern matches CEO Plus's Ask Craig
 * citation chips so the two products feel like a family. */
.ask-jessy .aj-kb-pills { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ask-jessy .aj-kb-pills-label { font-size: 11px; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: 0.4px; margin-right: 4px; }
.ask-jessy .aj-kb-pill { display: inline-flex; align-items: center; font-size: 11px; padding: 3px 10px; border-radius: 12px; background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; text-decoration: none; transition: background-color 0.12s ease, border-color 0.12s ease; }
.ask-jessy .aj-kb-pill:hover { background: #dbeafe; border-color: #93c5fd; color: #1e3a8a; text-decoration: none; }
.ask-jessy .aj-kb-pill-icon { font-size: 10px; margin-right: 4px; opacity: 0.7; }

/* ------- Input area ------- */
.ask-jessy .aj-input-wrap { border-top: 1px solid #e5e7eb; padding: 16px 24px; background: #fafbfc; border-radius: 0 0 12px 12px; }
.ask-jessy .aj-input-form { display: flex; gap: 8px; }
.ask-jessy .aj-input { flex: 1; padding: 12px 16px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; font-family: inherit; outline: none; resize: none; min-height: 44px; max-height: 120px; color: #1f2937; background: white; }
.ask-jessy .aj-input:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }
.ask-jessy .aj-send-btn { padding: 12px 20px; background: #2563eb; color: white; border: none; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; transition: background 0.15s; flex-shrink: 0; font-family: inherit; }
.ask-jessy .aj-send-btn:hover:not(:disabled) { background: #1d4ed8; }
.ask-jessy .aj-send-btn:disabled { background: #9ca3af; cursor: not-allowed; }

/* ------- Footer / disclaimer ------- */
.ask-jessy .aj-disclaimer { padding: 12px 24px 16px; font-size: 11px; color: #9ca3af; text-align: center; }

/* ------- Error ------- */
.ask-jessy .aj-error { padding: 12px 16px; background: #fee2e2; color: #991b1b; border-radius: 8px; font-size: 13px; margin: 12px 0; }

/* ------- Responsive ------- */
@media (max-width: 640px) {
    .ask-jessy { margin: 0; padding: 0; }
    .ask-jessy .aj-header { border-radius: 0; }
    .ask-jessy .aj-surface { border: none; border-radius: 0; min-height: calc(100vh - 88px); }
    .ask-jessy .aj-input-wrap { border-radius: 0; }
    .ask-jessy .aj-msg { max-width: 95%; }
}
