/* retoor <retoor@molodetz.nl> */

:root {
    --isslop-ok-rgb: 52, 168, 83;
    --isslop-fair-rgb: 124, 179, 66;
    --isslop-warn-rgb: 251, 188, 4;
    --isslop-high-rgb: 251, 140, 0;
    --isslop-crit-rgb: 234, 67, 53;
    --isslop-ok: rgb(var(--isslop-ok-rgb));
    --isslop-fair: rgb(var(--isslop-fair-rgb));
    --isslop-warn: rgb(var(--isslop-warn-rgb));
    --isslop-high: rgb(var(--isslop-high-rgb));
    --isslop-crit: rgb(var(--isslop-crit-rgb));
    --isslop-ok-text: #81c995;
    --isslop-warn-text: #fdd663;
    --isslop-high-text: #ffb74d;
    --isslop-crit-text: #f28b82;
}

.isslop-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 24px;
    align-items: start;
}

.isslop-main {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

.isslop-header h1 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 8px;
    font-size: 1.6rem;
    color: var(--text-primary);
}

.isslop-header p {
    margin: 0;
    color: var(--text-secondary);
    max-width: 70ch;
}

.isslop-report-target {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.isslop-report-target code {
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.88rem;
    word-break: break-all;
}

.isslop-report-page section[id] {
    scroll-margin-top: 80px;
}

.isslop-side-list {
    margin: 0;
    padding-left: 18px;
    color: var(--text-secondary);
    font-size: 0.88rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.isslop-definitions,
.isslop-form-card,
.isslop-history,
.isslop-live-card,
.isslop-score-card,
.isslop-report-body,
.isslop-images,
.isslop-dom-pages,
.isslop-files,
.isslop-badge-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.isslop-definitions-lead {
    margin: 0 0 14px;
    color: var(--text-primary);
    font-size: 1.02rem;
}

.isslop-definition-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.isslop-definition-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
}

.isslop-definition-card p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.isslop-form-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.isslop-input {
    flex: 1;
    min-width: 240px;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    color: var(--text-primary);
}

.isslop-input:focus {
    outline: none;
    border-color: var(--accent);
}

.isslop-form-error {
    margin: 10px 0 0;
    color: var(--danger);
    font-size: 0.9rem;
}

.isslop-history-title {
    margin: 0 0 12px;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.isslop-history-empty {
    margin: 0;
    color: var(--text-muted);
}

.isslop-history-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.isslop-history-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    text-decoration: none;
    color: var(--text-primary);
    transition: background 0.15s ease;
}

.isslop-history-link:hover {
    background: var(--bg-card-hover);
}

.isslop-history-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.isslop-history-source {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.isslop-history-detail {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.isslop-grade-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
    color: var(--white);
    background: var(--text-muted);
}

.isslop-grade-a { background: var(--isslop-ok); }
.isslop-grade-b { background: var(--isslop-fair); }
.isslop-grade-c { background: var(--isslop-warn); color: var(--bg-card); }
.isslop-grade-d { background: var(--isslop-high); }
.isslop-grade-f { background: var(--isslop-crit); }

.isslop-live-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.isslop-live-status {
    color: var(--text-primary);
    font-weight: 600;
}

.isslop-progress {
    height: 8px;
    border-radius: 4px;
    background: var(--bg-secondary);
    overflow: hidden;
    margin-bottom: 12px;
}

.isslop-progress-bar {
    height: 100%;
    width: 0;
    background: var(--accent-gradient);
    transition: width 0.3s ease;
}

.isslop-progress-failed {
    background: var(--danger);
}

.isslop-feed {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 420px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.88rem;
}

.isslop-feed-item {
    display: flex;
    gap: 8px;
    padding: 4px 6px;
    border-radius: 6px;
    color: var(--text-secondary);
}

.isslop-feed-stage,
.isslop-feed-score {
    color: var(--text-primary);
    font-weight: 600;
    background: var(--bg-secondary);
}

.isslop-feed-signal { color: var(--warning); }
.isslop-feed-error { color: var(--danger); }
.isslop-feed-done { color: var(--success); }

.isslop-feed-loader {
    align-items: center;
    color: var(--text-muted);
    font-family: monospace;
}

.isslop-loader-cursor {
    display: inline-block;
    width: 8px;
    height: 14px;
    background: var(--accent);
    animation: isslop-blink 1s steps(2, start) infinite;
}

.isslop-loader-text::after {
    content: "";
    animation: isslop-dots 1.8s steps(4, end) infinite;
}

@keyframes isslop-blink {
    to {
        visibility: hidden;
    }
}

@keyframes isslop-dots {
    0% { content: ""; }
    25% { content: "."; }
    50% { content: ".."; }
    75% { content: "..."; }
}

.isslop-grade-pending {
    animation: isslop-pulse 1.6s ease-in-out infinite;
}

@keyframes isslop-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

.isslop-feed-icon {
    flex-shrink: 0;
}

.isslop-feed-text {
    word-break: break-word;
}

.isslop-score-card {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.isslop-gauge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 108px;
    height: 108px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 4px solid var(--text-muted);
    flex-shrink: 0;
}

.isslop-gauge.isslop-grade-a { border-color: var(--isslop-ok); background: var(--bg-secondary); }
.isslop-gauge.isslop-grade-b { border-color: var(--isslop-fair); background: var(--bg-secondary); }
.isslop-gauge.isslop-grade-c { border-color: var(--isslop-warn); background: var(--bg-secondary); color: var(--text-primary); }
.isslop-gauge.isslop-grade-d { border-color: var(--isslop-high); background: var(--bg-secondary); }
.isslop-gauge.isslop-grade-f { border-color: var(--isslop-crit); background: var(--bg-secondary); }

.isslop-gauge-grade {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
}

.isslop-gauge-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.isslop-score-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.isslop-score-meta h2 {
    margin: 0;
    font-size: 1.15rem;
    word-break: break-all;
    color: var(--text-primary);
}

.isslop-split {
    display: flex;
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
    max-width: 420px;
    background: var(--bg-secondary);
}

.isslop-split-human {
    background: var(--success);
}

.isslop-split-ai {
    background: var(--danger);
}

.isslop-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.isslop-chip {
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.isslop-chip-builder {
    border-color: rgba(var(--isslop-crit-rgb), 0.6);
    background: rgba(var(--isslop-crit-rgb), 0.85);
    color: var(--text-primary);
    font-weight: 600;
}

.isslop-section-title {
    margin: 0 0 12px;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.isslop-report-body .rendered-content {
    color: var(--text-secondary);
}

.isslop-table-wrap {
    overflow-x: auto;
}

.isslop-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.isslop-table th,
.isslop-table td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    white-space: nowrap;
}

.isslop-table td:first-child {
    white-space: normal;
    word-break: break-all;
    color: var(--text-primary);
}

.isslop-signal-chip {
    display: inline-block;
    margin: 1px 3px 1px 0;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.isslop-signal-strong {
    border-color: rgba(var(--isslop-crit-rgb), 0.55);
    color: var(--isslop-crit-text);
    background: rgba(var(--isslop-crit-rgb), 0.12);
}

.isslop-signal-medium {
    border-color: rgba(var(--isslop-high-rgb), 0.5);
    color: var(--isslop-high-text);
    background: rgba(var(--isslop-high-rgb), 0.1);
}

.isslop-signal-weak {
    border-color: var(--border);
    color: var(--text-muted);
}

.isslop-signal-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    margin-left: 5px;
    padding: 0 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: inherit;
    font-size: 0.68rem;
    font-weight: 700;
    vertical-align: 1px;
}

.isslop-metric {
    display: inline-block;
    min-width: 44px;
    padding: 2px 9px;
    border-radius: 999px;
    text-align: center;
    font-weight: 700;
    font-size: 0.8rem;
}

.isslop-metric-ok {
    background: rgba(var(--isslop-ok-rgb), 0.16);
    color: var(--isslop-ok-text);
}

.isslop-metric-warn {
    background: rgba(var(--isslop-warn-rgb), 0.16);
    color: var(--isslop-warn-text);
}

.isslop-metric-high {
    background: rgba(var(--isslop-high-rgb), 0.18);
    color: var(--isslop-high-text);
}

.isslop-metric-critical {
    background: rgba(var(--isslop-crit-rgb), 0.18);
    color: var(--isslop-crit-text);
}

.isslop-cat {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.isslop-cat-human-clean {
    border-color: rgba(var(--isslop-ok-rgb), 0.5);
    background: rgba(var(--isslop-ok-rgb), 0.14);
    color: var(--isslop-ok-text);
}

.isslop-cat-human-messy {
    border-color: rgba(var(--isslop-warn-rgb), 0.5);
    background: rgba(var(--isslop-warn-rgb), 0.12);
    color: var(--isslop-warn-text);
}

.isslop-cat-sophisticated-ai {
    border-color: rgba(var(--isslop-high-rgb), 0.5);
    background: rgba(var(--isslop-high-rgb), 0.14);
    color: var(--isslop-high-text);
}

.isslop-cat-ai-slop {
    border-color: rgba(var(--isslop-crit-rgb), 0.5);
    background: rgba(var(--isslop-crit-rgb), 0.16);
    color: var(--isslop-crit-text);
}

.isslop-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.isslop-image-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.isslop-image-thumb-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 150px;
    margin: -12px -12px 6px;
    padding: 10px;
    background:
        linear-gradient(45deg, rgba(255, 255, 255, 0.04) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.04) 75%),
        linear-gradient(45deg, rgba(255, 255, 255, 0.04) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.04) 75%),
        var(--bg-primary);
    background-size: 16px 16px, 16px 16px;
    background-position: 0 0, 8px 8px;
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
    overflow: hidden;
}

.isslop-image-thumb {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    cursor: zoom-in;
}

.isslop-feed-thumb {
    height: 28px;
    max-width: 72px;
    width: auto;
    object-fit: contain;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--bg-primary);
    flex-shrink: 0;
    align-self: center;
}

