/* public/admin/styles/integrity.css
   Relationship Integrity Viewer — Section D
   Builds on admin.css.
*/

/* ── Tab bar ──────────────────────────────────────────────────────────────── */
.int-tabs {
    display: flex;
    gap: 0;
    background: #fff;
    border-bottom: 2px solid #e5e7eb;
    flex-shrink: 0;
    padding: 0 24px;
}
.int-tab {
    padding: 11px 20px;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 500;
    color: #57606a;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.int-tab:hover  { color: #1f2328; }
.int-tab.active { color: #3b82d4; border-bottom-color: #3b82d4; font-weight: 600; }

/* ── Main area ────────────────────────────────────────────────────────────── */
.int-main { padding: 20px 28px; overflow-y: auto; }

/* ── Panels ───────────────────────────────────────────────────────────────── */
.int-panel { display: none; }
.int-panel.active { display: block; }

/* ── Panel toolbar ────────────────────────────────────────────────────────── */
.int-panel-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 16px;
    flex-wrap: wrap;
}
.int-panel-info { font-size: 13px; color: #57606a; }

/* ── Filter row (DI2) ─────────────────────────────────────────────────────── */
.int-filter-row {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}
.int-filter-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #1f2328;
    cursor: pointer;
    user-select: none;
}
.int-filter-check input { cursor: pointer; }

/* ── Loading ──────────────────────────────────────────────────────────────── */
.int-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 32px 0;
    color: #57606a;
    font-size: 13px;
}
.int-spinner {
    width: 20px; height: 20px;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82d4;
    border-radius: 50%;
    animation: int-spin 0.7s linear infinite;
    flex-shrink: 0;
}
@keyframes int-spin { to { transform: rotate(360deg); } }

/* ── Empty / count ────────────────────────────────────────────────────────── */
.int-empty {
    color: #16a34a;
    font-weight: 500;
    font-size: 13px;
    padding: 24px 0;
}
.int-count {
    font-size: 12px;
    color: #57606a;
    margin-bottom: 10px;
}

/* ── Tables ───────────────────────────────────────────────────────────────── */
.int-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    margin-top: 8px;
}
.int-table th {
    text-align: left;
    padding: 6px 10px;
    border-bottom: 2px solid #e5e7eb;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #57606a;
    background: #f7f8fa;
    white-space: nowrap;
}
.int-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #f0f1f3;
    vertical-align: middle;
}
.int-table tr:last-child td { border-bottom: none; }
.int-table tr:hover td { background: #fafbfc; }

.int-person-link {
    color: #3b82d4;
    text-decoration: none;
    font-weight: 500;
}
.int-person-link:hover { text-decoration: underline; }

/* ── Flags (DI2) ──────────────────────────────────────────────────────────── */
.int-flag {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 3px;
    margin-right: 3px;
    white-space: nowrap;
}
.int-flag-warn { background: #fef9c3; color: #854d0e; }
.int-flag-info { background: #dbeafe; color: #1e40af; }

/* ── DI1: Component cards ─────────────────────────────────────────────────── */
.comp-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 18px;
}
.comp-stat-card {
    background: #f7f8fa;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 14px 16px;
    text-align: center;
}
.comp-stat-card.comp-stat-warn { background: #fff7ed; border-color: #fed7aa; }
.comp-stat-num   { font-size: 28px; font-weight: 800; color: #3b82d4; }
.comp-stat-warn .comp-stat-num { color: #9a3412; }
.comp-stat-label { font-size: 12px; color: #57606a; margin-top: 2px; }

.comp-list { display: flex; flex-direction: column; gap: 8px; }

.comp-card {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
}
.comp-card-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    cursor: pointer;
    list-style: none;
    background: #fafbfc;
    user-select: none;
}
.comp-card-summary::-webkit-details-marker { display: none; }
.comp-card-num  { font-weight: 700; font-size: 12px; color: #57606a; min-width: 28px; }
.comp-card-size { font-size: 13px; font-weight: 600; flex: 1; }

.comp-tag {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
}
.comp-tag-isolated { background: #fee2e2; color: #991b1b; }
.comp-tag-large    { background: #dcfce7; color: #166534; }

.comp-card-body { padding: 10px 14px 12px; border-top: 1px solid #e5e7eb; }
.comp-members { display: flex; flex-wrap: wrap; gap: 6px; }
.comp-member { font-size: 12.5px; }

.comp-more { margin-top: 8px; }
.comp-more-toggle {
    font-size: 12px;
    color: #3b82d4;
    cursor: pointer;
    list-style: none;
    padding: 2px 0;
}
.comp-more-toggle::-webkit-details-marker { display: none; }

/* ── DI4: Person Graph ────────────────────────────────────────────────────── */
.int-search-row {
    position: relative;
    width: 300px;
    flex-shrink: 0;
}
.int-search-input {
    width: 100%;
    padding: 7px 12px;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    font-size: 13px;
    outline: none;
    background: #fff;
}
.int-search-input:focus { border-color: #3b82d4; }

.int-search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 100;
    max-height: 240px;
    overflow-y: auto;
}
.int-search-item {
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.int-search-item:hover { background: #f7f8fa; }
.int-si-name { font-size: 13px; font-weight: 500; }
.int-si-meta { font-size: 11px; color: #57606a; }

.int-graph-legend {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.leg-item {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.leg-item::before {
    content: '';
    display: inline-block;
    width: 24px;
    height: 14px;
    border-radius: 3px;
    border: 1.5px solid #d1d5db;
}
.leg-root::before       { background: #eff6ff; border-color: #3b82d4; }
.leg-ancestor::before   { background: #f0fdf4; border-color: #d1d5db; }
.leg-descendant::before { background: #faf5ff; border-color: #d1d5db; }
.leg-issue::before      { background: #fef2f2; border-color: #f87171; }

#graph-container {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fafbfc;
    overflow: hidden;
    height: 520px;
}
#graph-svg { width: 100%; height: 100%; display: block; }

.graph-tooltip {
    position: fixed;
    background: rgba(31,35,40,0.92);
    color: #fff;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 5px;
    pointer-events: none;
    z-index: 9000;
    max-width: 260px;
    line-height: 1.5;
}
