/* ══════════════════════════════════
   ENTITIES PAGE
   ══════════════════════════════════ */

/* ── Shared panel structure ── */

.en-explorer-panel,
.en-coverage-panel,
.en-pairs-panel {
    margin-bottom: 28px;
    padding: 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    animation: en-panel-in 0.5s ease both;
}

.en-explorer-panel  { animation-delay: 0.05s; }
.en-coverage-panel  { animation-delay: 0.15s; }
.en-pairs-panel     { animation-delay: 0.25s; }

@keyframes en-panel-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.en-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 12px;
}

.en-title-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.en-icon-bar {
    width: 3px;
    height: 40px;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--accent), var(--cyan));
    flex-shrink: 0;
    margin-top: 2px;
}

.en-icon-bar-coverage {
    background: linear-gradient(180deg, #FFB87A, #5EDBA0);
}

.en-icon-bar-pairs {
    background: linear-gradient(180deg, #B8A8FF, #60CCFF);
}

.en-panel-title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -.02em;
    margin-bottom: 4px;
}

.en-panel-sub {
    font-size: .72rem;
    color: rgba(255, 255, 255, 0.45);
    letter-spacing: .03em;
    line-height: 1.4;
    max-width: 600px;
}

/* ══════════════════════════════════
   SECTION 1: ENTITY EXPLORER
   ══════════════════════════════════ */

/* ── Controls bar: category tabs + search ── */

.en-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.en-cat-tabs {
    display: flex;
    gap: 2px;
    background: rgba(10, 18, 30, .8);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 3px;
}

.en-cat-tab {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: .65rem;
    font-weight: 500;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    transition: all .2s ease;
}

.en-cat-tab:hover {
    color: var(--text-secondary);
}

.en-cat-tab.active {
    background: rgba(59, 123, 255, .12);
    color: var(--accent);
    border: 1px solid rgba(59, 123, 255, .2);
}

.en-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 12px;
    min-width: 200px;
}

.en-search-icon {
    font-size: .85rem;
    color: var(--text-muted);
}

.en-search-input {
    background: none;
    border: none;
    outline: none;
    font-family: var(--font-base);
    font-size: .78rem;
    color: var(--text-primary);
    width: 100%;
}

.en-search-input::placeholder {
    color: var(--text-muted);
}

/* ── Explorer two-column body ── */

.en-explorer-body {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 16px;
    min-height: 400px;
}

/* ── Entity list (left column) ── */

.en-entity-list {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow-y: auto;
    max-height: 480px;
}

.en-entity-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: background .15s;
    gap: 10px;
}

.en-entity-item:last-child {
    border-bottom: none;
}

.en-entity-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.en-entity-item.active {
    background: rgba(59, 123, 255, 0.08);
    border-left: 2px solid var(--accent);
}

.en-entity-rank {
    font-family: var(--font-mono);
    font-size: .55rem;
    color: var(--text-muted);
    min-width: 18px;
    text-align: right;
}

.en-entity-name {
    font-size: .8rem;
    color: rgba(255, 255, 255, 0.85);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.en-entity-item.active .en-entity-name {
    color: var(--text-primary);
}

.en-entity-bar-mini-wrap {
    flex: 1;
    height: 3px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 2px;
    overflow: hidden;
    max-width: 60px;
}

.en-entity-bar-mini {
    height: 100%;
    border-radius: 2px;
    background: rgba(59, 123, 255, 0.5);
    transition: width 0.4s ease;
}

.en-entity-count-badge {
    font-family: var(--font-mono);
    font-size: .6rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.04);
    padding: 2px 6px;
    border-radius: 3px;
    flex-shrink: 0;
}

.en-entity-item.active .en-entity-count-badge {
    color: var(--accent);
    background: rgba(59, 123, 255, 0.1);
}

/* ── Entity profile (right column) ── */

.en-profile-placeholder {
    font-size: .85rem;
    color: var(--text-muted);
    text-align: center;
    padding: 80px 20px;
    font-style: italic;
}

.en-profile-inner {
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: en-fade-in 0.3s ease both;
}

@keyframes en-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Profile header */
.en-profile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.en-profile-name {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.en-profile-kpis {
    display: flex;
    gap: 18px;
}

.en-kpi {
    text-align: center;
}

.en-kpi-value {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.en-kpi-label {
    font-family: var(--font-mono);
    font-size: .5rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--text-muted);
    margin-top: 1px;
}

/* Profile sub-cards grid */
.en-profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.en-sub-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
}

.en-sub-card-full {
    grid-column: 1 / -1;
}

.en-sub-title {
    font-family: var(--font-mono);
    font-size: .55rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255, 255, 255, 0.35);
    margin-bottom: 10px;
}

/* Profile timeline */
.en-timeline-wrap {
    height: 110px;
    position: relative;
}

.en-timeline-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Theme breakdown bars */
.en-theme-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

