/* ─── FPM Leaderboard — Public Styles ────────────────────────────────────── */
/* Scoped to .fpm-leaderboard — won't collide with theme styles.              */

.fpm-leaderboard { font-family: inherit; max-width: 100%; }

.fpm-lb-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 1rem;
    color: #1e293b;
}

.fpm-lb-empty { color: #94a3b8; font-style: italic; }

/* ─── Avatar ─────────────────────────────────────────────────────────────── */

.fpm-lb-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 700;
    vertical-align: middle;
    flex-shrink: 0;
}

.fpm-lb-avatar--initials {
    background: hsl(var(--lb-hue, 210), 65%, 88%);
    color:       hsl(var(--lb-hue, 210), 65%, 28%);
}

/* ─── Rank badges ────────────────────────────────────────────────────────── */

.fpm-lb-rank-icon { font-size: 1.1rem; }

.fpm-lb-rank-num {
    display: inline-block;
    font-size: .75rem;
    font-weight: 700;
    color: #64748b;
}

.fpm-lb-you {
    display: inline-block;
    font-size: .65rem;
    font-weight: 700;
    background: #0ea5e9;
    color: #fff;
    border-radius: 3px;
    padding: 1px 5px;
    margin-left: 4px;
    vertical-align: middle;
}

.fpm-lb-your-rank {
    margin-top: .75rem;
    font-size: .85rem;
    color: #64748b;
    text-align: center;
    padding: .5rem;
    background: #f8fafc;
    border-radius: 4px;
}

/* ─── Table style ────────────────────────────────────────────────────────── */

.fpm-lb-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}

.fpm-lb-table thead th {
    text-align: left;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #94a3b8;
    padding: .4rem .75rem;
    border-bottom: 2px solid #f1f5f9;
}

.fpm-lb-table tbody td {
    padding: .6rem .75rem;
    border-bottom: 1px solid #f8fafc;
    vertical-align: middle;
}

.fpm-lb-row:last-child td { border-bottom: none; }

.fpm-lb-row--me td { background: #f0f9ff; }

.fpm-lb-row--top3 .fpm-lb-td-name { font-weight: 600; }

.fpm-lb-td-rank  { width: 48px; }
.fpm-lb-td-avatar{ width: 44px; }
.fpm-lb-td-metric{
    font-weight: 700;
    color: #0ea5e9;
    text-align: right;
    width: 80px;
}
.fpm-lb-td-days {
    text-align: right;
    color: #94a3b8;
    font-size: .8rem;
    width: 80px;
}

/* ─── Cards style ────────────────────────────────────────────────────────── */

.fpm-lb-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: .75rem;
}

.fpm-lb-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem .75rem;
    text-align: center;
    transition: box-shadow .15s;
}

.fpm-lb-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); }

