/* ========================================
   PUBG Tournament — Tactical Dark Theme
   ======================================== */

:root {
    --pubg-orange: #F2A900;
    --pubg-orange-dim: rgba(242, 169, 0, 0.15);
    --pubg-orange-glow: rgba(242, 169, 0, 0.4);
    --pubg-gold: #FFD700;
    --pubg-silver: #C0C0C0;
    --pubg-bronze: #CD7F32;
    --surface-0: #0d1117;
    --surface-1: #151b23;
    --surface-2: #1c2333;
    --surface-3: #242d3d;
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-accent: rgba(242, 169, 0, 0.25);
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-dim: #484f58;
    --font-display: 'Rajdhani', 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Cascadia Code', 'Consolas', monospace;
}

html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html { font-size: 16px; }
}

body {
    margin-bottom: 60px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--surface-0);
}

.container.py-4 {
    flex: 1;
}

.card {
    border-color: var(--border-subtle);
    background: var(--surface-1);
}

/* ========================================
   LEADERBOARD
   ======================================== */

.leaderboard-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, var(--surface-2), var(--surface-1));
    border-bottom: 2px solid var(--pubg-orange);
    border-radius: 0.375rem 0.375rem 0 0;
    position: relative;
    overflow: hidden;
}

.leaderboard-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--pubg-orange-glow), transparent);
}

.leaderboard-header h5 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0;
    color: var(--pubg-orange);
    font-size: 1.1rem;
}

.leaderboard-header .match-count {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--surface-0);
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    border: 1px solid var(--border-subtle);
}

/* Team Row */
.team-row {
    display: grid;
    grid-template-columns: 60px 1fr auto;
    align-items: stretch;
    background: var(--surface-1);
    border-bottom: 1px solid var(--border-subtle);
    transition: background 0.2s ease, transform 0.15s ease;
    position: relative;
}

.team-row:hover {
    background: var(--surface-2);
}

.team-row:last-child {
    border-bottom: none;
}

/* Rank Column */
.rank-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem 0;
    position: relative;
}

.rank-badge {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.1rem;
    border-radius: 6px;
    position: relative;
}

.rank-1 .rank-badge {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #1a1000;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.rank-2 .rank-badge {
    background: linear-gradient(135deg, #E8E8E8, #A8A8A8);
    color: #1a1a1a;
    box-shadow: 0 0 15px rgba(192, 192, 192, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.rank-3 .rank-badge {
    background: linear-gradient(135deg, #CD7F32, #A0522D);
    color: #1a0e00;
    box-shadow: 0 0 15px rgba(205, 127, 50, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.rank-other .rank-badge {
    background: var(--surface-3);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

/* Team Info Column */
.team-info {
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.5rem;
    min-width: 0;
}

.team-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 0.03em;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rank-1 .team-name { color: var(--pubg-gold); }
.rank-2 .team-name { color: var(--pubg-silver); }
.rank-3 .team-name { color: var(--pubg-bronze); }

.team-stats-inline {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.stat-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--surface-0);
    padding: 0.15rem 0.55rem;
    border-radius: 4px;
    border: 1px solid var(--border-subtle);
}

.stat-chip .stat-val {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--text-primary);
}

.stat-chip.kills .stat-val {
    color: #f85149;
}

/* Player Breakdown */
.player-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.25rem;
}

.player-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    padding: 0.2rem 0.55rem;
    background: var(--surface-3);
    border-radius: 4px;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    transition: border-color 0.2s;
}

.player-chip:hover {
    border-color: var(--border-accent);
}

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

.player-chip .player-pts {
    font-family: var(--font-mono);
    color: var(--pubg-orange);
    font-weight: 600;
}

.player-chip .player-kills {
    font-family: var(--font-mono);
    color: #f85149;
    font-size: 0.68rem;
}

/* Score Column */
.score-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem 1.5rem;
    min-width: 100px;
    position: relative;
}

.score-cell::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    bottom: 20%;
    width: 1px;
    background: var(--border-subtle);
}

.score-total {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.8rem;
    line-height: 1;
    color: var(--pubg-orange);
}

.rank-1 .score-total { color: var(--pubg-gold); }

.score-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    margin-top: 0.15rem;
}

/* Score Bar (visual width proportional to points) */
.score-bar-track {
    width: 100%;
    height: 3px;
    background: var(--surface-0);
    border-radius: 2px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.score-bar-fill {
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--pubg-orange), var(--pubg-gold));
    transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.rank-2 .score-bar-fill,
.rank-3 .score-bar-fill {
    background: linear-gradient(90deg, var(--pubg-orange-dim), var(--pubg-orange));
}

.rank-other .score-bar-fill {
    background: var(--surface-3);
}

