/**
 * review-mode.css  —  Light Theme
 * Verifiable AI Review Mode: single-section panel, batch accordion, citation & chemical modals.
 */

/* ═══════════════════════════════════════════════════════
   Review Mode Panel — full-screen overlay, LIGHT theme
═══════════════════════════════════════════════════════ */

.pp-review-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    background: #f0f4ff;
    display: flex;
    flex-direction: column;
    font-family: 'Segoe UI', 'Inter', sans-serif;
    color: #1e293b;
    overflow: hidden;
    /* Left accent bar: signals review mode is active */
    border-left: 4px solid #2563eb;
}

/* Header */
.pp-review-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
    border-bottom: none;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.pp-review-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
}

.pp-review-meta {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Legend */
.pp-review-legend {
    padding: 6px 16px;
    background: #e8eeff;
    border-bottom: 1px solid #c7d2fe;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    font-size: 0.78rem;
    color: #4b5563;
}

/* Body (scrollable text area) */
.pp-review-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    font-size: 0.875rem;
    line-height: 1.75;
    color: #1e293b;
    background: #fff;
}

.pp-review-body::-webkit-scrollbar {
    width: 5px;
}
.pp-review-body::-webkit-scrollbar-track {
    background: #f0f4ff;
}
.pp-review-body::-webkit-scrollbar-thumb {
    background: #c7d2fe;
    border-radius: 3px;
}

.pp-review-para {
    margin-bottom: 0.9rem;
    color: #374151;
}

