/* 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-contact-panel {
    margin-top: 20px;
    padding: 18px 20px;
    border: 1px solid #dce8dc;
    border-radius: 14px;
    background: #f8fcf8;
}

.profile-contact-panel__header h3 {
    margin: 0 0 6px;
    color: #1f4f21;
    font-size: 1.15rem;
}

.profile-contact-panel__header p {
    margin: 0;
    color: #557255;
}

.training-role-pill {
    display: inline-flex;
    align-items: center;
    margin-top: 14px;
    padding: 7px 16px;
    border-radius: 999px;
    background: rgba(44, 95, 45, 0.12);
    color: #1f5b20;
    font-weight: 700;
    font-size: 0.92rem;
}

.profile-contact-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-top: 14px;
}

.profile-contact-meta__item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #355635;
    font-weight: 600;
}

.profile-contact-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.profile-contact-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    text-decoration: none;
    background: #fff;
    border: 1px solid #d7e5d7;
    color: #234b24;
    font-weight: 600;
}

.profile-contact-link:hover {
    border-color: #b9d2b9;
    transform: translateY(-1px);
}

.profile-contact-notes,
.profile-contact-empty {
    margin: 16px 0 0;
    color: #425842;
    line-height: 1.65;
}

.form-section-heading {
    margin: 18px 0 8px;
    color: #1f4f21;
    font-weight: 700;
    font-size: 1rem;
}

.form-grid-two {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.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;
}

.match-video-player {
    display: block;
    width: 100%;
    max-width: 540px;
    border-radius: 10px;
    background: #000;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
}

.match-video-meta {
    margin-top: 10px;
}

.match-video-link {
    color: #2c5f2d;
    font-weight: 600;
    text-decoration: none;
}

.match-video-link:hover {
    text-decoration: underline;
}

.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;

@media (max-width: 768px) {
    .form-grid-two {
        grid-template-columns: 1fr;
    }
}
    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 {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    background: #fff;
    color: #2c5f2d;
    border: 1px solid #2c5f2d;
    border-radius: 4px;
    min-height: 38px;
    padding: 8px 16px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
    transition: background-color 0.2s;
}
.details-toggle-btn:hover {
    background-color: #f3f7f3;
}

.match-history-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.match-history-actions > * {
    min-width: 84px;
}

.match-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    text-decoration: none;
    background-color: #fff;
    color: #2c5f2d;
    border: 1px solid #2c5f2d;
    min-height: 38px;
    padding: 8px 16px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
}

.match-action-btn:hover {
    background-color: #f3f7f3;
}

.match-id-link {
    color: #2c5f2d;
    font-weight: 600;
    text-decoration: none;
}

.match-id-link:hover {
    text-decoration: underline;
}

@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;
    }
}

/* Profile header inline-style replacements */
.profile-overall-rating {
    font-size: 1.2em;
    color: #666;
}

.profile-overall-rating__value {
    color: #2c5f2d;
}

.profile-weight {
    color: #666;
}

.profile-weight-empty {
    color: #999;
    font-style: italic;
}

.profile-bio-box {
    margin-top: 15px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 5px;
}

.profile-bio-text {
    color: #666;
    white-space: pre-wrap;
}

.profile-bio-empty {
    color: #999;
    font-style: italic;
    margin-top: 10px;
}

/* Edit profile + upload picture UI (extracted from player.php) */
.profile-picture-container {
    position: relative;
    display: inline-block;
}

.upload-picture-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background-color: rgba(44, 95, 45, 0.9);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    padding-top: 2px;
    padding-left: 7px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.upload-picture-btn:hover {
    background-color: rgba(30, 70, 32, 0.95);
}

.edit-profile-btn {
    background-color: #2c5f2d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-top: 10px;
}

.edit-profile-btn:hover {
    background-color: #1e4620;
}

.profile-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.profile-actions .edit-profile-btn {
    margin-top: 0;
}

.compare-profile-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    background-color: #fff;
    color: #2c5f2d;
    border: 1px solid #2c5f2d;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
}

.compare-profile-btn:hover {
    background-color: #f3f7f3;
}

.player-profile .modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
    overflow: auto;
    display: none;
}

.player-profile .modal-content {
    background-color: #fefefe;
    margin: 230px auto;
    padding: 30px;
    border: 1px solid #888;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.player-profile .close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

.player-profile .close:hover,
.player-profile .close:focus {
    color: #000;
}

.player-profile .form-group {
    margin-bottom: 20px;
}

.player-profile .form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

.player-profile .form-group input,
.player-profile .form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
    font-family: inherit;
}

.player-profile .form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.player-profile .form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 12px;
}

.player-profile .form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.player-profile .btn-primary {
    background-color: #2c5f2d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    flex: 1;
}

.player-profile .btn-primary:hover {
    background-color: #1e4620;
}

.player-profile .btn-secondary {
    background-color: #999;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
}

.player-profile .btn-secondary:hover {
    background-color: #777;
}

.player-profile .edit-message {
    margin-top: 15px;
    padding: 10px;
    border-radius: 4px;
    font-size: 14px;
    display: none;
}

.player-profile .edit-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.player-profile .edit-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.edit-modal-divider {
    margin: 20px 0;
    border: 0;
    border-top: 1px solid #e0e0e0;
}

.upload-picture-details {
    margin-top: 10px;
}

.upload-picture-summary {
    cursor: pointer;
    font-weight: 600;
    color: #2c5f2d;
}

.upload-picture-body {
    margin-top: 12px;
}

#crop-container {
    display: none;
    margin: 20px 0;
}

.crop-header {
    margin-bottom: 10px;
}

.crop-subtext {
    display: block;
    color: #666;
}

.crop-canvas-wrapper {
    position: relative;
    max-width: 100%;
    overflow: hidden;
    background: #f0f0f0;
    border-radius: 8px;
}

#crop-canvas {
    max-width: 100%;
    display: block;
    cursor: crosshair;
}

.crop-options {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.crop-option {
    display: flex;
    align-items: center;
    gap: 5px;
}

#upload-submit-btn {
    display: none;
}

.is-hidden {
    display: none;
}

.elo-history-title {
    margin-bottom: 10px;
}

.elo-legend-swatch {
    font-weight: 600;
}

.elo-legend-swatch--avg {
    color: #2c5f2d;
}

.elo-legend-swatch--left {
    color: #3498db;
}

.elo-legend-swatch--right {
    color: #e67e22;
}