/* ============================================================
   Plagiarism Checker — Page Styles
   File: plagiarism-checker.css
   Builds on top of Rankyfy common.css + keyword-research-extension.css
   Only adds styles not already covered by the base sheets.
   ============================================================ */


/* ============================================================
   HERO — Article with inline match highlights + score panel
   ============================================================ */
.plg-preview {
    display: flex;
    height: 340px;
    background: #f6f7ff;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
}

/* Left — article panel */
.plg-article-panel {
    flex: 1;
    background: #fff;
    border-right: 1px solid #e8eaed;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.plg-article-topbar {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    background: var(--secondary-color);
    flex-shrink: 0;
}

.plg-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

.plg-article-url {
    font-size: 10px;
    color: rgba(255,255,255,0.35);
    margin-left: 6px;
    background: rgba(255,255,255,0.07);
    padding: 2px 8px;
    border-radius: 4px;
}

.plg-article-body {
    flex: 1;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
}

.plg-text-block {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* Individual lines — plain, matched, partial */
.plg-line {
    height: 8px;
    border-radius: 4px;
    position: relative;
    cursor: pointer;
}

.plg-line--plain   { background: rgba(0,0,0,0.09); }

.plg-line--match {
    background: rgba(220,53,69,0.3);
    border: 1px solid rgba(220,53,69,0.5);
    animation: plgPulse 2s ease-in-out infinite alternate;
}

.plg-line--partial {
    background: rgba(255,193,7,0.3);
    border: 1px solid rgba(255,193,7,0.5);
}

@keyframes plgPulse {
    from { opacity: 1; }
    to   { opacity: 0.6; }
}

/* Tooltip on hover */
.plg-match-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--secondary-color);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 5px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 10;
}

.plg-line:hover .plg-match-tooltip { display: block; }

/* Legend bar */
.plg-legend {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.plg-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 600;
    color: #888;
}

.plg-legend-item::before {
    content: '';
    width: 10px;
    height: 6px;
    border-radius: 3px;
    flex-shrink: 0;
}

.plg-leg--match::before   { background: rgba(220,53,69,0.5); }
.plg-leg--partial::before { background: rgba(255,193,7,0.5); }
.plg-leg--plain::before   { background: rgba(0,0,0,0.12); }

/* Right — score panel */
.plg-score-panel {
    width: 185px;
    flex-shrink: 0;
    background: var(--secondary-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 12px;
    gap: 8px;
    overflow: hidden;
}

.plg-score-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    font-weight: 700;
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    align-self: flex-start;
}

/* Donut ring */
.plg-ring-wrap {
    position: relative;
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}

.plg-ring-svg { width: 80px; height: 80px; }

.plg-original-arc {
    stroke-dashoffset: 77; /* ~62% of 201 ≈ 124 offset from 201 */
    transition: stroke-dashoffset 1s ease;
}

.plg-ring-label {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
}

.plg-ring-label strong {
    font-size: 1.2rem;
    font-weight: 800;
    color: #fff;
    line-height: 1;
}

.plg-ring-label span {
    font-size: 9px;
    font-weight: 700;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 1;
}

/* Verdict */
.plg-verdict {
    font-size: 10px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    text-align: center;
}

.plg-verdict--warn {
    background: rgba(255,193,7,0.15);
    color: #ffc107;
    border: 1px solid rgba(255,193,7,0.25);
}

.plg-verdict--fail {
    background: rgba(220,53,69,0.2);
    color: #ff6b7a;
    border: 1px solid rgba(220,53,69,0.3);
}

.plg-verdict--pass {
    background: rgba(40,167,69,0.15);
    color: #4ddb78;
    border: 1px solid rgba(40,167,69,0.25);
}

/* Score rows */
.plg-score-rows {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-top: 1px solid rgba(255,255,255,0.07);
    padding-top: 8px;
}

.plg-score-row {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11px;
}

.plg-score-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.plg-score-row span:not(.plg-score-dot) {
    flex: 1;
    color: rgba(255,255,255,0.45);
    opacity: 1;
    font-size: 11px;
    text-align: left;
}

.plg-score-row strong {
    color: rgba(255,255,255,0.85);
    font-size: 11px;
}


/* ============================================================
   SECTION 2 — Source list (inside kre-issue-card)
   ============================================================ */
.plg-source-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.plg-source-item {
    border-radius: 10px;
    padding: 10px 12px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.plg-source--high {
    background: rgba(220,53,69,0.08);
    border-color: rgba(220,53,69,0.2);
}

.plg-source--mid {
    background: rgba(255,193,7,0.07);
    border-color: rgba(255,193,7,0.2);
}

.plg-source-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.plg-source-favicon {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: var(--primary-color);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.plg-source-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.plg-source-domain {
    font-size: 12px;
    font-weight: 700;
    color: rgba(255,255,255,0.85);
    opacity: 1;
}

.plg-source-url {
    font-size: 10px;
    color: rgba(255,255,255,0.35);
    font-family: monospace;
    opacity: 1;
}

.plg-source-pct {
    font-size: 12px;
    font-weight: 800;
    flex-shrink: 0;
    padding: 2px 8px;
    border-radius: 4px;
}

.plg-pct--high { background: rgba(220,53,69,0.2); color: #ff6b7a; }
.plg-pct--mid  { background: rgba(255,193,7,0.15); color: #ffc107; }

.plg-source-bar-wrap {
    height: 4px;
    background: rgba(255,255,255,0.07);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 6px;
}

.plg-source-bar {
    height: 100%;
    background: #dc3545;
    border-radius: 2px;
    transition: width 0.8s ease;
}

.plg-bar--mid { background: #ffc107; }

.plg-source-sentences {
    font-size: 10px;
    color: rgba(255,255,255,0.35);
    opacity: 1;
}


/* ============================================================
   SECTION 3 — Match badges (inside kre-table)
   ============================================================ */
.plg-sentence-cell {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.plg-match-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
}

.plg-badge--high { background: rgba(220,53,69,0.1); color: #dc3545; }
.plg-badge--mid  { background: rgba(255,193,7,0.1);  color: #d4a400; }
.plg-badge--low  { background: rgba(40,167,69,0.1);  color: #28a745; }


/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 767px) {
    .plg-preview {
        flex-direction: column;
        height: auto;
    }

    .plg-article-panel {
        border-right: none;
        border-bottom: 1px solid #e8eaed;
        max-height: 200px;
    }

    .plg-score-panel {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        padding: 12px;
        gap: 12px;
    }

    .plg-score-rows {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        border-top: none;
        padding-top: 0;
    }
}