/* chat-block.css  —  Smart Chat Interactive UI Block Styles */

/* ── Chat Block Base ─────────────────────────────────────── */
.chat-block {
    border-radius: 12px;
    overflow: hidden;
    margin: 6px 0;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    font-size: 0.82rem;
    background: #fff;
    border: 1px solid #e8eaf0;
}
.chat-block-header {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    gap: 6px;
    flex-wrap: wrap;
}
.chat-block-title { font-weight: 600; font-size: 0.85rem; }
.chat-block-body  { padding: 10px 12px; }
.chat-block-footer {
    padding: 6px 12px;
    background: #f8faff;
    border-top: 1px solid #e8eaf0;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ── Action Buttons ──────────────────────────────────────── */
.btn-chat-action {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #6366f1;
    background: #fff;
    color: #6366f1;
    font-size: 0.76rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.btn-chat-action:hover {
    background: #6366f1;
    color: #fff;
}
.btn-chat-insert {
    border-color: #22c55e;
    color: #22c55e;
}
.btn-chat-insert:hover { background: #22c55e; color: #fff; }

/* ── Chemical Table ──────────────────────────────────────── */
.chat-block-chem .chat-block-header { background: linear-gradient(135deg,#4f46e5,#7c3aed); }
.chem-search-input {
    flex: 1;
    min-width: 80px;
    max-width: 160px;
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.18);
    color: #fff;
    font-size: 0.76rem;
    outline: none;
}
.chem-search-input::placeholder { color: rgba(255,255,255,0.7); }
.chem-expand-toggle { font-size: 0.75rem; color: rgba(255,255,255,0.9); cursor: pointer; }
.chem-table { border-collapse: collapse; width: 100%; }
.chem-table th {
    background: #f1f0ff;
    padding: 6px 8px;
    font-size: 0.76rem;
    font-weight: 600;
    text-align: left;
    border-bottom: 2px solid #d8d5ff;
    color: #4f46e5;
}
.chem-table td { padding: 6px 8px; border-bottom: 1px solid #f0f0f5; vertical-align: top; }
.chem-compound-cell {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    margin: 4px;
    padding: 4px;
    border-radius: 8px;
    background: #f8faff;
    border: 1px solid #e0e0f0;
    cursor: pointer;
    transition: border-color 0.15s;
    min-width: 70px;
}
.chem-compound-cell:hover { border-color: #6366f1; }
.smiles-inline-canvas {
    width: 80px; height: 80px;
    border-radius: 6px;
    background: #fff;
    display: block;
    transition: width 0.2s, height 0.2s;
}
.chem-compound-name { font-size: 0.68rem; color: #555; text-align: center; margin-top: 2px; }

/* ── Review Report ───────────────────────────────────────── */
.chat-block-review .chat-block-header { background: linear-gradient(135deg,#1d4ed8,#4f46e5); }
.review-overall-score { font-size: 1.3rem !important; }
.review-section-row {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 6px 0;
    border-bottom: 1px solid #f0f0f5;
}
.review-section-row:last-child { border-bottom: none; }
.review-sec-name { font-weight: 600; font-size: 0.82rem; }
.review-sec-score { font-size: 0.72rem !important; padding: 2px 6px; }
.review-sec-notes { padding-left: 24px; font-size: 0.75rem; }
.review-suggestion {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 0.8rem;
    color: #92400e;
}

/* ── CTA Card ────────────────────────────────────────────── */
.chat-block-cta {
    background: linear-gradient(135deg,#f0f4ff,#faf5ff);
    border: 1px dashed #a5b4fc;
}
.chat-block-cta .chat-block-body { padding: 10px 14px; }
.cta-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* ── Section Q&A ─────────────────────────────────────────── */
.chat-block-qa .chat-block-body { padding: 10px 12px; }
.qa-answer { line-height: 1.5; }
.qa-cite-excerpt {
    background: #f8faff;
    border-left: 3px solid #6366f1;
    padding: 4px 8px;
    border-radius: 0 6px 6px 0;
    margin-top: 4px;
}

/* ── Floating Side Panel ─────────────────────────────────── */
.chat-side-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.45);
    z-index: 3000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}
.chat-side-panel-header {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    background: linear-gradient(135deg,#4f46e5,#7c3aed);
    color: #fff;
    font-size: 0.85rem;
}
.chat-side-panel-body {
    overflow: auto;
    flex: 1;
    padding: 12px;
    background: #fff;
}
#chatSidePanel {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 70vh;
    background: #fff;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 40px rgba(0,0,0,0.18);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Intent badge in chat ────────────────────────────────── */
.chat-intent-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.68rem;
    font-weight: 600;
    margin-bottom: 4px;
    letter-spacing: 0.02em;
}
.intent-chemical_info    { background: #ede9fe; color: #6d28d9; }
.intent-review_word      { background: #dbeafe; color: #1e40af; }
.intent-qa_document      { background: #dcfce7; color: #166534; }
.intent-qa_section       { background: #fef9c3; color: #854d0e; }
.intent-generate_section { background: #fee2e2; color: #991b1b; }
.intent-smiles_detect    { background: #f0fdf4; color: #15803d; }
.intent-general_chat     { background: #f3f4f6; color: #374151; }

/* ── Context badge ───────────────────────────────────────── */
.chat-context-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 7px;
    border-radius: 8px;
    font-size: 0.66rem;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    margin-left: 6px;
}

/* ── Ask AI Selection Button ─────────────────────────────── */
#askAboutSelectionBtn {
    position: relative;
    font-size: 0.75rem;
}

/* ── Suggestion chips ────────────────────────────────────── */
.chat-suggestions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 8px 0;
}
.chat-suggestion-chip {
    padding: 3px 10px;
    border-radius: 12px;
    border: 1px solid #a5b4fc;
    background: #f5f3ff;
    color: #4f46e5;
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.chat-suggestion-chip:hover { background: #6366f1; color: #fff; border-color: #6366f1; }