/* Markdown table inside review body */
.pp-review-body table, .pp-batch-body-html table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    margin: 10px 0;
}
.pp-review-body th, .pp-review-body td,
.pp-batch-body-html th, .pp-batch-body-html td {
    border: 1px solid #d1d9ff;
    padding: 5px 9px;
    text-align: left;
    vertical-align: top;
}
.pp-review-body th, .pp-batch-body-html th {
    background: #e8eeff;
    color: #1e40af;
    font-weight: 600;
}
.pp-review-body tr:nth-child(even) td,
.pp-batch-body-html tr:nth-child(even) td { background: #f5f7ff; }

/* Inline code */
.pp-review-body code, .pp-batch-body-html code {
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 3px;
    padding: 1px 4px;
    font-size: 0.82em;
    color: #3730a3;
    font-family: 'Courier New', monospace;
}

/* KaTeX math display */
.pp-review-body .katex-display, .pp-batch-body-html .katex-display {
    margin: 10px 0;
    overflow-x: auto;
}
.pp-math-fallback-inline { font-style: italic; color: #1d4ed8; font-family: 'Courier New', monospace; font-size: 0.88em; }
.pp-math-fallback-display { display: block; text-align: center; margin: 10px 0; font-style: italic; color: #1d4ed8; font-family: 'Courier New', monospace; }

/* Footer */
.pp-review-footer {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    background: #f0f4ff;
    border-top: 1px solid #c7d2fe;
    flex-shrink: 0;
    gap: 8px;
}

/* ═══════════════════════════════════════════════════════
   Citation Badge [N]
═══════════════════════════════════════════════════════ */

.pp-cite-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 18px;
    padding: 0 5px;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    vertical-align: middle;
    margin: 0 2px;
    transition: transform 0.12s, box-shadow 0.12s;
    box-shadow: 0 1px 4px rgba(99, 120, 255, 0.45);
    line-height: 1;
    text-decoration: none;
}

.pp-cite-badge:hover {
    transform: translateY(-1px) scale(1.08);
    box-shadow: 0 3px 10px rgba(99, 120, 255, 0.6);
    background: linear-gradient(135deg, #60a5fa, #818cf8);
    color: #fff;
}

.pp-cite-badge:active {
    transform: scale(0.95);
}

/* Sample badge in legend */
.pp-cite-badge-sample {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 18px;
    padding: 0 5px;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    border-radius: 4px;
    vertical-align: middle;
}

/* ═══════════════════════════════════════════════════════
   Citation Modal
═══════════════════════════════════════════════════════ */

.pp-citation-modal-content {
    background: #fff;
    border: 1px solid #c7d2fe;
    border-radius: 12px;
    color: #1e293b;
    box-shadow: 0 20px 60px rgba(37, 99, 235, 0.18);
}

.pp-citation-modal-header {
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    padding: 12px 16px;
}

.pp-citation-modal-title {
    color: #fff;
    font-size: 0.875rem;
    font-weight: 700;
    margin: 0;
}

.pp-citation-modal-body {
    padding: 16px;
    max-height: 65vh;
    overflow-y: auto;
    background: #fff;
    color: #1e293b;
}

.pp-citation-modal-body::-webkit-scrollbar {
    width: 5px;
}
.pp-citation-modal-body::-webkit-scrollbar-thumb {
    background: #c7d2fe;
    border-radius: 3px;
}

.pp-citation-modal-footer {
    background: #f5f7ff;
    border-top: 1px solid #e0e7ff;
    border-radius: 0 0 12px 12px;
    display: flex;
    align-items: center;
    padding: 10px 16px;
}

/* Loading spinner */
.pp-cite-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
    color: #6b7280;
}

/* Chunk meta info row */
.pp-cite-chunk-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.pp-cite-num-badge {
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
}

.pp-cite-filename {
    font-size: 0.78rem;
    color: #4b5563;
    background: #eef2ff;
    padding: 2px 8px;
    border-radius: 4px;
}

.pp-cite-page {
    font-size: 0.78rem;
    color: #4b5563;
    background: #eef2ff;
    padding: 2px 8px;
    border-radius: 4px;
}

/* Text excerpt blockquote */
.pp-cite-text-excerpt {
    background: #f0f4ff;
    border-left: 3px solid #2563eb;
    padding: 12px 16px;
    border-radius: 0 8px 8px 0;
    color: #1e293b;
    font-size: 0.85rem;
    line-height: 1.65;
    margin: 0 0 16px 0;
    font-style: normal;
    word-break: break-word;
}

/* PDF page preview section */
.pp-cite-page-preview {
    margin-top: 12px;
    border: 1px solid #c7d2fe;
    border-radius: 8px;
    overflow: hidden;
    background: #f9faff;
}

.pp-cite-page-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    font-size: 0.75rem;
    color: #4b5563;
    background: #e8eeff;
    border-bottom: 1px solid #c7d2fe;
}

.pp-cite-bbox-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    color: #dc2626;
    font-size: 0.72rem;
}

.pp-cite-bbox-dot {
    width: 8px;
    height: 8px;
    background: #ff2222;
    border-radius: 1px;
    display: inline-block;
    opacity: 0.7;
}

.pp-cite-page-img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
}

/* ═══════════════════════════════════════════════════════
   Approve button animation
═══════════════════════════════════════════════════════ */

#ppApproveInsertBtn {
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    font-weight: 700;
    letter-spacing: 0.3px;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
    transition: transform 0.12s, box-shadow 0.12s;
}

#ppApproveInsertBtn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.55);
    background: linear-gradient(135deg, #34d399, #10b981);
}

#ppApproveInsertBtn:active {
    transform: scale(0.97);
}

/* ═══════════════════════════════════════════════════════
   Modal z-index fix
   Bootstrap modals default to z-index 1050, but the
   review panel sits at 2000.  Only override when review
   panel is active (body.pp-review-active added by JS).
═══════════════════════════════════════════════════════ */

#ppCitationModal,
#ppChemicalModal {
    z-index: 2100 !important;
}

/* Backdrop override ONLY while review panel is open */
body.pp-review-active .modal-backdrop {
    z-index: 2050 !important;
}

/* ═══════════════════════════════════════════════════════
   FIG Badge  ⬡ FIG. N  (chemical structure placeholder)
═══════════════════════════════════════════════════════ */

