/* Player Details Modal Styles */

/* Tab Navigation Styles */
.player-modal-tabs {
    position: relative;
    width: 100%;
    z-index: 1;
}

.player-modal-tabs .tab-buttons {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 15px;
}

.player-modal-tabs .tab-button {
    padding: 10px 15px;
    cursor: pointer;
    border: none;
    background-color: transparent;
    font-family: 'Roboto Condensed';
    font-size: 1rem;
    font-weight: 500;
    color: #555;
    position: relative;
    transition: color 0.3s ease;
    outline: none;
}

.player-modal-tabs .tab-button:hover {
    color: #2c3e50;
    background-color: #f9f9f9;
}

.player-modal-tabs .tab-button.active {
    color: var(--primary);
    font-weight: 600;
}

.player-modal-tabs .tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    z-index: 1;
    width: 100%;
}

/* Rating History Table Styles */
.rating-history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 14px;
}

.rating-history-table th,
.rating-history-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.rating-history-table th {
    background-color: #f5f5f5;
    font-weight: 600;
}

.rating-history-table .positive-change {
    color: #27ae60;
    font-weight: 600;
}

.rating-history-table .negative-change {
    color: #e74c3c;
    font-weight: 600;
}

/* Sub Badge Styles */
.sub-badge {
    display: inline-block;
    background-color: #ff9800;
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

.substitute-game {
    border-left: 3px solid #ff9800;
}

/* Rank Badge Styles */
.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 16px;
    border-radius: 5px;
    font-weight: 600;
    font-size: 0.65rem;
    padding: 0 3px;
    margin-left: 6px;
    vertical-align: middle;
}

.elo-badge {
    background-color: #6c757d;
    color: white;
}

.division-rank-badge {
    background-color: var(--primary, #2c3e50);
    color: white;
}

.rank-icon {
    margin-right: 2px;
    font-size: 0.5rem;
}
#player-details-modal {
    z-index: 1100; /* Higher than the team fixtures modal */
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow-y: auto;
}

#player-details-modal .modal-content {
    max-width: 800px;
    width: 100%;
    min-width: 320px;
    max-height: 95vh;
    overflow: hidden; /* Prevent content from overflowing modal bounds */
    height:95%;
    margin: 5vh auto;
    position: relative;
    background: #fff;
    flex-direction: column;
    padding: 0;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    animation: modalFadeIn 0.3s;
}

@keyframes modalFadeIn {
    from {opacity: 0; transform: translateY(-20px);}
    to {opacity: 1; transform: translateY(0);}
}

#player-details-modal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px 12px 24px;
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--primary, #2c3e50);
    color: white;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

#player-details-modal .modal-body {
    overflow-y: auto;
    max-height: calc(95vh - 80px); /* Account for header height */
    padding: 18px 24px 18px 24px;
    flex: 1;
}

#player-details-modal h2 {
    margin: 0;
    font-size: 1.4em;
    color: white;
}

#player-details-modal .close-button {
    background: none;
    border: none;
    font-size: 2rem;
    color: white;
    cursor: pointer;
    z-index: 2;
    transition: color 0.2s;
    margin-left: 12px;
}

#player-details-modal .close-button:hover {
    color: #ddd;
}

/* Loading spinner */
#player-details-modal .loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    color: #666;
}

#player-details-modal .spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #c44f00;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Player details */
#player-details-modal .detail-section {
    margin-bottom: 20px;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

#player-details-modal .detail-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.2em;
    color: var(--primary, #2c3e50);
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
}

#player-details-modal .player-info-columns {
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

#player-details-modal .player-info-column {
    flex: 1;
}

#player-details-modal .detail-row {
    display: flex;
    margin-bottom: 8px;
}

#player-details-modal .detail-label {
    font-weight: bold;
    width: 120px;
    flex-shrink: 0;
}

#player-details-modal .detail-value {
    flex-grow: 1;
}

/* Games list */
#player-details-modal .games-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 400px; /* Limit height to prevent overflow */
    overflow-y: auto; /* Add scrolling when content exceeds height */
    padding: 5px;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    background: #fff;
}

#player-details-modal .player-game {
    background-color: white;
    border-radius: 6px;
    padding: 2px 2px 2px 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-bottom: 0px;
}

/* #player-details-modal .player-game:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
} */

/* Fixture accordion styles */
#player-details-modal .fixture-accordion {
    margin-top: 8px;
    padding: 8px;
    background-color: #f9f9f9;
    border-radius: 4px;
    border-top: 1px solid #eee;
}

#player-details-modal .fixture-accordion .loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    font-size: 12px;
    color: #666;
}

#player-details-modal .fixture-accordion .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    border-top-color: #333;
    border-radius: 50%;
    animation: spinner 0.8s linear infinite;
}

#player-details-modal .fixture-accordion .error-message {
    color: #d9534f;
    text-align: center;
    padding: 10px;
}

#player-details-modal .game-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
}

#player-details-modal .game-info {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#player-details-modal .game-result-info {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    font-size: 12px;
}

#player-details-modal .game-date {
    font-size: 0.8rem;
    color: #666;
    font-weight: 500;
    min-width: 70px;
}

#player-details-modal .game-fixture {
    font-size: 12px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

#player-details-modal .game-fixture a {
    color: var(--primary, #2c3e50);
    text-decoration: none;
}

#player-details-modal .game-fixture a:hover {
    text-decoration: underline;
}

#player-details-modal .game-result {
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    display: inline-block;
}

#player-details-modal .win {
    background-color: rgba(76, 175, 80, 0.1);
    color: #4CAF50;
}

#player-details-modal .loss {
    background-color: rgba(244, 67, 54, 0.1);
    color: #F44336;
}

#player-details-modal .upcoming {
    background-color: rgba(158, 158, 158, 0.1);
    color: #9E9E9E;
}

#player-details-modal .rated-badge {
    background-color: rgba(33, 150, 243, 0.1);
    color: #2196F3;
    font-size: 0.75em;
    font-weight: 600;
    padding: 2px 4px;
    border-radius: 3px;
    margin-left: 4px;
}

#player-details-modal .player-details-error {
    padding: 10px;
    text-align: center;
    background: #f8d7da;
    color: #721c24;
    border-radius: 4px;
    font-size: 0.95em;
    margin-top: 1rem;
}

#player-details-modal .no-games {
    text-align: center;
    color: #666;
    padding: 20px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #player-details-modal .modal-content {
        width: 95vw;
        min-width: unset;
        max-width: 95vw;
    }
    
    #player-details-modal .modal-body {
        padding: 12px;
    }
    
    #player-details-modal .detail-section {
        padding: 10px;
    }
    
    #player-details-modal .detail-row {
        flex-direction: column;
    }
    
    #player-details-modal .detail-label {
        width: 100%;
        margin-bottom: 2px;
    }
    
    #player-details-modal .game-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    #player-details-modal .game-score {
        margin-top: 5px;
    }
}