.en-theme-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.en-theme-name {
    font-size: .72rem;
    color: rgba(255, 255, 255, 0.75);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.en-theme-bar-wrap {
    width: 60px;
    height: 4px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 2px;
    overflow: hidden;
}

.en-theme-bar {
    height: 100%;
    border-radius: 2px;
    transition: width 0.4s ease;
}

.en-theme-pct {
    font-family: var(--font-mono);
    font-size: .6rem;
    color: var(--text-muted);
    min-width: 32px;
    text-align: right;
}

/* Source breakdown bars */
.en-source-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

.en-source-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.en-source-dot.official   { background: #4A9E78; }
.en-source-dot.think_tank { background: #B56060; }

.en-source-name-small {
    font-size: .72rem;
    color: rgba(255, 255, 255, 0.75);
    min-width: 80px;
}

.en-source-bar-wrap {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 2px;
    overflow: hidden;
}

.en-source-bar-fill {
    height: 100%;
    border-radius: 2px;
    background: rgba(59, 123, 255, 0.5);
    transition: width 0.4s ease;
}

.en-source-count-small {
    font-family: var(--font-mono);
    font-size: .6rem;
    color: var(--text-muted);
    min-width: 28px;
    text-align: right;
}

/* ══════════════════════════════════
   SECTION 2: COVERAGE MATRIX
   ══════════════════════════════════ */

.en-coverage-cat-tabs {
    display: flex;
    gap: 2px;
    background: rgba(10, 18, 30, .8);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 3px;
}

.en-cov-tab {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: .6rem;
    font-weight: 500;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all .2s ease;
}

.en-cov-tab:hover { color: var(--text-secondary); }

.en-cov-tab.active {
    background: rgba(59, 123, 255, .12);
    color: var(--accent);
    border: 1px solid rgba(59, 123, 255, .2);
}

.en-coverage-wrap {
    overflow-x: auto;
}

/* Coverage table */
.en-cov-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 2px;
}

.en-cov-table th {
    font-family: var(--font-mono);
    font-size: .6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255, 255, 255, 0.45);
    padding: 6px 10px;
    text-align: center;
    white-space: nowrap;
}

.en-cov-table th.en-cov-entity-hd {
    text-align: left;
    min-width: 160px;
}

.en-cov-row {
    transition: background .15s;
}

.en-cov-row:hover td {
    background: rgba(255, 255, 255, 0.025) !important;
}

.en-cov-entity-cell {
    font-size: .78rem;
    color: rgba(255, 255, 255, 0.8);
    padding: 7px 10px;
    background: var(--surface);
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.en-cov-data-cell {
    text-align: center;
    padding: 4px 3px;
}

.en-cov-cell-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    height: 32px;
    min-width: 44px;
    font-family: var(--font-mono);
    font-size: .7rem;
    font-weight: 600;
    transition: filter .15s;
}

.en-cov-cell-inner:hover {
    filter: brightness(1.3);
}

.en-cov-cell-zero {
    color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.02);
}

/* ══════════════════════════════════
   SECTION 3: ENTITY PAIRS
   ══════════════════════════════════ */

.en-pairs-body {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.en-pair-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: border-color .2s, background .2s;
    animation: en-pair-in 0.4s ease both;
}

.en-pair-item:nth-child(1)  { animation-delay: 0.02s; }
.en-pair-item:nth-child(2)  { animation-delay: 0.04s; }
.en-pair-item:nth-child(3)  { animation-delay: 0.06s; }
.en-pair-item:nth-child(4)  { animation-delay: 0.08s; }
.en-pair-item:nth-child(5)  { animation-delay: 0.10s; }
.en-pair-item:nth-child(6)  { animation-delay: 0.12s; }
.en-pair-item:nth-child(7)  { animation-delay: 0.14s; }
.en-pair-item:nth-child(8)  { animation-delay: 0.16s; }
.en-pair-item:nth-child(9)  { animation-delay: 0.18s; }
.en-pair-item:nth-child(10) { animation-delay: 0.20s; }

@keyframes en-pair-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.en-pair-item:hover {
    border-color: rgba(255, 255, 255, 0.12);
    background: var(--surface-hover);
}

.en-pair-rank {
    font-family: var(--font-mono);
    font-size: .65rem;
    color: var(--text-muted);
    min-width: 18px;
    text-align: right;
}

.en-pair-entities {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
}

.en-pair-name {
    font-size: .8rem;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.en-pair-sep {
    font-size: .7rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.en-pair-cats {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.en-pair-cat-badge {
    font-family: var(--font-mono);
    font-size: .48rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 2px 5px;
    border-radius: 3px;
    background: rgba(59, 123, 255, 0.08);
    color: rgba(59, 123, 255, 0.7);
    border: 1px solid rgba(59, 123, 255, 0.15);
}

.en-pair-count {
    font-family: var(--font-mono);
    font-size: .8rem;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 32px;
    text-align: right;
    flex-shrink: 0;
}

.en-pair-bar-wrap {
    width: 60px;
    height: 3px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 2px;
    overflow: hidden;
    flex-shrink: 0;
}

.en-pair-bar {
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--accent), var(--cyan));
    transition: width 0.5s ease;
}