.pp-fig-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 18px;
    padding: 0 6px;
    background: linear-gradient(135deg, #d97706, #f59e0b);
    color: #0f1117;
    font-size: 0.68rem;
    font-weight: 700;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    vertical-align: middle;
    margin: 0 2px;
    transition: transform 0.12s, box-shadow 0.12s;
    box-shadow: 0 1px 4px rgba(245, 158, 11, 0.45);
    line-height: 1;
}

.pp-fig-badge:hover {
    transform: translateY(-1px) scale(1.08);
    box-shadow: 0 3px 10px rgba(245, 158, 11, 0.6);
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
}

.pp-fig-badge:active {
    transform: scale(0.95);
}

.pp-fig-badge-sample {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 18px;
    padding: 0 6px;
    background: linear-gradient(135deg, #d97706, #f59e0b);
    color: #0f1117;
    font-size: 0.68rem;
    font-weight: 700;
    border-radius: 4px;
    vertical-align: middle;
    margin-left: 8px;
}

/* ═══════════════════════════════════════════════════════
   Batch Review Panel — Accordion
═══════════════════════════════════════════════════════ */

.pp-batch-accordion {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    background: #f5f7ff;
}

.pp-batch-accordion::-webkit-scrollbar { width: 5px; }
.pp-batch-accordion::-webkit-scrollbar-track { background: #f0f4ff; }
.pp-batch-accordion::-webkit-scrollbar-thumb {
    background: #c7d2fe;
    border-radius: 3px;
}

.pp-batch-section-item {
    border-bottom: 1px solid #d1d9ff;
    background: #fff;
}

.pp-batch-section-item:last-child {
    border-bottom: none;
}

.pp-batch-section-header {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    background: #f0f4ff;
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
}

.pp-batch-section-header:hover {
    background: #e0e7ff;
}

.pp-batch-section-title-row {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 8px;
}

.pp-batch-section-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: #1e40af;
    letter-spacing: 0.2px;
}

.pp-batch-section-badges {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.pp-batch-chevron {
    font-size: 0.7rem;
    color: #2563eb;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.pp-batch-section-body {
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #e0e7ff;
}

.pp-batch-body-html {
    flex: none;
    overflow-y: visible;
    max-height: 320px;
    overflow-y: auto;
    padding: 0 0 8px 0;
}

.pp-batch-edit-row {
    margin-top: 8px;
    display: flex;
    justify-content: flex-end;
}

.pp-batch-edit-textarea {
    background: #fff;
    color: #1e293b;
    border: 1px solid #c7d2fe;
    font-size: 0.82rem;
    line-height: 1.6;
    resize: vertical;
}

.pp-batch-edit-textarea:focus {
    background: #fff;
    color: #1e293b;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

/* Status message in footer */
#ppBatchStatusMsg {
    font-size: 0.78rem;
    flex: 1;
    text-align: center;
    opacity: 0.8;
    color: #4b5563;
}

/* ═══════════════════════════════════════════════════════
   Chemical Structure Modal Layout
═══════════════════════════════════════════════════════ */

.pp-chem-layout {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

@media (max-width: 600px) {
    .pp-chem-layout { flex-direction: column; }
}

.pp-chem-canvas-wrap {
    position: relative;
    flex-shrink: 0;
    background: #f5f7ff;
    border: 1px solid #c7d2fe;
    border-radius: 8px;
    overflow: hidden;
    width: 300px;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pp-chem-canvas-wrap canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
}

.pp-chem-canvas-msg {
    position: absolute;
    padding: 8px 12px;
    text-align: center;
    font-size: 0.78rem;
    pointer-events: none;
    color: #64748b;
}

.pp-chem-editor-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pp-chem-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.pp-chem-smiles-input {
    background: #fff;
    color: #1e293b;
    border: 1px solid #c7d2fe;
    font-family: 'Courier New', monospace;
    font-size: 0.82rem;
    resize: vertical;
}

.pp-chem-smiles-input:focus {
    background: #fff;
    color: #1e293b;
    border-color: #d97706;
    box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.15);
}

/* ═══════════════════════════════════════════════════════
   Passage-level citation highlighting (Issue 3 fix)
═══════════════════════════════════════════════════════ */

.pp-excerpt-key-passage {
    display: inline;
    background: linear-gradient(to right, #fef9c3, #fef08a);
    border-left: 3px solid #f59e0b;
    padding: 2px 6px 2px 8px;
    border-radius: 0 4px 4px 0;
    font-weight: 500;
    color: #1e293b;
    line-height: 1.8;
}

.pp-excerpt-rest {
    color: #64748b;
    font-style: italic;
}

/* ═══════════════════════════════════════════════════════
   DOCX preview (Issue 2 fix)
═══════════════════════════════════════════════════════ */

.pp-docx-loading {
    display: flex;
    align-items: center;
    padding: 12px 0;
    font-size: 0.82rem;
    color: #4b5563;
}

.pp-docx-preview {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 10px;
    font-size: 0.82rem;
    line-height: 1.7;
    max-height: 340px;
    overflow-y: auto;
    background: #fafbff;
    color: #1e293b;
}

.pp-docx-preview::-webkit-scrollbar { width: 4px; }
.pp-docx-preview::-webkit-scrollbar-thumb { background: #c7d2fe; border-radius: 3px; }

.pp-passage-highlight {
    background: #bfdbfe;
    border-radius: 3px;
    padding: 1px 3px;
    font-weight: 500;
    color: #1e3a8a;
}

/* ═══════════════════════════════════════════════════════
   FIG Modal — context card (Issue 1b fix)
═══════════════════════════════════════════════════════ */

.pp-chem-context-card {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 7px;
    padding: 8px 12px;
    margin-bottom: 10px;
}

.pp-chem-context-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    color: #0369a1;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 4px;
}

.pp-chem-context-text {
    font-size: 0.8rem;
    line-height: 1.55;
    color: #334155;
    margin: 0;
    max-height: 80px;
    overflow-y: auto;
}

.pp-chem-fig-mark {
    color: #0369a1;
    font-weight: 700;
}

/* ═══════════════════════════════════════════════════════
   Review Report — score ring + fix buttons (Issue 4 fix)
═══════════════════════════════════════════════════════ */

.review-score-ring { display: block; flex-shrink: 0; }
.review-score-arc {
    transition: stroke-dashoffset 1.2s cubic-bezier(.4, 0, .2, 1);
}

.review-section-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
    gap: 6px;
}
.review-section-row:last-child { border-bottom: none; }

.review-sec-left {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}
.review-sec-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.review-sec-name {
    font-weight: 500;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.review-sec-score {
    font-weight: 700;
    font-size: 0.88rem;
}
.review-sec-notes {
    width: 100%;
    font-size: 0.77rem;
    color: #64748b;
    padding-left: 22px;
    line-height: 1.4;
}
.review-sec-ok-label {
    font-size: 0.75rem;
    color: #22c55e;
    font-weight: 600;
}

.btn-review-fix {
    padding: 2px 10px;
    border-radius: 5px;
    border: 1px solid #f59e0b;
    background: #fffbeb;
    color: #92400e;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s;
    white-space: nowrap;
}
.btn-review-fix:hover { background: #fef3c7; border-color: #d97706; }

.review-action-bar {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
    flex-wrap: wrap;
}

.btn-review-fix-all {
    flex: 1;
    min-width: 120px;
    padding: 7px 14px;
    border-radius: 7px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border: none;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s, transform .12s;
    box-shadow: 0 2px 8px rgba(99,102,241,.3);
}
.btn-review-fix-all:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-review-fix-all:active { transform: scale(.97); }

.btn-review-export {
    padding: 7px 14px;
    border-radius: 7px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #475569;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}
.btn-review-export:hover { background: #f8fafc; border-color: #cbd5e1; }

.review-action-bar-ok {
    color: #4b5563;
    font-size: 0.82rem;
    align-items: center;
}

.review-missing-bar {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.8rem;
}
