/* =============================================
   Results Page Styles
   Pokemon GO PVP Tournament System v3.0
   ============================================= */

/* Container */
.results-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* Header */
.results-header {
    text-align: center;
    padding: 20px 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 24px;
}

.results-header h1 {
    font-size: 1.5rem;
    margin: 0 0 16px 0;
    color: var(--text-primary);
}

.tournament-name {
    font-size: 1.8rem;
    margin: 0 0 12px 0;
    color: var(--primary-color);
}

.tournament-meta {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.league-badge {
    background: var(--background);
    padding: 4px 16px;
    border-radius: 16px;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
}

.status-badge {
    padding: 4px 16px;
    border-radius: 16px;
    font-size: 0.9rem;
    font-weight: 600;
}

.status-open {
    background: var(--primary-color);
    color: white;
}

.status-live {
    background: var(--danger-color);
    color: white;
    animation: pulse-live 2s ease-in-out infinite;
}

@keyframes pulse-live {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.status-completed {
    background: var(--success-color);
    color: white;
}

.round-badge {
    background: var(--surface);
    border: 1px solid var(--border-color);
    padding: 4px 16px;
    border-radius: 16px;
    font-size: 0.9rem;
}

.player-count {
    margin: 8px 0 0 0;
    color: var(--text-secondary);
}

/* Actions */
.results-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.last-updated {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Standings Section */
.standings-section {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 24px;
}

.standings-header-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.standings-section h2 {
    margin: 0;
    font-size: 1.3rem;
}

.unofficial-badge {
    background: var(--warning-color);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.unofficial-badge.hidden {
    display: none;
}

.disclaimer {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0 0 16px 0;
    font-style: italic;
}

.standings-table {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.standings-header {
    display: grid;
    grid-template-columns: 50px 1fr 80px 60px;
    padding: 12px 16px;
    background: var(--background);
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.standings-row {
    display: grid;
    grid-template-columns: 50px 1fr 80px 60px;
    padding: 12px 16px;
    background: var(--background);
    border-radius: var(--radius);
    align-items: center;
    transition: transform 0.2s;
}

.standings-row:hover {
    transform: translateX(4px);
}

.standings-row.rank-gold {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 215, 0, 0.05));
    border-left: 4px solid gold;
}

.standings-row.rank-silver {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.15), rgba(192, 192, 192, 0.05));
    border-left: 4px solid silver;
}

.standings-row.rank-bronze {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.15), rgba(205, 127, 50, 0.05));
    border-left: 4px solid #cd7f32;
}

.rank-col {
    font-weight: 600;
    display: flex;
    align-items: center;
}

.player-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.player-name {
    font-weight: 600;
    color: var(--text-primary);
}

.player-id {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.record-col {
    font-variant-numeric: tabular-nums;
    font-size: 1rem;
}

.points-col {
    font-weight: 600;
    color: var(--primary-color);
}

.packs-col {
    font-weight: 600;
    color: var(--success-color);
}

/* Matches Section */
.matches-section {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 24px;
}

.matches-section h2 {
    margin: 0 0 16px 0;
    font-size: 1.3rem;
}

.round-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.round-tab {
    padding: 8px 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--background);
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    color: var(--text-primary);
}

.round-tab:hover {
    border-color: var(--primary-color);
}

.round-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.matches-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.match-result {
    display: flex;
    align-items: center;
    padding: 16px;
    background: var(--background);
    border-radius: var(--radius);
    gap: 16px;
}

.match-result.complete {
    border-left: 4px solid var(--success-color);
}

.match-result.pending {
    border-left: 4px solid var(--warning-color);
}

.match-player {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.match-player:last-of-type {
    justify-content: flex-end;
    text-align: right;
}

.match-player.winner .player-name {
    font-weight: 700;
    color: var(--success-color);
}

.match-player.loser .player-name {
    color: var(--text-secondary);
}

.win-badge {
    background: var(--success-color);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
}

.match-vs {
    width: 40px;
    text-align: center;
    font-weight: bold;
    color: var(--text-secondary);
}

.pending-badge {
    background: var(--warning-color);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Final Results Section */
.final-results-section {
    background: linear-gradient(135deg, var(--surface), var(--background));
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
    border: 2px solid var(--primary-color);
}

.final-results-section h2 {
    margin: 0 0 8px 0;
    font-size: 1.5rem;
    text-align: center;
    color: var(--primary-color);
}

.final-results-section .disclaimer {
    text-align: center;
    margin-bottom: 24px;
}

.podium {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.podium-entry {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
}

.podium-entry.first-place {
    border: 3px solid gold;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), var(--surface));
    order: 1;
    transform: scale(1.05);
}

.podium-entry.second-place {
    border: 3px solid silver;
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.1), var(--surface));
    order: 0;
}

.podium-entry.third-place {
    border: 3px solid #cd7f32;
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.1), var(--surface));
    order: 2;
}

.podium-trophy {
    font-size: 3rem;
    margin-bottom: 8px;
}

