/* EverGrow Crawler Results v2 */

.cr2 { margin-top: 1rem; }
.cr2-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.cr2-header h2 { font-size: 1.4rem; font-weight: 700; }

/* Tabs */
.cr2-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1.25rem;
    overflow-x: auto;
}
.cr2-tab {
    padding: 0.6rem 1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}
.cr2-tab:hover {
    color: var(--text);
    background: var(--accent-subtle);
    border-radius: 6px 6px 0 0;
}
.cr2-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 600;
}
.cr2-tab.active:hover { background: none; }

/* Metrics Grid */
.cr2-metrics {
    display: grid;
    grid-template-columns: 1.5fr repeat(5, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.cr2-metric-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.cr2-metric-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-subtle);
}
.cr2-health {
    flex-direction: row;
    gap: 1rem;
    align-items: center;
    justify-content: flex-start;
    padding-left: 1.25rem;
}
.cr2-metric-big {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.1;
}
.cr2-metric-title {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 0.25rem;
}
.cr2-metric-sub { font-size: 0.78rem; color: var(--text-muted); }
.cr2-metric-info { text-align: left; }

/* Donut Chart */
.cr2-donut {
    position: relative;
    width: 72px;
    height: 72px;
    flex-shrink: 0;
}
.cr2-donut svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.cr2-donut-bg { stroke: var(--border); }
.cr2-donut-fg { transition: stroke-dasharray 0.6s ease; }
.cr2-donut.score-good .cr2-donut-fg { stroke: var(--green); }
.cr2-donut.score-avg .cr2-donut-fg { stroke: var(--yellow); }
.cr2-donut.score-bad .cr2-donut-fg { stroke: var(--red); }
.cr2-donut-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 800;
}

/* Cards Row */
.cr2-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.cr2-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    transition: border-color 0.2s;
}
.cr2-card:hover { border-color: var(--accent-subtle); }
.cr2-card-wide { grid-column: span 1; }
.cr2-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text);
}

/* Bar charts */
.cr2-bar-wrap {
    flex: 1;
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
}
.cr2-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
    min-width: 2px;
}
.cr2-issue-row, .cr2-status-row, .cr2-top-issue, .cr2-depth-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.4rem;
}
.cr2-issue-label { font-size: 0.85rem; font-weight: 600; width: 60px; }
.cr2-issue-count { font-size: 0.85rem; color: var(--text-muted); min-width: 55px; text-align: right; }
.cr2-issue-code { font-size: 0.82rem; font-weight: 500; min-width: 160px; color: var(--text); }
.cr2-status-code { font-size: 0.9rem; font-weight: 700; min-width: 40px; }
.cr2-depth-label { font-size: 0.85rem; min-width: 60px; color: var(--text-muted); }

/* Schema list */
.cr2-schema-list { display: flex; flex-direction: column; gap: 0.25rem; }
.cr2-schema-row { display: flex; justify-content: space-between; font-size: 0.8rem; }
.cr2-schema-count { color: var(--text-muted); font-weight: 600; }

/* Duplicates */
.cr2-dup { padding: 0.4rem 0; border-bottom: 1px solid var(--border); }
.cr2-dup-url { font-size: 0.75rem; color: var(--text-muted); }

/* Tab Tables */
.cr2-tab-header { margin-bottom: 1rem; }
.cr2-tab-header h3 { font-size: 1.1rem; font-weight: 600; }
.cr2-table-wrap { overflow-x: auto; }
.cr2-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
/* ── Search ── */
.cr2-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.cr2-search input {
    flex: 1;
    padding: 0.6rem 0.85rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.15s;
}
.cr2-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-subtle); }
.cr2-search-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: color 0.15s;
    line-height: 1;
}
.cr2-search-clear:hover { color: var(--text); }
.cr2-search-count { font-size: 0.85rem; color: var(--text-muted); white-space: nowrap; }
.cr2-no-results {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* External link icon */
.cr2-ext-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-decoration: none;
    flex-shrink: 0;
    transition: all 0.15s;
    vertical-align: middle;
    margin-left: 0.35rem;
}
.cr2-ext-link:hover {
    color: var(--accent);
    background: var(--accent-subtle);
}

