/* Player Profile Page Styles */

.player-profile {
    padding: 40px 0;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 30px;
    margin-bottom: 40px;
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.profile-picture {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #2c5f2d;
}

.profile-picture.default {
    background: linear-gradient(135deg, #2c5f2d 0%, #4a8c4b 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
    color: white;
    font-weight: bold;
}

.profile-info {
    flex: 1;
}

.profile-info h2 {
    margin: 0 0 10px 0;
    color: #2c5f2d;
    font-size: 2.5em;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-align: center;
}

.ranking-card {
    background: linear-gradient(180deg, #ffffff 0%, #fbfbfb 100%);
    border: 1px solid var(--border-color);
}

.ranking-card .stat-value {
    color: var(--primary-color);
    font-size: 2.2em;
}

.stat-card h3 {
    margin: 0 0 10px 0;
    color: #2c5f2d;
    font-size: 1.2em;
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
    color: #333;
}

.stat-label {
    font-size: 0.9em;
    color: #666;
    margin-top: 5px;
}

.match-history {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.match-history h3 {
    margin: 0 0 20px 0;
    color: #2c5f2d;
    font-size: 1.8em;
}

.matches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
    gap: 20px;
}


.player-score {
    display: block;
    font-size: 0.85em;
    color: #666;
}

.vs-divider {
    font-weight: bold;
    font-size: 1em;
    color: #999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.vs-divider .score {
    font-size: 1.8em;
    font-weight: bold;
    color: #2c5f2d;
    line-height: 1;
}

.vs-divider .vs-text {
    font-size: 0.85em;
    color: #999;
    letter-spacing: 1px;
}

.match-stats {
    background: white;
    padding: 12px 15px;
    border-radius: 5px;
    margin-bottom: 15px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label {
    color: #666;
    font-size: 0.9em;
}

.stat-value {
    font-weight: 500;
    color: #333;
}

.rating-change {
    font-weight: bold;
    margin-left: 8px;
    font-size: 0.85em;
    padding: 3px 8px;
    border-radius: 12px;
    display: inline-block;
}

.rating-change.positive {
    color: #fff;
    background: linear-gradient(135deg, #2c5f2d 0%, #4a8c4b 100%);
    box-shadow: 0 2px 4px rgba(44, 95, 45, 0.3);
}

.rating-change.negative {
    color: #fff;
    background: linear-gradient(135deg, #c41e3a 0%, #e74c3c 100%);
    box-shadow: 0 2px 4px rgba(196, 30, 58, 0.3);
}

.no-data {
    text-align: center;
    padding: 40px;
    color: #666;
}

.back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: #2c5f2d;
    text-decoration: none;
    font-weight: bold;
}

.back-link:hover {
    text-decoration: underline;
}

.arm-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: bold;
    margin-left: 10px;
}

.arm-badge.left {
    background: #336934;
    color: white;
}

.arm-badge.right {
    background: #161b64;
    color: white;
}

.match-video {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.match-video .instagram-media {
    margin: 0 auto !important;
    max-width: 540px !important;
}

.round-details {
    margin-top: 15px;
    border-top: 1px solid #eee;
    padding-top: 15px;
}

.round-details summary {
    cursor: pointer;
    color: #2c5f2d;
    font-weight: 500;
    padding: 5px 0;
    user-select: none;
}

.round-details summary:hover {
    color: #4a8c4b;
}

.rounds-list {
    margin-top: 15px;
}

.round-item {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 15px;
    align-items: center;
    padding: 10px 15px;
    background: #f9f9f9;
    border-radius: 5px;
    margin-bottom: 8px;
}

.round-label {
    font-weight: 500;
    color: #333;
    min-width: 80px;
}

.round-winner {
    color: #333;
    font-size: 0.95em;
}

.round-winner strong {
    color: #2c5f2d;
}

.round-ratings {
    color: #666;
    font-size: 0.9em;
    white-space: nowrap;
}

/* Compressed match history styles */
.compressed-match {
    margin-bottom: 18px;
    background: #f8f8f8;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    border: 1px solid #e0e0e0;
    overflow: hidden;
}
.compressed-match > summary {
    cursor: pointer;
    padding: 12px 18px;
    font-size: 1.05em;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 18px;
    background: #f0f0f0;
    border-bottom: 1px solid #e0e0e0;
}
.compressed-match[open] > summary {
    background: #e8f5e9;
}
.winner-loser-summary {
    flex: 1;
    color: #333;
}
.rating-change-summary {
    font-weight: bold;
    margin-left: 12px;
}
.expanded-match-details {
    padding: 18px;
    background: white;
}

/* Full-width match history table */
.match-history-table-container {
    width: 100%;
    overflow-x: auto;
}
.match-history-table {
    width: 100%;
    border-collapse: collapse;
    margin: 30px 0;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    font-size: 1em;
}
.match-history-table th, .match-history-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #e0e0e0;
    text-align: left;
}
.match-history-table th {
    background: #f0f0f0;
    font-weight: 600;
    color: #2c5f2d;
    text-transform: uppercase;
    font-size: 0.95em;
}
.match-history-table tr:last-child td {
    border-bottom: none;
}
.match-details-table-wrapper {
    margin-top: 10px;
    overflow-x: auto;
}
.match-details-table {
    margin: 0;
    box-shadow: none;
    background: transparent;
}
.match-details-table th {
    background: transparent;
    color: #444;
}
.match-details-table tr:last-child td {
    border-bottom: none;
}
.match-details-table .rating-change {
    font-weight: 600;
}
.round-details {
    margin-top: 8px;
}
.rounds-list {
    margin-top: 8px;
    background: #f9f9f9;
    border-radius: 6px;
    padding: 8px;
}
.round-item {
    margin-bottom: 6px;
    font-size: 0.98em;
}

/* Details row styles for match history table */
.match-details-row td {
    background: #f9f9f9;
    padding: 18px 24px;
    border-bottom: 1px solid #e0e0e0;
}
.details-toggle-btn {
    background: #e8f5e9;
    color: #2c5f2d;
    border: none;
    border-radius: 4px;
    padding: 6px 16px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}
.details-toggle-btn:hover {
    background: #c8e6c9;
}

@media (max-width: 768px) {
    .match-history-table-container {
        overflow-x: visible;
    }
    .match-history-table thead {
        position: absolute;
        clip: rect(1px, 1px, 1px, 1px);
        width: 1px;
        height: 1px;
        overflow: hidden;
    }
    .match-history-table,
    .match-history-table tbody,
    .match-history-table tr,
    .match-history-table td {
        display: block;
        width: 100%;
    }
    .match-history-table tr {
        margin-bottom: 18px;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        background: #fff;
        box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    }
    .match-history-table td {
        padding-left: 46%;
        text-align: right;
        border-bottom: 1px solid #f0f0f0;
        position: relative;
        min-height: 48px;
    }
    .match-history-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 14px;
        top: 50%;
        transform: translateY(-50%);
        font-weight: 600;
        text-transform: uppercase;
        color: #2c5f2d;
        font-size: 0.8em;
        letter-spacing: 0.04em;
    }
    .match-history-table td:last-child {
        text-align: left;
    }
    .match-history-table tr:last-child td {
        border-bottom: 1px solid #f0f0f0;
    }
    .match-details-row td {
        padding: 12px;
    }
}

.player-comments-section {
    margin-top: 40px;
}

.elo-history-section {
    margin-bottom: 40px;
}

.elo-history-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 20px;
}

.elo-history-canvas-wrapper {
    width: 100%;
    max-width: 900px;
    height: 360px;
    margin: 0 auto;
    position: relative;
}

.elo-history-section canvas {
    width: 100% !important;
    height: 100% !important;
    max-height: 360px;
    display: block;
}

.elo-history-legend {
    margin-top: 10px;
    font-size: 0.95em;
    color: #666;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .matches-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {   
    .match-result {
        flex-direction: column;
        gap: 15px;
    }
    
    .round-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .round-label {
        font-weight: bold;
    }
}