/* Matches Page Styles */

.matches-page {
    padding: 40px 0;
}

.date-section {
    margin-bottom: 50px;
}

.date-header {
    color: #2c5f2d;
    font-size: 1.8em;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 3px solid #2c5f2d;
    padding-left: 1rem;
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 30px 0;
}

.table-scroll--nested {
    margin: 0;
}

.table-scroll table {
    margin: 0;
    padding: 1rem;
}

.table-scroll--nested table {
    min-width: 540px;
}

/* Shared match history table styles */
.match-history-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    font-size: 1em;
}

.matches-table {
    min-width: 680px;
}

.match-history-table th,
.match-history-table td {
    padding: 12px 16px;
    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-history-table .positive { color: #2c5f2d; }
.match-history-table .negative { color: #d32f2f; }

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

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

.match-details-row td {
    background: #f9f9f9;
    padding: 24px;
}

.details-toggle-btn {
    background: #e8f5e9;
    color: #2c5f2d;
    border: none;
    border-radius: 4px;
    padding: 8px 18px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s ease;
}

.details-toggle-btn:hover {
    background: #c8e6c9;
}

.match-details-content {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
}

.match-video {
    min-width: 260px;
}

.match-video--uploaded {
    flex: 1 1 320px;
    max-width: 540px;
}

.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 {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    color: #444;
}

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

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

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

.match-video.no-video {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 20px;
    border: 1px dashed #c5c5c5;
}

.match-video.no-video p {
    margin-bottom: 12px;
    color: #555;
}

.match-video-upload-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.match-video-dropzone {
    min-width: min(100%, 340px);
}

.match-video-preview.has-files {
    grid-template-columns: minmax(220px, 320px);
}

.match-video-preview .gallery-preview-card {
    width: 100%;
}

.match-video-preview .gallery-preview-thumb {
    max-height: 220px;
    object-fit: cover;
}

.match-video-actions {
    justify-content: flex-start;
}

.match-video .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    border-radius: 6px;
    border: none;
    background: #2c5f2d;
    color: #fff;
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 12px;
}

.match-video form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.match-video form input[type="url"] {
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
}

.video-form-actions {
    display: flex;
    gap: 10px;
}

.video-form-actions .btn.submit {
    background: #2c5f2d;
}

.video-form-actions .btn.cancel {
    background: #6c757d;
}

.match-details-table-wrapper {
    flex: 2 1 400px;
    min-width: 320px;
}

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

.match-summary {
    margin-top: 12px;
    font-size: 0.95em;
    color: #555;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.rating-change {
    font-weight: 600;
}

.match-summary .rating-change {
    white-space: nowrap;
}

.match-summary .rating-change.positive {
    color: #2c5f2d;
}

.match-summary .rating-change.negative {
    color: #d32f2f;
}

.match-elo-chart-card {
    margin-top: 1rem;
    padding: 1rem 1.1rem;
    background: #fff;
    border: 1px solid rgba(18, 63, 52, 0.08);
    border-radius: 16px;
}

.match-elo-chart-wrapper {
    position: relative;
    width: 100%;
    height: 280px;
}

.match-elo-chart-wrapper canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

.no-data {
    text-align: center;
    padding: 60px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.no-data p {
    color: #666;
    font-size: 1.1em;
}

/* Responsive Design */
@media (max-width: 900px) {
    .match-details-content {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .matches-table .match-number-cell {
        display: none;
    }
    .matches-page {
        padding: 28px 0;
    }

    .date-section {
        margin-bottom: 32px;
    }

    .date-header {
        font-size: 1.4em;
        padding-left: 0.5rem;
        padding-bottom: 4px;
        margin-bottom: 10px;
    }

    .table-scroll {
        margin: 20px 0;
    }

    .table-scroll,
    .table-scroll--nested {
        overflow-x: auto;
    }

    .table-scroll--nested table,
    .matches-table {
        min-width: 680px;
    }

    .matches-table .details-toggle-btn {
        padding: 6px 12px;
        font-size: 0.9em;
    }

    .match-history-table th,
    .match-history-table td {
        padding: 10px 12px;
    }

    .match-details-row td {
        padding: 16px;
    }

    .match-details-content {
        gap: 16px;
    }

    .match-details-table th,
    .match-details-table td {
        padding: 8px 10px;
        font-size: 0.9em;
    }

    .match-summary {
        font-size: 0.85em;
    }

    .match-video.no-video {
        padding: 12px;
    }

    .match-video--uploaded {
        max-width: 100%;
    }
}

@media (max-width: 600px) {
    .matches-page {
        padding: 20px 0;
    }

    .date-header {
        font-size: 1.25em;
    }

    .match-summary {
        flex-direction: column;
        gap: 4px;
    }

    .match-details-table-wrapper {
        width: 100%;
    }

    .match-video {
        min-width: 100%;
    }

    .match-video .btn {
        width: 100%;
    }
}

/* Public matches refresh */
.matches-page {
    padding: 52px 0 72px;
}

.date-section {
    margin-bottom: 2rem;
    padding: 1.4rem;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.84);
    border: 1px solid rgba(18, 63, 52, 0.08);
    box-shadow: var(--shadow);
}

.date-header {
    display: inline-flex;
    align-items: center;
    margin-bottom: 1.1rem;
    padding: 0.45rem 0.9rem;
    border: 0;
    border-radius: 999px;
    background: rgba(18, 63, 52, 0.08);
    color: var(--primary-dark);
    font-size: 1rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.table-scroll {
    margin: 0;
}

.match-history-table {
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid rgba(18, 63, 52, 0.08);
    box-shadow: none;
}

.match-history-table th {
    background: linear-gradient(135deg, #123f34 0%, #0e2d25 100%);
    color: #ffffff;
    border-bottom: 0;
}

.match-history-table td {
    border-bottom-color: rgba(20, 33, 29, 0.08);
}

.match-history-table tbody tr:hover:not(.match-details-row) {
    background: rgba(18, 63, 52, 0.03);
}

.match-player-link {
    color: var(--primary-dark);
}

.match-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.match-actions > * {
    flex: 1 1 0;
}

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

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

.details-toggle-btn {
    border-width: 1px;
}

.details-toggle-btn:hover {
    background-color: #f3f7f3;
}

.match-page {
    padding: 2rem 0 4rem;
}

.match-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 1.5rem;
    color: var(--primary-dark);
    font-weight: 700;
    text-decoration: none;
}

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

.match-overview {
    display: grid;
    grid-template-columns: minmax(280px, 1.1fr) minmax(280px, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.match-vs-card,
.match-meta-card,
.match-detail-card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(18, 63, 52, 0.08);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.match-vs-card {
    padding: 1.5rem;
}

.match-vs-meta {
    margin-bottom: 0.85rem;
    color: #5f6f69;
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.match-vs-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    font-size: clamp(1.4rem, 4vw, 2rem);
    font-weight: 800;
}

.match-vs-line span {
    color: #76857e;
    font-size: 0.9rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.match-vs-line a {
    color: var(--primary-dark);
    text-decoration: none;
}

.match-vs-line a:hover {
    text-decoration: underline;
}

.match-vs-score {
    display: inline-flex;
    align-items: baseline;
    gap: 0.4rem;
    color: var(--primary-dark);
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 900;
}

.match-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.match-meta-card {
    padding: 1.2rem;
}

.match-meta-card span {
    display: block;
    margin-bottom: 0.35rem;
    color: #6c7d76;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.match-meta-card strong {
    display: block;
    color: var(--primary-dark);
    font-size: 1.15rem;
}

.match-detail-card {
    padding: 1.5rem;
}

.match-details-row td {
    background: linear-gradient(180deg, rgba(244,248,245,0.95) 0%, rgba(255,255,255,0.95) 100%);
}

@media (max-width: 768px) {
    .date-section {
        padding: 1rem;
    }

    .matches-table tr {
        border-radius: 18px;
        border-color: rgba(18, 63, 52, 0.1);
        box-shadow: var(--shadow);
    }

    .match-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .match-actions .match-action-btn,
    .match-actions .details-toggle-btn {
        width: 100%;
    }

    .match-overview,
    .match-meta-grid {
        grid-template-columns: 1fr;
    }

    .match-vs-card,
    .match-detail-card {
        padding: 1.1rem;
    }
}