/* Tab summary bar */
.cr2-tab-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.875rem;
}
.cr2-tab-stat {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.cr2-tab-stat-value {
    font-weight: 700;
}
.cr2-tab-stat-label {
    color: var(--text-muted);
}

/* Issue groups (collapsible) */
.cr2-issue-group {
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}
.cr2-issue-group-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    background: var(--surface);
    cursor: pointer;
    transition: background 0.15s;
    -webkit-user-select: none;
    user-select: none;
}
.cr2-issue-group-header:hover { background: var(--surface-raised); }
.cr2-issue-group-arrow {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.2s;
    width: 1rem;
    text-align: center;
}
.cr2-issue-group.open .cr2-issue-group-arrow { transform: rotate(90deg); }
.cr2-issue-group-code {
    font-weight: 600;
    font-size: 0.875rem;
}
.cr2-issue-group-count {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}
.cr2-issue-group-body {
    display: none;
    border-top: 1px solid var(--border);
}
.cr2-issue-group.open .cr2-issue-group-body { display: block; }
.cr2-issue-group-body .cr2-table { font-size: 0.85rem; }
.cr2-issue-group-body .cr2-table thead { display: none; }

/* Crawl path tree */
.cr2-tree-line {
    color: var(--border);
    font-family: monospace;
    white-space: pre;
    -webkit-user-select: none;
    user-select: none;
}
.cr2-tree-connector {
    display: inline-block;
    color: var(--text-muted);
    opacity: 0.5;
}

/* Clickable URL rows in all tabs */
.cr2-table tbody tr.cr2-clickable { cursor: pointer; }
.cr2-table tbody tr.cr2-clickable:hover { background: rgba(0,180,216,0.08); }
.cr2-detail-row { background: var(--surface); }
.cr2-detail-row td { padding: 0 !important; }
.cr2-detail-inner {
    padding: 1rem 1.25rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
.cr2-detail-section strong {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.25rem;
}
.cr2-detail-value {
    font-size: 0.875rem;
    line-height: 1.5;
}
.cr2-detail-issues { grid-column: 1 / -1; }
.cr2-detail-issues ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.cr2-detail-issues li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.cr2-sortable { cursor: pointer; -webkit-user-select: none; user-select: none; }
.cr2-sortable:hover { color: var(--accent); }
.cr2-sort-icon { font-size: 0.65rem; opacity: 0.4; margin-left: 0.2rem; }
.cr2-sortable:hover .cr2-sort-icon { opacity: 1; }

.cr2-table thead th {
    background: var(--surface);
    padding: 0.65rem 0.85rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.cr2-table tbody td {
    padding: 0.6rem 0.85rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    line-height: 1.5;
}
.cr2-table tbody tr { transition: background 0.15s; }
.cr2-table tbody tr:hover { background: rgba(0,180,216,0.08); }
.cr2-url-cell {
    max-width: 400px;
    min-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--accent);
    position: relative;
    cursor: default;
}
.cr2-url-cell[title]:hover::after {
    content: attr(title);
    position: absolute;
    left: 0;
    top: 100%;
    z-index: 20;
    background: var(--surface-raised);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
    white-space: nowrap;
    max-width: 500px;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    pointer-events: none;
}
.cr2-meta-cell {
    max-width: 450px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    position: relative;
    cursor: default;
}
.cr2-meta-cell[title]:hover::after {
    content: attr(title);
    position: absolute;
    left: 0;
    top: 100%;
    z-index: 20;
    background: var(--surface-raised);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
    white-space: normal;
    max-width: 400px;
    word-break: break-word;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    pointer-events: none;
}

/* ── Admin Panel ── */
.admin-section { margin-top: 1rem; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.admin-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    padding: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 1rem;
}
.admin-input {
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 0.85rem;
}
.admin-input:focus { border-color: var(--accent); outline: none; }
.admin-delete-btn {
    padding: 0.2rem 0.5rem;
    border: 1px solid var(--red);
    background: none;
    color: var(--red);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
}
.admin-delete-btn:hover { background: rgba(239,68,68,0.1); }
.admin-config { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.85rem; }

/* Responsive */
@media (max-width: 900px) {
    .cr2-metrics { grid-template-columns: repeat(3, 1fr); }
    .cr2-row { grid-template-columns: 1fr; }
    .cr2-tabs { gap: 0; }
}
