/* Country Rankings Specific Styles */

/* Podium — the frame only; the cards inside come from ui-enhancements.css,
   which every other page's podium uses too. This page used to restyle the whole
   component into gold/silver/bronze gradient blocks: besides looking like a
   different site, the metal was keyed to the slot, so a 1-2-2 podium (§ 8.5)
   showed a bronze third place nobody holds. medalClass() decides the metal now,
   from the rank the nation actually has. */
.podium-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

/* The rule, and the § 8.6 points table under it: the first column of the table
   is a place nobody can derive from the numbers beside it, so the page states
   what it is doing. */
.rule-note {
    margin: 0.5rem 0 0.75rem;
    color: var(--text-secondary);
    font-size: 0.9375rem;
    max-width: 75ch;
}

.wch-points-table {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
}

.wch-points-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-right: 0.25rem;
}

.wch-point {
    padding: 0.15rem 0.45rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.wch-point b {
    color: var(--text-primary);
}

/* Country Rankings Table */
.country-rank-badge {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    color: white;
}

.country-rank-badge.gold {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

.country-rank-badge.silver {
    background: linear-gradient(135deg, #d1d5db, #9ca3af);
}

.country-rank-badge.bronze {
    background: linear-gradient(135deg, #cd7c2f, #a16207);
}

.country-rank-badge.default {
    background: var(--primary-color);
}

/* A nation without three positive results holds no place at all, so its badge
   carries the count it is short of instead of a number that would read as one.
   Outlined, not filled: it is not a placing. */
.country-rank-badge.unclassified {
    width: auto;
    min-width: 32px;
    padding: 0 0.5rem;
    border-radius: var(--radius-md);
    background: transparent;
    border: 1px dashed var(--border-color);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}

/* The rows below the classification are context, not results. */
.unclassified-row {
    opacity: 0.75;
}

/* The score the counted three actually made, under their points total: the two
   numbers answer different questions and the smaller one is the tie-break. */
.raw-total {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* The ranked team: the three handlers whose points the nation is scoring with.
   The widest cell in the table, so the rest stay as narrow as their content. */
.results-table .members-cell {
    width: 34%;
}

.country-members {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.country-member {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-primary);
}

.country-member-place {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    min-width: 3ch;
    text-align: right;
    color: var(--text-secondary);
}

.country-member-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.country-member-category {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.country-member-points {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--primary-color);
}

.country-members-empty {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-style: italic;
}

.country-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.country-info .country-flag {
    font-size: 1.5rem;
}

.country-info .country-details {
    display: flex;
    flex-direction: column;
}

.country-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.country-code {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Score Display */
.score-display {
    text-align: center;
    font-weight: 600;
}

.score-value {
    display: block;
    font-size: 1.125rem;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.score-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.participants-count {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
}

/* Mobile Country Cards */
.mobile-country-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    position: relative;
    margin-bottom: 1rem;
}

.mobile-country-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.mobile-country-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.mobile-country-info .country-flag {
    font-size: 1.5rem;
}

.mobile-country-rank {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    background: var(--primary-color);
}

.mobile-country-rank.unclassified {
    width: auto;
    min-width: 40px;
    padding: 0 0.5rem;
    border-radius: var(--radius-md);
    background: transparent;
    border: 1px dashed var(--border-color);
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
}

/* On a card the members sit between the counts and the averages, on the page
   background so they read as a block of their own. */
.mobile-country-card .country-members {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.mobile-country-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.mobile-stat-item {
    text-align: center;
    padding: 0.75rem;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.mobile-stat-value {
    display: block;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.mobile-stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mobile-scores-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.mobile-score-item {
    text-align: center;
}

.mobile-score-value {
    display: block;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.mobile-score-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Performance Indicators */
.performance-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.performance-indicator.excellent {
    background: rgba(5, 150, 105, 0.1);
    color: #059669;
}

.performance-indicator.good {
    background: rgba(217, 119, 6, 0.1);
    color: #d97706;
}

.performance-indicator.average {
    background: rgba(107, 114, 128, 0.1);
    color: #6b7280;
}

/* Responsive Design */
/* The phone podium is in ui-enhancements.css — one flat row per place, the same
   on every page. Nothing here re-stacks it. */
@media (max-width: 768px) {
    /* Hide desktop table, show mobile cards */
    .desktop-results {
        display: none;
    }

    .mobile-results {
        display: block;
    }

    .mobile-country-stats {
        grid-template-columns: 1fr;
    }

    .mobile-scores-grid {
        grid-template-columns: 1fr 1fr;
    }

    .mobile-scores-grid .mobile-score-item:last-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 480px) {
    .mobile-country-card {
        padding: 1rem;
    }

    .mobile-scores-grid {
        grid-template-columns: 1fr;
    }
}