/* Panel growth pills and the growth-trend modal.
   Shared by the public Top Panels page and the admin ranking; the markup is
   produced by /assets/scripts/panel-growth.js and src/components/GrowthPills.astro. */

/* ── Pills ─────────────────────────────────────────────────────────── */
.pg-pills {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    vertical-align: middle;
}

.pg-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    background: #f1f5f9;
    color: #475569;
    cursor: default;
}

.pg-pill-label {
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.7;
}

.pg-pill sup { font-size: 0.6em; margin-left: 0.1rem; }

.pg-up      { background: #dcfce7; color: #166534; }
.pg-down    { background: #fee2e2; color: #991b1b; }
.pg-flat    { background: #f1f5f9; color: #475569; }
.pg-unknown { background: #f8fafc; color: #94a3b8; }

.pg-partial { outline: 1px dashed currentColor; outline-offset: -1px; }

.pg-trend-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.7rem;
    border: 1px solid #c7d2fe;
    border-radius: 0.6rem;
    background: #eef2ff;
    color: #4338ca;
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.pg-trend-btn:hover { background: #e0e7ff; border-color: #a5b4fc; }

.pg-footnote { font-size: 0.7rem; color: #64748b; }

/* ── Modal ─────────────────────────────────────────────────────────── */
.pg-overlay {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.55);
}
.pg-overlay[hidden] { display: none; }

.pg-modal {
    width: 100%;
    max-width: 56rem;
    max-height: 92vh;
    overflow-y: auto;
    background: #ffffff;
    border-radius: 1.25rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    color: #0f172a;
    text-align: left;
}

.pg-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem 1rem;
    border-bottom: 1px solid #f1f5f9;
}

.pg-kicker {
    margin: 0 0 0.25rem;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #6366f1;
}
.pg-title { margin: 0; font-size: 1.25rem; font-weight: 800; }
.pg-subtitle { margin: 0.25rem 0 0; font-size: 0.75rem; color: #64748b; }

.pg-close {
    border: 0;
    background: none;
    font-size: 1.75rem;
    line-height: 1;
    color: #94a3b8;
    cursor: pointer;
}
.pg-close:hover { color: #0f172a; }

.pg-tiles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    padding: 1rem 1.5rem 0;
}
@media (max-width: 640px) {
    .pg-tiles { grid-template-columns: 1fr; }
}

.pg-tile {
    padding: 0.9rem 1rem;
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}
.pg-tile.pg-up   { border-color: #bbf7d0; background: #f0fdf4; }
.pg-tile.pg-down { border-color: #fecaca; background: #fef2f2; }

.pg-tile-label {
    margin: 0;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #64748b;
}
.pg-tile-window { font-weight: 600; letter-spacing: 0; text-transform: none; color: #94a3b8; }

.pg-tile-value {
    margin: 0.3rem 0 0.2rem;
    font-size: 1.5rem;
    font-weight: 900;
    line-height: 1.1;
    color: #0f172a;
}
.pg-tile.pg-up   .pg-tile-value { color: #166534; }
.pg-tile.pg-down .pg-tile-value { color: #991b1b; }
.pg-tile.pg-unknown .pg-tile-value { color: #94a3b8; }
.pg-tile-value i { font-size: 0.8em; }
.pg-tile-value sup { font-size: 0.5em; }

.pg-tile-detail { margin: 0; font-size: 0.72rem; line-height: 1.4; color: #475569; }

.pg-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 1rem 1.5rem 0;
}

.pg-seg {
    display: inline-flex;
    padding: 0.2rem;
    border-radius: 0.6rem;
    background: #f1f5f9;
}
.pg-seg-btn {
    border: 0;
    border-radius: 0.45rem;
    padding: 0.35rem 0.75rem;
    background: transparent;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
}
.pg-seg-btn.is-active { background: #ffffff; color: #4338ca; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12); }

.pg-body { padding: 1rem 1.5rem 1.5rem; }

.pg-chart-wrap { position: relative; height: 18rem; }
.pg-chart-wrap[hidden] { display: none; }

.pg-note { margin: 0.75rem 0 0; font-size: 0.75rem; color: #64748b; }
.pg-error { color: #b91c1c; font-weight: 600; }

.pg-table-wrap { margin-top: 0.75rem; font-size: 0.75rem; }
.pg-table-wrap[hidden] { display: none; }
.pg-table-wrap summary { cursor: pointer; color: #4338ca; font-weight: 700; }
.pg-table-scroll { max-height: 14rem; overflow: auto; margin-top: 0.5rem; border: 1px solid #e2e8f0; border-radius: 0.6rem; }
.pg-table { width: 100%; border-collapse: collapse; }
.pg-table th, .pg-table td { padding: 0.4rem 0.6rem; text-align: left; border-bottom: 1px solid #f1f5f9; white-space: nowrap; }
.pg-table th { position: sticky; top: 0; background: #f8fafc; font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em; color: #64748b; }
.pg-muted { color: #94a3b8; font-style: italic; }
