/* Scorecard Viewer Styles */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8f5e9 50%, #f5f5f5 100%);
    background-attachment: fixed;
    color: #333;
    line-height: 1.6;
    position: relative;
}

/* Tennis-themed background decorations */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(17, 153, 142, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 90% 80%, rgba(56, 239, 125, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.scorecard-container {
    position: relative;
    z-index: 1;
}

.scorecard-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.scorecard-header {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.scorecard-header::before {
    content: '🎾';
    position: absolute;
    left: 30px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3rem;
    opacity: 0.2;
}

.scorecard-header::after {
    content: '🎾';
    position: absolute;
    right: 30px;
    top: 50%;
    transform: translateY(-50%) scaleX(-1);
    font-size: 3rem;
    opacity: 0.2;
}

.scorecard-header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    font-weight: 300;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 30px;
    background: #000;
    border-radius: 8px 8px 0 0;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
}

.tab-button {
    flex: 1;
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: #fff;
    text-transform: uppercase;
    transition: all 0.3s ease;
    position: relative;
    text-align: center;
}

.tab-button::before {
    content: '🎾';
    margin-right: 8px;
    opacity: 0.6;
    font-size: 0.9rem;
}

.tab-button:hover {
    color: #38ef7d;
    background-color: rgba(56, 239, 125, 0.1);
}

.tab-button.active {
    color: #38ef7d;
    border-bottom-color: #38ef7d;
    font-weight: 600;
    background-color: rgba(56, 239, 125, 0.15);
}

.tab-button.active::before {
    opacity: 1;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Search Filters */
.search-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.filter-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    background-color: white;
    cursor: pointer;
}

.filter-group select:focus {
    outline: none;
    border-color: #11998e;
    box-shadow: 0 0 0 3px rgba(17, 153, 142, 0.1);
}

.search-button {
    padding: 10px 24px;
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(17, 153, 142, 0.3);
}

.search-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(17, 153, 142, 0.4);
    background: linear-gradient(135deg, #38ef7d 0%, #11998e 100%);
}

.search-button:active {
    transform: translateY(0);
}

/* Player Search Section */
.player-search-section {
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.search-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
}

.search-input-group label {
    font-weight: 500;
    color: #555;
    white-space: nowrap;
}

.search-input-group input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.search-input-group input:focus {
    outline: none;
    border-color: #11998e;
    box-shadow: 0 0 0 3px rgba(17, 153, 142, 0.1);
}

.player-search-results {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
    min-height: 0;
}

.player-search-results:empty {
    display: none;
}

.player-result-item {
    padding: 10px;
    margin-bottom: 8px;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
    border: 1px solid #e0e0e0;
}

.player-result-item:hover {
    background-color: #e8f5e9;
    border-color: #11998e;
}

.player-result-item.selected {
    background-color: #e8eaf6;
    border-color: #667eea;
}

.player-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.player-info {
    font-size: 0.9rem;
    color: #666;
}

.selected-player-info {
    padding: 15px 20px;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border: 2px solid #11998e;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(17, 153, 142, 0.1);
}

.selected-player-info h4 {
    margin: 0;
    color: #11998e;
    font-size: 1.1rem;
    font-weight: 600;
}

.selected-player-info h4::before {
    content: '🎾 ';
}

.btn-clear-selection {
    padding: 8px 20px;
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(17, 153, 142, 0.2);
}

.btn-clear-selection:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(17, 153, 142, 0.3);
    background: linear-gradient(135deg, #38ef7d 0%, #11998e 100%);
}

.btn-clear-selection:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

/* Results Container */
.results-container {
    min-height: 200px;
}

.placeholder-text {
    text-align: center;
    color: #999;
    padding: 40px;
    font-style: italic;
}

/* Matches table style */
.matches-table-wrapper {
    border: 2px solid #c0c0c0;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 5px;
}

.matches-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.matches-table thead {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.matches-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-right: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    user-select: none;
}

.matches-table th[data-sort-column] {
    cursor: pointer;
    transition: background-color 0.2s;
}

.matches-table th[data-sort-column]:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.matches-table th .sort-indicator {
    display: inline-block;
    margin-left: 8px;
    font-size: 0.8em;
    opacity: 0.7;
    transition: opacity 0.2s, color 0.2s;
}

.matches-table th:last-child {
    border-right: 1px solid rgba(255, 255, 255, 0.3);
}

.matches-table tbody tr {
    border-bottom: 1px solid #d8d8d8;
    cursor: pointer;
    transition: background-color 0.2s;
}

.matches-table tbody tr:hover {
    background-color: #e8f5e9;
}

.matches-table tbody tr:nth-child(even) {
    background-color: #fafafa;
}

.matches-table tbody tr:nth-child(even):hover {
    background-color: #f8f9ff;
}

.matches-table td {
    padding: 12px 16px;
    color: #333;
    border-right: 1px solid #e8e8e8;
    font-size: 0.95rem;
}

.matches-table td:last-child {
    border-right: none;
}

.teams-cell {
    white-space: nowrap;
}

.team-name-inline {
    font-weight: 500;
    color: #333;
    margin-right: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
    display: inline-block;
    vertical-align: middle;
}

.team-name-inline.winner {
    font-weight: 700;
    color: #2e7d32;
    background-color: #e8f5e9;
    padding: 2px 6px;
    border-radius: 3px;
}

.team-score-inline {
    font-weight: 600;
    color: #11998e;
    margin-right: 8px;
}

.team-score-inline.winner {
    color: #1b5e20;
    font-weight: 700;
}

.vs-inline {
    color: #999;
    margin: 0 6px;
    font-size: 0.9rem;
}

/* Legacy match card style (keep for backwards compatibility) */
.match-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border-left: 4px solid #11998e;
}

.match-card:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.loading {
    text-align: center;
    padding: 40px;
    color: #11998e;
}

.loading::before {
    content: '🎾 ';
    font-size: 1.5rem;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.error {
    text-align: center;
    padding: 20px;
    background: #ffebee;
    color: #c62828;
    border-radius: 4px;
    margin: 20px 0;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    margin: auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    padding: 20px 30px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    gap: 20px;
    min-width: 0; /* Allows flex items to shrink */
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0; /* Allows flex item to shrink below content size */
}

.modal-close {
    color: white;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: opacity 0.2s;
    flex-shrink: 0; /* Prevents close button from shrinking */
}

.modal-close:hover {
    opacity: 0.7;
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

/* Error Dialog Styling */
#error-dialog-modal {
    z-index: 2000; /* Higher than regular modals */
}

.error-dialog-content {
    max-width: 500px;
}

.error-dialog-content .modal-header {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
}

.error-dialog-content .modal-body {
    padding: 30px;
    text-align: center;
}

.error-dialog-content #error-dialog-message {
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 25px;
    line-height: 1.6;
}

.error-dialog-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.error-dialog-actions .search-button {
    min-width: 100px;
    padding: 10px 24px;
}

.match-details-header {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.match-details-header h3 {
    margin-bottom: 10px;
    color: #333;
}

.detail-row {
    display: flex;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 20px;
}

.detail-label {
    font-weight: 600;
    color: #666;
    min-width: 120px;
    flex-shrink: 0;
}

.detail-value {
    color: #333;
    flex: 1;
    min-width: 0; /* Allows flex item to shrink below content size */
}

/* Prevent wrapping for team names - apply to Teams and Winner rows */
.detail-row:nth-of-type(5) .detail-value,
.detail-row:nth-of-type(7) .detail-value {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.match-lineups {
    margin-top: 30px;
}

.match-lineups h3 {
    margin-bottom: 20px;
    color: #333;
    border-bottom: 2px solid #11998e;
    padding-bottom: 10px;
}

.lineup-type-section {
    margin-bottom: 30px;
}

.lineup-type-header {
    font-size: 1.1rem;
    font-weight: 600;
    color: #11998e;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
}

.lineup-type-header::before {
    content: '🎾 ';
}

.lineup-columns-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    align-items: flex-start;
}

.lineup-column {
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    overflow: hidden;
    min-width: 0; /* Prevents grid overflow */
}

.lineup-column-header {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    padding: 10px 15px;
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lineup-court {
    font-weight: 600;
}

.lineup-column-content {
    padding: 15px;
}

.lineup-teams-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
    align-items: stretch;
}

.team-box {
    padding: 12px;
    background: white;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.team-box.winner {
    border: 2px solid #4caf50;
    background: #e8f5e9;
}

.team-label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #666;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 20px;
    line-height: 1.4;
    flex-shrink: 0;
}

.player-name-detail {
    margin-bottom: 4px;
    color: #333;
    font-size: 0.9rem;
    line-height: 1.4;
    min-height: 20px;
}

.player-name-detail:last-child {
    margin-bottom: 0;
}

.player-name-detail.clickable-player {
    color: #11998e;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s;
}

.player-name-detail.clickable-player:hover {
    color: #38ef7d;
    text-decoration: underline;
}

.sets-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    align-items: stretch;
}

.set-score-compact {
    background: white;
    padding: 8px 10px;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 60px;
}

.set-label {
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 4px;
    font-weight: 500;
    line-height: 1.2;
}

.set-score-value {
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
    line-height: 1.3;
    white-space: nowrap;
}

.points-earned {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
    font-weight: 600;
    color: #11998e;
}

/* Legacy styles for backward compatibility */
.lineup-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    border-left: 4px solid #667eea;
}

