/* Custom styles for Tournament Manager */

/* General styles */
html, body {
    height: 100%;
    margin: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
}

/* This is the key to making the footer stick to the bottom */
main {
    flex: 1 0 auto;
}

.min-vh-100 {
    min-height: 100vh;
}

footer {
    flex-shrink: 0;
    width: 100%;
}

/* Header styles */
.navbar-brand {
    font-weight: bold;
}

/* Tournament card styles */
.tournament-card {
    transition: transform 0.3s ease;
    margin-bottom: 20px;
    height: 100%;
}

.tournament-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.tournament-card .card-img-top {
    height: 180px;
    object-fit: cover;
}

/* Bracket styles */
.bracket {
    display: flex;
    overflow-x: auto;
    padding: 20px 0;
}

.bracket-round {
    margin-right: 40px;
    min-width: 200px;
}

.bracket-round h3 {
    text-align: center;
    margin-bottom: 20px;
}

.bracket-match {
    background: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px;
    margin-bottom: 15px;
    position: relative;
}

.bracket-match:after {
    content: '';
    position: absolute;
    right: -20px;
    top: 50%;
    width: 20px;
    height: 2px;
    background: #ddd;
}

.bracket-round:last-child .bracket-match:after {
    display: none;
}

.bracket-team {
    padding: 5px;
    display: flex;
    justify-content: space-between;
}

.bracket-team.winner {
    font-weight: bold;
    background-color: #f8f9fa;
}

.bracket-score {
    font-weight: bold;
}

/* Profile styles */
.profile-header {
    background: #343a40;
    color: white;
    padding: 30px 0;
    margin-bottom: 30px;
}

.profile-stats {
    display: flex;
    justify-content: space-around;
    text-align: center;
    margin: 20px 0;
}

.profile-stat {
    padding: 10px;
}

.profile-stat-value {
    font-size: 24px;
    font-weight: bold;
}

.profile-stat-label {
    font-size: 14px;
    color: #6c757d;
}

/* Admin panel styles */
.admin-sidebar {
    background: #343a40;
    color: white;
    min-height: calc(100vh - 56px);
    padding-top: 20px;
}

.admin-sidebar .nav-link {
    color: rgba(255,255,255,.75);
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    color: white;
}

/* Leaderboard styles */
.leaderboard-table th {
    background-color: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 10;
}

.leaderboard-rank {
    font-weight: bold;
    width: 60px;
    text-align: center;
}

.leaderboard-rank-1 {
    color: gold;
}

.leaderboard-rank-2 {
    color: silver;
}

.leaderboard-rank-3 {
    color: #cd7f32; /* bronze */
}

.win-rate-bar {
    height: 10px;
    border-radius: 5px;
    background-color: #e9ecef;
    overflow: hidden;
}

.win-rate-progress {
    height: 100%;
    background-color: #28a745;
}

/* Avatar styles */
.leaderboard-avatar {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border: 1px solid #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    max-width: 32px; /* Ensure the image doesn't exceed this width */
    max-height: 32px; /* Ensure the image doesn't exceed this height */
}

.leaderboard-avatar-placeholder {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #6c757d;
    color: white;
    font-weight: bold;
    border-radius: 50%;
    border: 1px solid #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    font-size: 14px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .bracket {
        flex-direction: column;
    }

    .bracket-round {
        margin-right: 0;
        margin-bottom: 30px;
    }

    .bracket-match:after {
        display: none;
    }

    .leaderboard-table {
        font-size: 0.85rem;
    }
}

/* Additional leaderboard styling */
.leaderboard-table td {
    vertical-align: middle;
}

.leaderboard-table .user-cell {
    max-width: 250px;
}

.leaderboard-table .avatar-container {
    min-width: 32px;
    max-width: 32px;
    height: 32px;
    overflow: hidden;
    display: inline-block;
}
