/* static/css/custom.css */

/* Custom style for player links */
a.player-link,
a.player-link:link,
a.player-link:visited,
a.player-link:hover,
a.player-link:active {
    text-decoration: none !important;
    border-bottom: 1px dashed !important;
}

a.player-link:hover {
    color: #0d6efd !important; /* Keep the hover color */
    border-bottom-color: #0d6efd !important;
}

/* Basic styles for the Knock-Out Bracket */
.bracket-container {
    overflow-x: auto; /* Allow horizontal scrolling on small screens */
    padding-bottom: 20px;
}

.bracket-round {
    min-width: 250px; /* Give each round some space */
    margin-right: 40px;
}

.bracket-match {
    background-color: rgba(255, 255, 255, 0.05); /* Works well with dark themes */
}

/* match list styles */
.match-table {
  border-collapse: collapse;
  width: 100%;
}

.match-table td {
  padding: 4px 6px;
  vertical-align: middle;
}

.match-table td.player {
  width: 40%;
}

.match-table td.sets-won {
  font-weight: bold;
  text-align: center;
  white-space: nowrap;
}

.match-table td.status {
  color: #555;
  font-style: italic;
  text-align: center;
}

.winner-row td.player {
  font-weight: 700;
}

.winner-row td {
  background-color: #f0f8f5; /* light highlight for the winner row */
}

.winner-row {
    background-color: #e7f7e7;
}
.match-table td.winner {
    font-weight: bold;
    color: #198754; /* green for set winner */
}

.sets-won {
    min-width: 30px;
    background-color: #f8f9fa;
    border-radius: 4px;
}

.text-tiny {
  font-size: 0.7rem;
}

/* Make walkover winners bold */
.match-table td.status strong {
    color: #0d6efd; /* Same as player link hover color */
    font-weight: 700;
}

/* Sets won column (last column) consistent with desktop */
.match-table td.sets-won {
    background-color: #f8f9fa; /* Light gray */
    border-radius: 4px;
    font-weight: bold;
    text-align: center;
}

/* Flashscore style winner row */
.winner-row td {
    background-color: #e7f7e7; /* same as desktop winner highlight */
}

.match-table td.winner {
    font-weight: bold;
    color: #198754; /* green for set winner */
}

/* Custom style for clickable card headers on the player detail page */
.card-header-link {
    display: block;
    text-decoration: none;
    color: inherit; /* Inherit the default header text color */
}

.card-header-link .card-header {
    font-weight: bold; /* THIS IS THE PRIMARY VISUAL CUE ON MOBILE */
    color: inherit;
    text-decoration: none; /* Ensure no underline ever appears */
}

@media (min-width: 992px) {
    .hero-section-with-bg {
        background-image: url('../images/tennis-hero.jpg');
        background-size: cover;
        background-position: center;
    }
}

/* This media query applies ONLY when the screen is 768px wide or larger. */
@media (min-width: 768px) {
    .card-header-link {
        /* On desktop, we still want the whole block to be the link */
        display: block;
        text-decoration: none;
        transition: background-color 0.2s ease-in-out;
    }
    
    .card-header-link .card-header {
        /* On desktop, revert the bolding to make it look like a normal header */
        font-weight: bold; 
        color: inherit;
        text-decoration: none;
    }

    .card-header-link:hover .card-header {
        /* The hover effect only applies on desktop */
        background-color: rgba(0, 0, 0, 0.1);
    }
}


/* --- RESPONSIVE STANDINGS TABLE --- */
.standings-table th, .standings-table td {
    text-align: center;
    vertical-align: middle;
}

/* Position and Player columns */
.standings-table .pos-col {
    width: 8%;
}
.standings-table .player-col {
    width: 40%;
    text-align: left;
}

/* All other stat columns */
.standings-table .stat-col {
    width: 12%;
    white-space: nowrap; /* Prevent headers from wrapping */
}

/* On mobile, make the player column take up more space */
@media (max-width: 767px) {
    .standings-table .player-col {
        width: 50%;
    }
    .standings-table .stat-col {
        width: 15%; /* Adjust other columns */
    }
    .standings-table .pos-col {
        width: 5%;
    }
}