/* ========================================
   TOURNAMENT HEADER
   ======================================== */

.tournament-hero {
    background: linear-gradient(135deg, var(--surface-2), var(--surface-1));
    border: 1px solid var(--border-subtle);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.tournament-hero::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--pubg-orange), transparent);
}

.tournament-hero h2 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 0.04em;
    margin-bottom: 0.25rem;
}

.tournament-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.5rem;
}

.meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
    background: var(--surface-0);
    padding: 0.25rem 0.65rem;
    border-radius: 4px;
    border: 1px solid var(--border-subtle);
}

.meta-tag i { color: var(--pubg-orange); }

.status-active {
    background: rgba(35, 134, 54, 0.2) !important;
    color: #3fb950 !important;
    border-color: rgba(35, 134, 54, 0.3) !important;
}

.status-closed {
    background: rgba(139, 148, 158, 0.1) !important;
    color: var(--text-secondary) !important;
}

/* ========================================
   ACTION BAR
   ======================================== */

.action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.action-bar .btn {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    font-size: 0.8rem;
    padding: 0.4rem 1rem;
}

/* ========================================
   SECTION CARDS (Equipes, Partidas)
   ======================================== */

.section-card {
    background: var(--surface-1);
    border: 1px solid var(--border-subtle);
    border-radius: 0.5rem;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border-subtle);
}

.section-header h5 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-size: 0.95rem;
    margin: 0;
    color: var(--text-primary);
}

.section-header .count-badge {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--pubg-orange);
    background: var(--pubg-orange-dim);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
}

.section-body {
    padding: 1rem 1.25rem;
}

/* ========================================
   TEAM CARDS (in Equipes section)
   ======================================== */

.team-card {
    background: var(--surface-2);
    border: 1px solid var(--border-subtle);
    border-radius: 0.5rem;
    padding: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.team-card:hover {
    border-color: var(--border-accent);
    box-shadow: 0 0 15px rgba(242, 169, 0, 0.05);
}

.team-card h6 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 0.6rem;
    color: var(--text-primary);
}

.team-card .member-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
    padding: 0.15rem 0;
}

.team-card .member-item i {
    color: var(--pubg-orange);
    font-size: 0.7rem;
}

/* ========================================
   MATCH TABLE
   ======================================== */

.match-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.match-table thead th {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

.match-table tbody tr {
    transition: background 0.15s;
}

.match-table tbody tr:hover {
    background: var(--surface-2);
}

.match-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: top;
    font-size: 0.85rem;
}

.match-table tbody tr:last-child td {
    border-bottom: none;
}

.match-id-cell code {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--pubg-orange);
    background: var(--pubg-orange-dim);
    padding: 0.15rem 0.45rem;
    border-radius: 3px;
}

.match-date {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.match-player-score {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.15rem 0;
    font-size: 0.78rem;
}

.match-player-score .mps-name {
    color: var(--text-primary);
    font-weight: 500;
    min-width: 100px;
}

.match-player-score .mps-detail {
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.72rem;
}

.match-player-score .mps-total {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--pubg-orange);
    margin-left: auto;
}

/* ========================================
   EMPTY STATE
   ======================================== */

.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-dim);
}

.empty-state i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
    color: var(--text-dim);
}

.empty-state p {
    margin: 0;
    font-size: 0.9rem;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .team-row {
        grid-template-columns: 50px 1fr;
    }

    .score-cell {
        grid-column: 1 / -1;
        flex-direction: row;
        gap: 0.75rem;
        padding: 0.5rem 1rem;
        min-width: auto;
        border-top: 1px solid var(--border-subtle);
    }

    .score-cell::before {
        display: none;
    }

    .score-total {
        font-size: 1.4rem;
    }

    .score-bar-track {
        flex: 1;
        margin-top: 0;
    }

    .action-bar {
        flex-direction: column;
    }

    .action-bar .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.team-row {
    animation: slideInUp 0.4s ease both;
}

.team-row:nth-child(1) { animation-delay: 0.05s; }
.team-row:nth-child(2) { animation-delay: 0.1s; }
.team-row:nth-child(3) { animation-delay: 0.15s; }
.team-row:nth-child(4) { animation-delay: 0.2s; }
.team-row:nth-child(5) { animation-delay: 0.25s; }
.team-row:nth-child(6) { animation-delay: 0.3s; }
.team-row:nth-child(7) { animation-delay: 0.35s; }
.team-row:nth-child(8) { animation-delay: 0.4s; }

/* ========================================
   UTILITIES (keep old overrides working)
   ======================================== */

.table-warning {
    --bs-table-bg: rgba(255, 193, 7, 0.15);
}

.badge.bg-primary.fs-6 {
    font-size: 1rem !important;
}