.lineup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.lineup-type {
    background: #11998e;
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
}

.lineup-players {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 15px;
}

.player-team {
    padding: 15px;
    background: white;
    border-radius: 4px;
}

.player-team.winner {
    border: 2px solid #4caf50;
    background: #e8f5e9;
}

.sets-scores {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.sets-scores h4 {
    margin-bottom: 10px;
    color: #666;
    font-size: 0.9rem;
}

.set-scores {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.set-score {
    background: white;
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    text-align: center;
    min-width: 60px;
}

.set-number {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 4px;
}

.set-values {
    font-weight: 600;
    color: #333;
}

.match-notes {
    margin-top: 20px;
    padding: 15px;
    background: #fff9e6;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
}

.match-notes h4 {
    margin-bottom: 8px;
    color: #666;
}

.match-notes p {
    color: #333;
    white-space: pre-wrap;
}

/* Standings Section */
.standings-section {
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.standings-filters {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.standings-container {
    min-height: 200px;
}

.standings-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.standings-header h2 {
    color: #333;
    font-size: 2rem;
    margin-bottom: 8px;
}

.standings-subtitle {
    color: #666;
    font-size: 0.9rem;
}

.standings-category {
    margin-bottom: 40px;
}

.category-title {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 1.3rem;
    font-weight: 600;
}

.category-title::before {
    content: '🎾 ';
}

.standings-group {
    margin-bottom: 35px;
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    border: 1px solid #e8e8e8;
    overflow: visible;
}

.group-header {
    color: #2c3e50;
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 3px solid #11998e;
    letter-spacing: 0.3px;
}

.standings-table-wrapper {
    border: 2px solid #a0a0a0;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 5px;
}

.standings-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin: 0;
}

.standings-table thead {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.standings-table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-right: 1px solid rgba(255, 255, 255, 0.3);
    border-bottom: 2px solid rgba(255, 255, 255, 0.4);
}

.standings-table th:first-child {
    border-left: 1px solid rgba(255, 255, 255, 0.3);
}

.standings-table th:last-child {
    border-right: 1px solid rgba(255, 255, 255, 0.3);
}

.standings-table tbody tr {
    border-bottom: 1px solid #d8d8d8;
    transition: all 0.2s ease;
    background-color: white;
}

.standings-table tbody tr:hover {
    background-color: #e8f5e9;
    box-shadow: 0 2px 4px rgba(17, 153, 142, 0.1);
}

.standings-table tbody tr:last-child {
    border-bottom: none;
}

.standings-table tbody tr:nth-child(even) {
    background-color: #fafafa;
}

.standings-table tbody tr:nth-child(even):hover {
    background-color: #f8f9ff;
}

.standings-table td {
    padding: 14px 16px;
    color: #333;
    border-right: 1px solid #d8d8d8;
    border-left: 1px solid transparent;
    font-size: 0.95rem;
}

.standings-table td:first-child {
    border-left: 1px solid #d8d8d8;
    font-weight: 700;
    color: #11998e;
    width: 70px;
    text-align: center;
    font-size: 1rem;
    border-right: 2px solid #c0c0c0;
    background-color: #e8f5e9;
}

.standings-table td:last-child {
    border-right: 1px solid #d8d8d8;
}

.team-name-cell {
    font-weight: 600;
    color: #2c3e50;
    font-size: 1rem;
}

.total-points-cell {
    font-weight: 700;
    color: #11998e;
    font-size: 1.1rem;
}

/* Player Match Table Styles */
.player-match-season-group {
    margin-bottom: 40px;
}

.player-match-season-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.player-match-hint {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 15px;
    font-style: italic;
}

.player-match-table-wrapper {
    border: 2px solid #c0c0c0;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 5px;
}

.player-match-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 0.9rem;
}

.player-match-table thead {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.player-match-table th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-right: 1px solid rgba(255, 255, 255, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.player-match-table th:last-child {
    border-right: 1px solid rgba(255, 255, 255, 0.3);
}

.player-match-table .sub-header th {
    padding: 6px 12px;
    font-size: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.player-match-table tbody tr {
    border-bottom: 1px solid #d8d8d8;
    cursor: pointer;
    transition: background-color 0.2s;
}

.player-match-table tbody tr:hover {
    background-color: #e8f5e9;
}

.player-match-table tbody tr.win-row {
    background-color: #f8fff8;
}

.player-match-table tbody tr.loss-row {
    background-color: white;
}

.player-match-table tbody tr.win-row:hover {
    background-color: #f0f8f0;
}

.player-match-table tbody tr.loss-row:hover {
    background-color: #f0f4ff;
}

.player-match-table td {
    padding: 10px 12px;
    color: #333;
    border-right: 1px solid #e8e8e8;
}

.player-match-table td:last-child {
    border-right: none;
}

.win-loss-cell {
    font-weight: 700;
    text-align: center;
    font-size: 1rem;
}

.win-loss-cell.win {
    color: #2e7d32;
}

.win-loss-cell.loss {
    color: #c62828;
}

/* Responsive */
@media (max-width: 768px) {
    .scorecard-container {
        padding: 10px;
    }

    .scorecard-header {
        padding: 20px 15px;
        margin-bottom: 20px;
    }

    .scorecard-header::before,
    .scorecard-header::after {
        display: none; /* Hide decorative emojis on mobile */
    }

    .scorecard-header h1 {
        font-size: 1.75rem;
        margin-bottom: 8px;
    }

    .subtitle {
        font-size: 0.95rem;
    }

    /* Tabs - fit all tabs without scrolling */
    .tabs {
        display: flex;
        gap: 0;
        margin-bottom: 20px;
        border-radius: 8px;
        padding: 0;
        overflow: hidden;
    }

    .tab-button {
        flex: 1;
        padding: 10px 8px;
        font-size: 0.75rem;
        white-space: normal;
        text-align: center;
        border-bottom: 3px solid transparent;
        touch-action: manipulation;
        min-width: 0;
        word-wrap: break-word;
        line-height: 1.3;
    }

    .tab-button::before {
        display: none; /* Hide emoji on mobile to save space */
    }

    .tab-button.active {
        border-bottom-color: #38ef7d;
    }

    /* Search Filters */
    .search-filters {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }

    .filter-group {
        width: 100%;
        min-width: 0;
    }

    .search-button {
        width: 100%;
        padding: 12px 24px;
    }

    /* Player Search Section */
    .player-search-section {
        padding: 15px;
    }

    .search-input-group {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .search-input-group label {
        margin-bottom: 0;
    }

    .search-input-group input {
        width: 100%;
    }

    #search-player-btn {
        width: 100%;
    }

    .selected-player-info {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
        text-align: center;
    }

    .selected-player-info h4 {
        font-size: 1rem;
    }

    .btn-clear-selection {
        width: 100%;
    }

    /* Results Container */
    .results-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Tables - make horizontally scrollable on mobile */
    .matches-table-wrapper,
    .standings-table-wrapper,
    .player-match-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        display: block;
    }

    .matches-table,
    .standings-table,
    .player-match-table {
        min-width: 600px; /* Ensure table doesn't get too compressed */
        font-size: 0.8rem;
    }

    .matches-table th,
    .matches-table td {
        padding: 8px 10px;
        font-size: 0.8rem;
    }

    .standings-table th,
    .standings-table td {
        padding: 10px 8px;
        font-size: 0.8rem;
    }

    .player-match-table th,
    .player-match-table td {
        padding: 8px 6px;
        font-size: 0.75rem;
    }

    /* Team names in cells - allow wrapping on mobile */
    .team-name-inline {
        max-width: 150px;
        white-space: normal;
        word-wrap: break-word;
    }

    .teams-cell {
        white-space: normal;
        word-wrap: break-word;
    }

    /* Modal */
    .modal-content {
        width: 95%;
        max-width: 95%;
        max-height: 95vh;
        margin: 10px;
    }

    .modal-header {
        padding: 15px 20px;
        flex-wrap: wrap;
    }

    .modal-header h2 {
        font-size: 1.2rem;
        white-space: normal;
        word-wrap: break-word;
    }

    .modal-close {
        font-size: 1.5rem;
    }

    .modal-body {
        padding: 15px;
    }

    /* Match Details */
    .match-details-header {
        margin-bottom: 20px;
        padding-bottom: 15px;
    }

    .match-details-header h3 {
        font-size: 1.1rem;
    }

    .detail-row {
        flex-direction: column;
        gap: 5px;
        margin-bottom: 12px;
    }

    .detail-label {
        min-width: 0;
        font-size: 0.9rem;
    }

    .detail-value {
        font-size: 0.95rem;
        word-wrap: break-word;
    }

    /* Lineups */
    .lineup-columns-container {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .lineup-column {
        min-width: 0;
    }

    .lineup-teams-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .lineup-players {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .sets-row {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .set-score-compact {
        padding: 6px 8px;
        min-height: 50px;
    }

    .set-label {
        font-size: 0.7rem;
    }

    .set-score-value {
        font-size: 0.85rem;
    }

    /* Standings */
    .standings-section {
        padding: 15px;
    }

    .standings-filters {
        flex-direction: column;
        gap: 15px;
    }

    .standings-header {
        margin-bottom: 20px;
        padding-bottom: 15px;
    }

    .standings-header h2 {
        font-size: 1.5rem;
    }

    .standings-group {
        padding: 15px;
        margin-bottom: 25px;
    }

    .category-title {
        font-size: 1.1rem;
        padding: 12px 15px;
    }

    .group-header {
        font-size: 1rem;
        margin-bottom: 15px;
        padding-bottom: 10px;
    }

    /* Player Search Results */
    .player-search-results {
        padding: 12px;
    }

    .player-result-item {
        padding: 12px;
    }

    .player-name {
        font-size: 1rem;
    }

    .player-info {
        font-size: 0.85rem;
    }

    /* Player Match Tables */
    .player-match-season-group {
        margin-bottom: 30px;
    }

    .player-match-season-title {
        font-size: 1.1rem;
    }

    .player-match-hint {
        font-size: 0.85rem;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .scorecard-container {
        padding: 8px;
    }

    .scorecard-header {
        padding: 15px 10px;
    }

    .scorecard-header h1 {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 0.85rem;
    }

    .tabs {
        margin-bottom: 15px;
    }

    .tab-button {
        padding: 8px 4px;
        font-size: 0.7rem;
        line-height: 1.2;
    }

    .search-filters,
    .player-search-section,
    .standings-section {
        padding: 12px;
    }

    .matches-table,
    .standings-table,
    .player-match-table {
        min-width: 500px;
        font-size: 0.75rem;
    }

    .matches-table th,
    .matches-table td {
        padding: 6px 8px;
    }

    .standings-table th,
    .standings-table td {
        padding: 8px 6px;
    }

    .player-match-table th,
    .player-match-table td {
        padding: 6px 4px;
        font-size: 0.7rem;
    }

    .modal-content {
        width: 98%;
        max-width: 98%;
        margin: 5px;
    }

    .modal-header {
        padding: 12px 15px;
    }

    .modal-header h2 {
        font-size: 1rem;
    }

    .modal-body {
        padding: 12px;
    }

    .category-title {
        font-size: 1rem;
        padding: 10px 12px;
    }
}

