/* Admin Matches CSS */
.admin-matches-container {
    margin-bottom: 20px;
    background-color: var(--table-background-color, #ffffff);
    border-radius: 5px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
}

.admin-header {
    font-size: var(--round-header-font-size, 20px);
    color: var(--round-header-text-color, #ffffff);
    background-color: #d32f2f;
    padding: 10px 15px;
    margin-top: 0;
    margin-bottom: 15px;
    border-radius: 4px;
    text-align: center;
}

/* CLEAN ADMIN TABLE STYLING - Remove flexbox, use standard table */
.admin-match-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: var(--base-font-size, 16px);
    border-spacing: 0;
}

/* Remove flexbox - use standard table display */
.admin-match-table tr {
    display: table-row;
}

/* VS column - standard table cell - MATCH regular page */
.admin-match-table .vs {
    width: 30px;
    text-align: center;
    position: relative;
    padding: 0;
    background: transparent;
    z-index: 10;
    vertical-align: middle;
}

/* VS SVG - MATCH regular page */
.admin-match-table .vs::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    background-image: url('v-graphic.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* Team cells - standard table cells, NOT flex - MATCH regular page */
.admin-match-table .team-cell {
    width: 45%;
    cursor: pointer;
    border-radius: 0;
    position: relative;
    padding: 10px 5px;
    display: table-cell;
    vertical-align: middle;
}

.admin-match-table .team-cell.team-left {
    text-align: left !important;
    padding-right: 0;
}

.admin-match-table .team-cell.team-right {
    text-align: right !important;
    padding-left: 0;
}

/* Winner and Loser styling - MATCH regular page */
.admin-match-table .team-cell.winner {
    background-color: var(--win-background-color, #90EE90) !important;
    font-weight: bold;
}

.admin-match-table .team-cell.loser {
    background-color: var(--loss-background-color, #FFB6C1) !important;
}

/* Player name styling - MATCH regular page exactly */
.admin-match-table .player-name {
    display: inline-block;
    padding: 3px 5px;
    background-color: var(--player-name-background-color, #f0f0f0);
    color: var(--player-name-text-color, #333333);
    margin: 0;
    margin-bottom: 5px;
    border-radius: 3px;
    width: auto;
    max-width: 100%;
}

.admin-match-table .team-cell.winner .player-name,
.admin-match-table .team-cell.loser .player-name {
    background-color: rgba(255, 255, 255, 0.7);
}

/* Table cell styling - MATCH regular page */
.admin-match-table td {
    padding: 10px 5px;
    vertical-align: middle;
    border: none;
}

.admin-match-table tr {
    border-bottom: 1px solid var(--table-border-color, #dddddd);
}

/* Purple highlight - MATCH regular page exactly */
.admin-match-table .player-name.highlight {
    background-color: var(--highlight-color, #AE308F) !important;
    color: var(--highlight-text-color, white) !important;
    z-index: 100 !important;
    position: relative !important;
    opacity: 1 !important;
}

/* Ensure highlight overrides winner/loser styles - MATCH regular page */
.admin-match-table .team-cell.winner .player-name.highlight,
.admin-match-table .team-cell.loser .player-name.highlight {
    background-color: var(--highlight-color, #AE308F) !important;
    color: var(--highlight-text-color, white) !important;
    z-index: 100 !important;
    opacity: 1 !important;
}

/* Remove any cell-level highlighting - MATCH regular page */
.admin-match-table td.highlight,
.admin-match-table .team-cell.highlight {
    background-color: inherit !important;
}

/* Mobile responsive - MATCH regular page */
@media screen and (max-width: 600px) {
    .admin-match-table td {
        padding: 6px;
        font-size: 0.9em;
    }
    
    .admin-match-table .player-name {
        padding: 3px;
        margin-bottom: 3px;
    }
    
    .admin-match-table td.team-cell.team-left {
        text-align: left !important;
    }
    
    .admin-match-table td.team-cell.team-right {
        text-align: right !important;
    }
}

/* Admin notice */
.admin-notice {
    background-color: #f8d7da;
    color: #721c24;
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 4px;
    font-weight: bold;
    text-align: center;
}

/* Mobile responsive */
@media screen and (max-width: 600px) {
    .admin-match-table td {
        padding: 6px;
        font-size: 0.9em;
    }
    
    .admin-match-table .player-name {
        padding: 3px;
        margin-bottom: 3px;
    }
    
    .admin-match-table td.team-cell.team-left {
        text-align: left !important;
    }
    
    .admin-match-table td.team-cell.team-right {
        text-align: right !important;
    }
}

/* Player menu styling */
.player-menu-button {
    background-color: var(--button-color, #20B599);
    color: var(--button-text-color, #ffffff);
    border: none;
    padding: 10px 15px;
    text-align: center;
    width: 100%;
    font-size: var(--button-font-size, 18px);
    cursor: pointer;
    margin-bottom: 15px;
    border-radius: 4px;
}

#playerMenu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8) !important;
    z-index: 1000;
    overflow-y: auto;
    /* Force dark background on all browsers including mobile Safari */
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

.player-menu-content {
    max-width: 600px;
    margin: 50px auto;
    background-color: white !important;
    padding: 20px;
    border-radius: 5px;
    /* Ensure proper contrast on all devices */
    color: #333333 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.player-menu-content h2 {
    color: #333333 !important;
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 24px;
    font-weight: bold;
}

.close-menu {
    color: white;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    margin-right: 20px;
}

.player-group h3 {
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: var(--menu-header-font-size, 18px);
    font-weight: bold;
    color: #333333 !important;
}

.player-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

.player-name-button {
    display: inline-block;
    margin: 5px;
    padding: 8px 12px;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 3px;
    cursor: pointer;
    font-size: var(--player-button-font-size, 16px);
}

.player-name-button.selected {
    background-color: var(--button-color, #20B599) !important;
    color: white !important;
}

/* Enhanced mobile Safari and mobile browser fixes */
#playerMenu {
    background: rgba(0, 0, 0, 0.8) !important;
    background-color: rgba(0, 0, 0, 0.8) !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    -webkit-transform: translateZ(0) !important;
    transform: translateZ(0) !important;
}

/* Force dark overlay on all mobile browsers */
@media screen and (max-width: 768px) {
    #playerMenu {
        background: rgba(0, 0, 0, 0.9) !important;
        background-color: rgba(0, 0, 0, 0.9) !important;
    }
}

/* Specific targeting for WebKit mobile browsers */
@media screen and (-webkit-min-device-pixel-ratio: 1) {
    #playerMenu {
        background: rgba(0, 0, 0, 0.9) !important;
        background-color: rgba(0, 0, 0, 0.9) !important;
    }
    
    .player-menu-content {
        background-color: white !important;
        background: white !important;
        color: #333333 !important;
    }
    
    .player-name-button {
        background-color: #f0f0f0 !important;
        background: #f0f0f0 !important;
        color: #333333 !important;
        border: 1px solid #ddd !important;
    }
    
    .player-name-button.selected {
        background-color: var(--button-color, #20B599) !important;
        color: white !important;
    }
}

/* Additional mobile browser targeting */
@media screen and (max-device-width: 812px) {
    #playerMenu {
        background: rgba(0, 0, 0, 0.95) !important;
        background-color: rgba(0, 0, 0, 0.95) !important;
    }
}

/* Chrome mobile specific */
@media screen and (-webkit-min-device-pixel-ratio: 2) {
    #playerMenu {
        background: rgba(0, 0, 0, 0.95) !important;
        background-color: rgba(0, 0, 0, 0.95) !important;
    }
}

/* Touch device targeting */
@media (hover: none) and (pointer: coarse) {
    #playerMenu {
        background: rgba(0, 0, 0, 0.95) !important;
        background-color: rgba(0, 0, 0, 0.95) !important;
    }
}

/* Highlight style for selected player */
.admin-match-table td.highlight,
.admin-match-table .player-name.highlight {
    background-color: var(--highlight-color, #AE308F) !important;
    color: var(--highlight-text-color, white) !important;
}

/* Ensure highlight takes precedence over winner/loser styles */
.admin-match-table .team-cell.winner .player-name.highlight,
.admin-match-table .team-cell.loser .player-name.highlight {
    background-color: var(--highlight-color, #AE308F) !important;
    color: var(--highlight-text-color, white) !important;
}

/* Add these styles to pickleball-admin-matches.css */
.admin-controls {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.reset-matches-button {
    background-color: #d9534f;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 10px 15px;
    cursor: pointer;
    font-weight: bold;
    font-size: var(--button-font-size, 16px);
}

.reset-matches-button:hover {
    background-color: #c9302c;
}

/* Apply the same fix to admin matches */
/* RESPONSIVE SOLUTION - Use flexbox for consistent alignment */
.admin-match-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 20px;
    font-size: var(--base-font-size, 16px);
}

.admin-match-table tr {
    display: flex;
    width: 100%;
}

/* VS column - fixed width, always centered */
.admin-match-table .vs {
    width: 40px !important;
    min-width: 40px;
    max-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10;
    background: transparent;
    border: none;
    padding: 0;
}

/* VS SVG - properly centered */
.admin-match-table .vs::before {
    content: '';
    width: 20px;
    height: 20px;
    background-image: url('v-graphic.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    z-index: 15;
}

/* Team cells - equal flex distribution */
.admin-match-table .team-cell {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 10px;
    position: relative;
    z-index: 2;
    cursor: pointer;
}

.admin-match-table .team-cell.team-left {
    text-align: left;
    padding-right: 5px;
}

.admin-match-table .team-cell.team-right {
    text-align: right;
    padding-left: 5px;
}

/* Winner and Loser styling */
.admin-match-table .team-cell.winner {
    background-color: var(--win-background-color, #90EE90) !important;
    font-weight: bold;
}

.admin-match-table .team-cell.loser {
    background-color: var(--loss-background-color, #FFB6C1) !important;
}

/* Player name styling - these are the rectangles that should be highlighted */
.admin-match-table .player-name {
    /* Player name styling - sized to content, not stretched */
    .admin-match-table .player-name {
        margin: 0;
        padding: 3px 5px;
        display: inline-block; /* Keep inline-block to size to content */
        margin-bottom: 5px;
        background-color: var(--player-name-background-color, #f0f0f0);
        color: var(--player-name-text-color, #333333);
        border-radius: 3px;
        position: relative;
        z-index: 3;
        width: auto; /* Ensure width is auto to fit content */
        max-width: none; /* Remove any max-width constraints */
        flex: none; /* Prevent flex stretching */
    }
    
    .admin-match-table .team-cell.winner .player-name,
    .admin-match-table .team-cell.loser .player-name {
        background-color: rgba(255, 255, 255, 0.7);
        width: auto; /* Ensure width is auto to fit content */
        flex: none; /* Prevent flex stretching */
    }
    
    /* FIXED: Purple highlight ONLY for player name rectangles - sized to content */
    .admin-match-table .player-name.highlight {
        background-color: var(--highlight-color, #AE308F) !important;
        color: var(--highlight-text-color, white) !important;
        z-index: 20 !important;
        position: relative !important;
        opacity: 1 !important;
        width: auto !important; /* Ensure highlighted names are also sized to content */
        flex: none !important; /* Prevent flex stretching */
    }
    
    /* Ensure highlight overrides winner/loser styles for player names only */
    .admin-match-table .team-cell.winner .player-name.highlight,
    .admin-match-table .team-cell.loser .player-name.highlight {
        background-color: var(--highlight-color, #AE308F) !important;
        color: var(--highlight-text-color, white) !important;
        z-index: 20 !important;
        opacity: 1 !important;
        width: auto !important; /* Ensure highlighted names are sized to content */
        flex: none !important; /* Prevent flex stretching */
    }
}

.admin-match-table .team-cell.winner .player-name,
.admin-match-table .team-cell.loser .player-name {
    background-color: rgba(255, 255, 255, 0.7);
}

/* FIXED: Purple highlight ONLY for player name rectangles */
.admin-match-table .player-name.highlight {
    background-color: var(--highlight-color, #AE308F) !important;
    color: var(--highlight-text-color, white) !important;
    z-index: 20 !important; /* Higher than VS graphic to prevent ghosting */
    position: relative !important;
    opacity: 1 !important;
}

/* Ensure highlight overrides winner/loser styles for player names only */
.admin-match-table .team-cell.winner .player-name.highlight,
.admin-match-table .team-cell.loser .player-name.highlight {
    background-color: var(--highlight-color, #AE308F) !important;
    color: var(--highlight-text-color, white) !important;
    z-index: 20 !important;
    opacity: 1 !important;
}

/* Remove any cell-level highlighting */
.admin-match-table td.highlight,
.admin-match-table .team-cell.highlight {
    background-color: inherit !important; /* Don't highlight entire cells */
}

/* Remove the problematic ::after pseudo-elements that cause alignment issues */
.admin-match-table .team-left.winner:after,
.admin-match-table .team-left.loser:after,
.admin-match-table .team-right.winner:after,
.admin-match-table .team-right.loser:after {
    display: none !important;
}