.isslop-image-head {
    display: flex;
    align-items: center;
    gap: 8px;
}

.isslop-image-kind {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
}

.isslop-image-path {
    color: var(--text-muted);
    font-size: 0.78rem;
    word-break: break-all;
}

.isslop-page-url {
    margin: 0;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    word-break: break-all;
}

.isslop-image-desc {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.isslop-badge-preview {
    margin-bottom: 12px;
}

.isslop-snippet {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.isslop-snippet code {
    flex: 1;
    padding: 8px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.78rem;
    overflow-x: auto;
    white-space: nowrap;
    color: var(--text-secondary);
}

.isslop-report-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.isslop-empty {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    color: var(--text-secondary);
}

@media (max-width: 1024px) {
    .isslop-layout {
        grid-template-columns: 1fr;
    }
}

.isslop-source-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 8px;
}

.isslop-source-scroll {
    overflow-x: auto;
}

.isslop-source {
    width: 100%;
    border-collapse: collapse;
    font-family: monospace;
    font-size: 0.82rem;
    line-height: 1.55;
}

.isslop-source-num {
    width: 1%;
    min-width: 44px;
    padding: 0 12px 0 8px;
    text-align: right;
    color: var(--text-muted);
    user-select: none;
    vertical-align: top;
}

.isslop-source-num a {
    color: inherit;
    text-decoration: none;
}

.isslop-source-num a:hover {
    color: var(--accent);
}

.isslop-source-code {
    padding: 0 12px;
    color: var(--text-secondary);
    white-space: pre;
}

.isslop-source-hit .isslop-source-code {
    background: rgba(var(--isslop-high-rgb), 0.08);
    border-left: 3px solid var(--warning);
    color: var(--text-primary);
}

.isslop-source-focus .isslop-source-code {
    background: rgba(var(--accent-rgb), 0.14);
    border-left: 3px solid var(--accent);
}

.isslop-source-line {
    scroll-margin-top: 90px;
}

.isslop-source-annotation {
    padding: 6px 12px 2px;
}

.isslop-source-annotation .isslop-signal-chip {
    white-space: normal;
}

.isslop-source-link {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: var(--border-light);
    text-underline-offset: 3px;
}

.isslop-source-link:hover {
    color: var(--accent);
}

a.isslop-signal-chip {
    text-decoration: none;
    cursor: pointer;
}

a.isslop-signal-chip:hover {
    border-color: var(--accent);
}

.isslop-source-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
}

.isslop-side-list {
    list-style: none;
    padding-left: 4px;
}

.isslop-side-list li::before {
    content: "🔹 ";
    font-size: 0.7rem;
}

.isslop-report-body .rendered-content ul {
    list-style: none;
    padding-left: 8px;
}

.isslop-report-body .rendered-content ul > li::before {
    content: "🔸 ";
    font-size: 0.75rem;
}

.isslop-report-body .rendered-content ol > li::marker {
    color: var(--accent);
    font-weight: 600;
}