.fpm-lb-card--gold   { border-color: #fbbf24; background: #fffbeb; }
.fpm-lb-card--silver { border-color: #94a3b8; background: #f8fafc; }
.fpm-lb-card--bronze { border-color: #d97706; background: #fffbeb; }
.fpm-lb-card--me     { border-color: #0ea5e9; background: #f0f9ff; }

.fpm-lb-card .fpm-lb-avatar {
    width: 56px;
    height: 56px;
    font-size: 1.1rem;
    margin: .35rem auto;
}

.fpm-lb-card-rank   { font-size: 1.2rem; }
.fpm-lb-card-name   { font-weight: 600; font-size: .85rem; margin: .35rem 0 .15rem; color: #1e293b; }
.fpm-lb-card-metric { font-size: 1.2rem; font-weight: 700; color: #0ea5e9; }
.fpm-lb-card-metric-label { font-size: .68rem; color: #94a3b8; text-transform: uppercase; letter-spacing: .05em; }
.fpm-lb-card-days   { font-size: .72rem; color: #94a3b8; margin-top: .25rem; }

/* ─── Podium style ───────────────────────────────────────────────────────── */

.fpm-lb-podium {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: .5rem;
    margin-bottom: 1.5rem;
}

.fpm-lb-podium-spot {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    max-width: 140px;
    text-align: center;
}

.fpm-lb-podium-spot--1 { order: 2; }
.fpm-lb-podium-spot--2 { order: 1; }
.fpm-lb-podium-spot--3 { order: 3; }

.fpm-lb-podium-avatar .fpm-lb-avatar {
    width: 64px;
    height: 64px;
    font-size: 1.3rem;
}

.fpm-lb-podium-spot--2 .fpm-lb-avatar,
.fpm-lb-podium-spot--3 .fpm-lb-avatar {
    width: 52px;
    height: 52px;
    font-size: 1.1rem;
}

.fpm-lb-podium-name   { font-weight: 600; font-size: .85rem; margin: .4rem 0 .15rem; color: #1e293b; }
.fpm-lb-podium-metric { font-size: 1rem; font-weight: 700; color: #0ea5e9; margin-bottom: .4rem; }

.fpm-lb-podium-block {
    width: 100%;
    padding: .6rem .25rem;
    border-radius: 6px 6px 0 0;
    text-align: center;
    font-size: 1.4rem;
}

.fpm-lb-podium-spot--1 .fpm-lb-podium-block {
    background: linear-gradient(160deg, #fef9c3, #fde68a);
    min-height: 80px;
}

.fpm-lb-podium-spot--2 .fpm-lb-podium-block {
    background: linear-gradient(160deg, #f1f5f9, #e2e8f0);
    min-height: 56px;
}

.fpm-lb-podium-spot--3 .fpm-lb-podium-block {
    background: linear-gradient(160deg, #fff7ed, #fed7aa);
    min-height: 40px;
}

.fpm-lb-podium-rest {
    border-top: 2px solid #f1f5f9;
    margin-top: 0;
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
    .fpm-lb-cards { grid-template-columns: repeat(2, 1fr); }
    .fpm-lb-td-days { display: none; }
    .fpm-lb-th-days { display: none; }
    .fpm-lb-podium { gap: .25rem; }
}

/* ─── Multi-column table enhancements ────────────────────────────────────── */

.fpm-lb-table-scroll { overflow-x: auto; }

.fpm-lb-th-sorted,
.fpm-lb-td-sorted {
    background: rgba(14,165,233,.06);
    font-weight: 700;
    color: #0369a1;
}

.fpm-lb-card-stat {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: .2rem 0;
    border-top: 1px solid #f1f5f9;
    font-size: .78rem;
    gap: .4rem;
}

.fpm-lb-card-stat-val { font-weight: 700; color: #1e293b; }
.fpm-lb-card-stat-lbl { color: #94a3b8; font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; }

/* ─── Popular Content ────────────────────────────────────────────────────── */

.fpm-popular-content { font-family: inherit; max-width: 100%; }

.fpm-popular-list {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: popular-counter;
}

.fpm-popular-item {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .65rem 0;
    border-bottom: 1px solid #f1f5f9;
    counter-increment: popular-counter;
}

.fpm-popular-item::before {
    content: counter(popular-counter);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: #f1f5f9;
    border-radius: 50%;
    font-size: .72rem;
    font-weight: 700;
    color: #64748b;
    flex-shrink: 0;
}

.fpm-popular-item:first-child::before { background: #fef9c3; color: #854d0e; }
.fpm-popular-item:nth-child(2)::before { background: #f1f5f9; color: #475569; }
.fpm-popular-item:nth-child(3)::before { background: #fff7ed; color: #9a3412; }

.fpm-popular-link {
    flex: 1;
    font-size: .9rem;
    font-weight: 500;
    color: #1e293b;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fpm-popular-link:hover { color: #0ea5e9; text-decoration: underline; }

.fpm-popular-badge {
    display: inline-block;
    background: #e0f2fe;
    color: #0369a1;
    font-size: .72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
    flex-shrink: 0;
}

.fpm-popular-unique {
    font-size: .72rem;
    color: #94a3b8;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ─── Popular Cards ──────────────────────────────────────────────────────── */

.fpm-popular-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: .75rem;
}

.fpm-popular-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    transition: box-shadow .15s;
}

.fpm-popular-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); }

.fpm-popular-card-rank {
    font-size: .72rem;
    font-weight: 700;
    color: #94a3b8;
    margin-bottom: .35rem;
}

.fpm-popular-card-title {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    color: #1e293b;
    text-decoration: none;
    margin-bottom: .5rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.fpm-popular-card-title:hover { color: #0ea5e9; }

.fpm-popular-card-meta {
    display: flex;
    gap: .4rem;
    flex-wrap: wrap;
    font-size: .72rem;
    color: #64748b;
}
