/* ============================================================
   .uk-bgp-table — unified canonical BGP routing table (loaded only on /docs/ui-kit)
   ============================================================
   Replaces the legacy declaration in location-detail.css:
     .bgp-summary-section + .bgp-summary + .bgp-counter (+ value/label)
     .bgp-table-section + -title + -count + -note + -wrapper
     .bgp-table + thead + th + td + tbody hover
     .col-asn / .col-name / .col-power / .col-proto    (column widths)
     .asn-cell / .name-cell                            (cell helpers)
     .power-cell + .power-bar-wrapper + .power-bar + .power-value
                                                       (lifted to .bar-cell
                                                        in tables.css)
     .proto-cell + .proto-yes / .proto-no              (tone-coded text)
     .bgp-row-hidden + .bgp-expand-btn                 (row toggle pattern)
     .bgp-empty                                        (empty state)

   Specialised data table — by design, not folded into .uk-table.
   But it COMPOSES with the .uk-table + .uk-table-wrap chassis: thead,
   tbody, hover row, padding inherit from there. This file adds only the
   BGP-specific widths, cell helpers, summary counters, and the row toggle.

   Power-bar visualisation moved to .bar-cell (tables.css) — same primitive
   serves the IP latency table next.

   Slots:
     .uk-bgp-table-summary          counter strip above the tables
       .uk-bgp-table-counter
         .uk-bgp-table-counter-value
         .uk-bgp-table-counter-label
     .uk-bgp-table-section          one named table block
       .uk-bgp-table-title
         .uk-bgp-table-count        muted "(N)" suffix
       .uk-bgp-table-note           italic muted note line
       .uk-table-wrap               (chassis from tables.css)
         <table class="uk-table uk-bgp-table"> (chassis + this file's column widths)
         .uk-bgp-table-expand       full-width row-toggle button
     .uk-bgp-table-empty            empty-state card
   ============================================================ */

/* ---------- Summary counters — unified metric strip ---------- */
/* One bordered surface, three stat cells inside divided by hairline rules.
   Typography matches the brand canon for metric callouts (.uk-hero-stat
   in hero.css): big mono value, --line-tight, -0.02em letter-spacing,
   tabular-nums; uppercase tracked muted label under. Reads as one coherent
   summary, not three independent boxes. */
.uk-bgp-table-summary {
    display: flex;
    align-items: stretch;
    flex-wrap: wrap;
    gap: 0;
    margin-bottom: var(--space-xl);
    padding: var(--space-lg) var(--space-md);
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    transition: border-color var(--transition-base);
}

.uk-bgp-table-summary:hover {
    border-color: rgba(var(--color-primary-rgb), 0.25);
}

.uk-bgp-table-counter {
    flex: 1 1 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: 0;
    border-radius: 0;
    position: relative;
    text-align: center;
}

/* Hairline divider between adjacent cells; first cell has no leading rule. */
.uk-bgp-table-counter + .uk-bgp-table-counter::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 70%;
    background: var(--color-border);
}

.uk-bgp-table-counter-value {
    display: block;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--color-text);
    font-size: var(--font-4xl);
    line-height: var(--line-tight);
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.uk-bgp-table-counter-label {
    color: var(--color-text-muted);
    font-size: var(--font-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

@media (max-width: 540px) {
    .uk-bgp-table-counter + .uk-bgp-table-counter::before {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .uk-bgp-table-summary {
        transition: none;
    }
}

/* ---------- Section — card container with header + table ---------- */
.uk-bgp-table-section {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    margin: 0 0 var(--space-lg);
}

.uk-bgp-table-section:last-of-type {
    margin-bottom: 0;
}

.uk-bgp-table-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
    font-size: var(--font-lg);
    font-weight: 600;
    color: var(--color-text);
    line-height: var(--line-snug);
    margin: 0;
    padding: var(--space-lg) var(--space-lg) var(--space-md);
}

/* Drop title's bottom padding when followed by a note — note carries the gap. */
.uk-bgp-table-title:has(+ .uk-bgp-table-note) {
    padding-bottom: 4px;
}

.uk-bgp-table-count {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    background: rgba(var(--color-primary-rgb), 0.12);
    border: 1px solid rgba(var(--color-primary-rgb), 0.2);
    color: var(--color-primary-light);
    font-family: var(--font-mono);
    font-size: var(--font-xs);
    font-weight: 600;
    line-height: 1.4;
    margin-left: 0;
}

.uk-bgp-table-note {
    color: var(--color-text-muted);
    font-size: var(--font-sm);
    line-height: var(--line-relaxed);
    margin: 0;
    padding: 0 var(--space-lg) var(--space-md);
    font-style: normal;
}

/* The uk-table-wrap inside the section sits flush — no double frame.
   We override the wrap's own border + radius so it bonds to the section
   card and shares its top hairline with the header. */
.uk-bgp-table-section > .uk-table-wrap {
    margin: 0;
    background: transparent;
    border: 0;
    border-top: 1px solid var(--color-border);
    border-radius: 0;
}

/* ---------- Table column widths (composed with .uk-table chassis) ---------- */
.uk-bgp-table .uk-bgp-table-col--asn   { width: 120px; }
.uk-bgp-table .uk-bgp-table-col--name  { width: auto; }
.uk-bgp-table .uk-bgp-table-col--bar   { width: 220px; }
.uk-bgp-table .uk-bgp-table-col--proto { width: 96px; text-align: center; }

/* ---------- Cell helpers ---------- */
.uk-bgp-table-asn {
    font-family: var(--font-mono);
    font-weight: 500;
    color: var(--color-primary-light);
    font-size: var(--font-sm);
    letter-spacing: 0.02em;
}

.uk-bgp-table-name {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--color-text);
}

.uk-bgp-table-proto-yes {
    color: var(--color-success);
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: var(--font-sm);
}

.uk-bgp-table-proto-no {
    color: var(--color-text-muted);
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: var(--font-sm);
    opacity: 0.45;
}

/* ---------- Row toggle ---------- */
.uk-bgp-table-row-hidden {
    display: none;
}

.uk-bgp-table-section.is-expanded .uk-bgp-table-row-hidden {
    display: table-row;
}

.uk-bgp-table-expand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: 0;
    border-top: 1px solid var(--color-border);
    color: var(--color-primary-light);
    font-family: inherit;
    font-size: var(--font-sm);
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.uk-bgp-table-expand::after {
    content: '';
    width: 8px;
    height: 8px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
    transition: transform var(--transition-fast);
}

.uk-bgp-table-section.is-expanded .uk-bgp-table-expand::after {
    transform: translateY(2px) rotate(-135deg);
}

.uk-bgp-table-expand:hover {
    background: rgba(var(--color-primary-rgb), 0.06);
    color: var(--color-primary);
}

/* ---------- Empty state ---------- */
.uk-bgp-table-empty {
    font-size: var(--font-md);
    color: var(--color-text-muted);
    padding: var(--space-lg);
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    line-height: var(--line-relaxed);
}

@media (prefers-reduced-motion: reduce) {
    .uk-bgp-table-expand,
    .uk-bgp-table-expand::after {
        transition: none;
    }
}