.podium-place {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.podium-player {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.podium-record {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.podium-packs {
    background: var(--success-color);
    color: white;
    padding: 6px 16px;
    border-radius: 16px;
    font-weight: 600;
    display: inline-block;
    margin-bottom: 16px;
}

.podium-team {
    text-align: left;
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
    margin-top: 8px;
}

.podium-team-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.podium-team-header h4 {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.podium-team h4 {
    margin: 0 0 8px 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.podium-pokemon {
    padding: 8px;
    background: var(--background);
    border-radius: 6px;
    margin-bottom: 6px;
}

.podium-pokemon .pokemon-name {
    font-weight: 600;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-primary);
}

.podium-pokemon .bb-badge {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 8px;
    font-weight: 600;
}

.podium-pokemon .pokemon-moves {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.podium-pokemon .move {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
}

.podium-pokemon .move.fast {
    background: var(--primary-color);
    color: white;
}

.podium-pokemon .move.charged {
    background: var(--text-secondary);
    color: white;
}

/* Full Rankings List (4th place and below) */
.full-rankings-list {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.full-rankings-header {
    margin: 0 0 16px 0;
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.rankings-table {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rankings-header-row {
    display: grid;
    grid-template-columns: 50px 1fr 60px 70px 60px;
    padding: 10px 16px;
    background: var(--background);
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.rankings-row {
    display: grid;
    grid-template-columns: 50px 1fr 60px 70px 60px;
    padding: 12px 16px;
    background: var(--background);
    border-radius: var(--radius);
    align-items: center;
}

.rating-col {
    text-align: center;
}

.rankings-row:nth-child(odd) {
    background: var(--surface);
}

.rankings-row .rank-col {
    font-weight: 600;
    color: var(--text-secondary);
}

.rankings-row .packs-col {
    font-weight: 600;
    color: var(--success-color);
}

/* Prize Info */
.prize-info {
    text-align: center;
    padding: 16px;
    background: var(--background);
    border-radius: var(--radius);
    margin-top: 20px;
}

.prize-info h3 {
    margin: 0 0 8px 0;
    font-size: 1rem;
}

.prize-info p {
    margin: 0;
    color: var(--text-secondary);
}

/* =============================================
   Tournament List View
   ============================================= */

.tournaments-list-section {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 24px;
}

.tournaments-list-section h2 {
    margin: 0 0 16px 0;
    font-size: 1.3rem;
}

.tournaments-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tournament-card {
    display: block;
    background: var(--background);
    border-radius: var(--radius);
    padding: 16px;
    text-decoration: none;
    color: inherit;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.tournament-card:hover {
    border-color: var(--primary-color);
    transform: translateX(4px);
}

.tournament-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
    gap: 12px;
}

.tournament-card-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.tournament-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.tournament-card-meta .league-badge {
    padding: 2px 10px;
    font-size: 0.8rem;
}

.tournament-card-sanction {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.sanction-badge {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* Footer */
.results-footer {
    text-align: center;
    padding: 20px 0;
    border-top: 2px solid var(--border-color);
}

.results-footer a {
    color: var(--primary-color);
    text-decoration: none;
}

.results-footer a:hover {
    text-decoration: underline;
}

.results-footer .credit {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 8px 0 0 0;
}

/* Team Rating Badges */
.team-rating-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 700;
}

.team-rating-badge.rating-high {
    background: #dcfce7;
    color: #166534;
}

.team-rating-badge.rating-mid {
    background: #fef3c7;
    color: #92400e;
}

.team-rating-badge.rating-low {
    background: #fee2e2;
    color: #991b1b;
}

/* Loading & Error states */
.loading {
    color: var(--text-secondary);
    font-style: italic;
}

.error {
    color: var(--danger-color);
}

.no-data {
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* =============================================
   Responsive
   ============================================= */

@media (max-width: 768px) {
    .results-container {
        padding: 16px;
    }

    .standings-header,
    .standings-row {
        grid-template-columns: 40px 1fr 60px 50px;
        padding: 10px 12px;
        font-size: 0.85rem;
    }

    .podium {
        grid-template-columns: 1fr;
    }

    .podium-entry.first-place {
        order: 0;
        transform: none;
    }

    .podium-entry.second-place {
        order: 1;
    }

    .podium-entry.third-place {
        order: 2;
    }

    .match-result {
        flex-wrap: wrap;
    }

    .match-player {
        flex: 1 1 40%;
    }

    .match-vs {
        flex: 0 0 100%;
        order: -1;
        padding: 4px 0;
    }

    .pending-badge {
        flex: 0 0 100%;
        text-align: center;
        margin-top: 8px;
    }

    .rankings-header-row,
    .rankings-row {
        grid-template-columns: 35px 1fr 50px 55px 50px;
        padding: 10px 12px;
        font-size: 0.8rem;
    }

    .team-rating-badge {
        padding: 2px 6px;
        font-size: 0.7rem;
    }
}
