/* ==========================================================================
   Evidence Highlighting Module
   Phase 17-03: Evidence panel, text highlighting, and provenance tree
   ========================================================================== */

/* ==========================================================================
   SECTION 1: Evidence Panel
   ========================================================================== */

.evidence-panel {
    flex: 1;
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 200px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #f5f5f5;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.evidence-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--gc-blue, #26374a);
    color: white;
    border-radius: 8px 8px 0 0;
}

.evidence-panel-header h3 {
    margin: 0;
    font-size: 1rem;
}

.evidence-close {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1rem;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.evidence-close:hover {
    opacity: 1;
}

/* ==========================================================================
   SECTION 2: JD Text Viewer
   ========================================================================== */

.jd-text-viewer {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: white;
    font-size: 0.9375rem;
    line-height: 1.7;
}

.jd-text-viewer h4 {
    font-size: 0.875rem;
    color: var(--gc-blue, #26374a);
    margin: 1rem 0 0.5rem 0;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border);
}

.jd-text-viewer h4:first-child {
    margin-top: 0;
}

.jd-text-section {
    margin-bottom: 1.5rem;
}

.jd-text-content {
    color: var(--text);
}

.jd-activity-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.jd-activity-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.jd-activity-list li:last-child {
    border-bottom: none;
}

/* ==========================================================================
   SECTION 3: Evidence Highlights
   ========================================================================== */

.evidence-highlight {
    background: linear-gradient(180deg, transparent 60%, #fff59d 60%);
    padding: 0 2px;
    border-radius: 2px;
    cursor: pointer;
    transition: background 0.2s;
}

.evidence-highlight:hover {
    background: #fff59d;
}

.evidence-highlight.active {
    background: #fff176;
    box-shadow: 0 0 0 2px #fbc02d;
}

/* Mark element fallback (semantic HTML) */
mark.evidence-highlight {
    background: #fff59d;
    padding: 0 2px;
    border-radius: 2px;
}

mark.evidence-highlight.active {
    background: #fff176;
    box-shadow: 0 0 0 2px #fbc02d;
}

/* Scroll indicator for active highlight */
.evidence-highlight.scroll-target {
    animation: highlightPulse 0.5s ease-out;
}

@keyframes highlightPulse {
    0% { box-shadow: 0 0 0 4px rgba(251, 192, 45, 0.5); }
    100% { box-shadow: 0 0 0 2px #fbc02d; }
}

/* ==========================================================================
   SECTION 4: Evidence Not Found
   ========================================================================== */

.evidence-not-found {
    display: inline-block;
    background: #fff3e0;
    color: #e65100;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.8125rem;
    font-style: italic;
}

.evidence-fuzzy-match {
    border-bottom: 2px dotted #fbc02d;
}

.evidence-not-found-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #fff3e0;
    color: #e65100;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.evidence-not-found-banner i {
    flex-shrink: 0;
}

/* ==========================================================================
   SECTION 5: Provenance Tree
   ========================================================================== */

.provenance-tree {
    margin: 1rem 0;
    font-size: 0.875rem;
}

.provenance-tree-item {
    display: flex;
    align-items: flex-start;
    padding: 0.5rem 0;
    position: relative;
}

.provenance-tree-item::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 24px;
    bottom: -8px;
    width: 2px;
    background: var(--border);
}

.provenance-tree-item:last-child::before {
    display: none;
}

.provenance-tree-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gc-blue, #26374a);
    color: white;
    border-radius: 50%;
    font-size: 0.625rem;
    flex-shrink: 0;
    margin-right: 0.75rem;
    z-index: 1;
}

.provenance-tree-content {
    flex: 1;
}

.provenance-tree-label {
    font-weight: 500;
    color: var(--gc-blue, #26374a);
}

.provenance-tree-value {
    color: var(--text);
}

.provenance-tree-link {
    color: var(--accent, #2b4380);
    text-decoration: underline;
}

.provenance-tree-link:hover {
    text-decoration: none;
}

.provenance-tree-meta {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 0.125rem;
}

/* Expanded provenance detail (collapsible) */
.provenance-expandable {
    margin-top: 0.5rem;
}

.provenance-expand-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: transparent;
    border: none;
    color: var(--accent, #2b4380);
    font-size: 0.8125rem;
    cursor: pointer;
    padding: 0;
}

.provenance-expand-btn:hover {
    text-decoration: underline;
}

.provenance-expand-btn i {
    transition: transform 0.2s;
}

.provenance-expandable[aria-expanded="true"] .provenance-expand-btn i {
    transform: rotate(90deg);
}

.provenance-detail-content {
    display: none;
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: #f5f5f5;
    border-radius: 4px;
    font-size: 0.8125rem;
}

.provenance-expandable[aria-expanded="true"] .provenance-detail-content {
    display: block;
}

/* ==========================================================================
   SECTION 6: Mobile Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .evidence-panel {
        position: static;
        max-height: 400px;
        margin-top: 1rem;
    }
}
