/* Scrims & Earnings Page Specific Styles */

/* Page Header */
.page-header {
    padding: 90px 0 15px; /* Increased top padding from 60px to 90px for proper navbar clearance */
    position: relative;
    background: #1a1a2e !important;
    overflow: hidden;
}

.header-background,
.stars,
.galaxy-overlay {
    display: none !important;
}

.header-content {
    text-align: center;
    position: relative;
    z-index: 2;
}

.page-title {
    font-family: var(--font-primary);
    font-size: 3.5rem; /* Reduced from 4rem to save vertical space */
    font-weight: 800;
    color: white;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.7);
    margin-bottom: 0.8rem; /* Reduced from 1rem */
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* Summary Stats Section */
.stats-summary {
    padding: 1.5rem 0 0.8rem; /* Reduced from 2rem 0 1rem to save vertical space */
    background: #1a1a2e;
    margin-top: 0;
    position: relative;
    z-index: 2;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    max-width: 1000px;
    margin: 0 auto;
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(107, 70, 193, 0.2);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-card);
    border-color: var(--primary-purple);
}

.stat-icon {
    width: 60px;
    height: 60px;
    background: var(--gradient-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    flex-shrink: 0;
}

.stat-content h3 {
    font-family: var(--font-primary);
    font-size: 2rem;
    font-weight: 700;
    background: var(--gradient-secondary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.3rem;
}

.stat-content .stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: var(--font-secondary);
}

/* Controls Section */
.controls-section {
    padding: 0.8rem 0 0.4rem; /* Reduced from 1rem 0 0.5rem to save vertical space */
    background: #1a1a2e;
    position: relative;
    z-index: 1;
}

.controls-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0 1rem;
}

.section-title {
    font-family: var(--font-primary);
    font-size: 2.5rem;
    font-weight: 800;
    color: white;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.7);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.controls-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

/* Admin Controls */
.admin-controls {
    display: flex;
    gap: 1rem;
}

.add-match-btn,
.export-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    white-space: nowrap;
}

.add-match-btn {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-glow);
}

.add-match-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(107, 70, 193, 0.4);
}

.export-btn {
    background: var(--gradient-accent);
    color: white;
}

.export-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(236, 72, 153, 0.4);
}

/* Filters */
.filters {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.filter-select {
    padding: 0.7rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(107, 70, 193, 0.3);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 140px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-purple);
    box-shadow: 0 0 10px rgba(107, 70, 193, 0.3);
}

.filter-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 0.5rem;
}

/* Matches Section */
.matches-section {
    padding: 0.5rem 1rem 1rem;
    background: #1a1a2e;
    position: relative;
    margin-bottom: 0;
}

.table-container {
    background: transparent;
    border: none;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: none;
    position: relative;
    z-index: 2;
    min-height: 495px;
    display: flex;
    flex-direction: column;
}


.table-wrapper {
    overflow: hidden;
    flex: 1;
    position: relative;
    width: 100%;
    height: 100%;
}

/* Ensure auth required state takes full container space when shown */
#authRequiredState {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(26, 26, 46, 0.98);
    backdrop-filter: blur(15px);
    border-radius: 20px;
}

/* Ensure table wrapper takes full space when shown */
#tableWrapper {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 5;
}

/* Force hide auth required when table is shown */
#tableWrapper[style*="block"] + #authRequiredState,
#tableWrapper:not([style*="none"]) ~ #authRequiredState {
    display: none !important;
}

/* Force hide table when auth required is shown */
#authRequiredState[style*="block"] ~ #tableWrapper,
#authRequiredState:not([style*="none"]) ~ #tableWrapper {
    display: none !important;
}

/* Ensure proper transitions */
#tableWrapper, #authRequiredState {
    transition: all 0.3s ease;
}

/* Additional safety: ensure mutual exclusivity */
.table-container:has(#authRequiredState[style*="flex"]) #tableWrapper {
    display: none !important;
}

.table-container:has(#tableWrapper[style*="block"]) #authRequiredState {
    display: none !important;
}

.table-wrapper::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: var(--primary-purple);
    border-radius: 4px;
    transition: background 0.3s ease;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-purple);
}

.table-wrapper::-webkit-scrollbar-corner {
    background: rgba(255, 255, 255, 0.1);
}

/* Table Styles */
.matches-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
    font-family: var(--font-secondary);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.matches-table thead {
    background: linear-gradient(45deg, rgba(59, 130, 246, 0.95), rgba(147, 51, 234, 0.95));
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
    display: table-header-group;
}

.matches-table th {
    padding: 1.2rem 1rem;
    text-align: left;
    font-family: var(--font-primary);
    font-weight: 600;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.95rem;
    border-bottom: 2px solid rgba(59, 130, 246, 0.5);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    background: linear-gradient(45deg, rgba(59, 130, 246, 0.95), rgba(147, 51, 234, 0.95));
    backdrop-filter: blur(10px);
}

.matches-table td {
    padding: 1.2rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
    font-family: var(--font-secondary);
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    background: transparent;
}

.matches-table tbody {
    display: block;
    overflow-y: auto;
    overflow-x: hidden;
    height: 375px;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-purple) transparent;
    padding-bottom: 10px;
    box-sizing: border-box;
}

.matches-table tbody::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.matches-table tbody::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin-bottom: 8px;
}

.matches-table tbody::-webkit-scrollbar-thumb {
    background: var(--primary-purple);
    border-radius: 4px;
    transition: background 0.3s ease;
    margin-bottom: 8px;
}

.matches-table tbody::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-purple);
}

.matches-table tbody::-webkit-scrollbar-corner {
    background: transparent;
}

.matches-table thead tr,
.matches-table tbody tr {
    display: table;
    width: 100%;
    table-layout: fixed;
}

.matches-table tbody tr {
    transition: all 0.3s ease;
    border-radius: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.matches-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.05);
    transform: translateX(5px);
}

.matches-table tbody tr:hover td {
    background: rgba(59, 130, 246, 0.05);
}

/* Table Cell Styles */
.date-display {
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
    font-family: var(--font-primary);
}

.org-badge {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.org-badge.pmco {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent-blue);
    border: 1px solid var(--accent-blue);
}

.org-badge.pmpl {
    background: rgba(16, 185, 129, 0.2);
    color: #10B981;
    border: 1px solid #10B981;
}

.org-badge.pmc {
    background: rgba(245, 158, 11, 0.2);
    color: var(--gold);
    border: 1px solid var(--gold);
}

.org-badge.custom {
    background: rgba(236, 72, 153, 0.2);
    color: var(--accent-pink);
    border: 1px solid var(--accent-pink);
}

.tournament-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.tournament-name {
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}

.tournament-type {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
}

.position-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 30px;
    border-radius: 15px;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
}

.position-badge.position-1 {
    background: var(--gradient-accent);
    color: white;
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.3);
}

.position-badge.position-2 {
    background: rgba(107, 114, 128, 0.8);
    color: white;
}

.position-badge.position-3 {
    background: rgba(245, 158, 11, 0.8);
    color: white;
}

.position-badge:not(.position-1):not(.position-2):not(.position-3) {
    background: rgba(59, 130, 246, 0.9);
    color: white;
    border: 1px solid rgba(59, 130, 246, 0.7);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.players-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.player-tag {
    display: inline-block;
    background: rgba(59, 130, 246, 0.2);
    color: rgba(59, 130, 246, 0.9);
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid rgba(59, 130, 246, 0.4);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.1);
}

.earnings-amount {
    font-family: var(--font-primary);
    font-size: 1.15rem;
    font-weight: 800;
    color: #10B981;
    text-shadow: 0 1px 2px rgba(16, 185, 129, 0.2);
    letter-spacing: 0.5px;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.edit-match-btn,
.delete-match-btn {
    width: 35px;
    height: 35px;
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.edit-match-btn {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent-blue);
    border: 1px solid var(--accent-blue);
}

.edit-match-btn:hover {
    background: var(--accent-blue);
    color: white;
    transform: scale(1.1);
}

.delete-match-btn {
    background: rgba(239, 68, 68, 0.2);
    color: #EF4444;
    border: 1px solid #EF4444;
}

.delete-match-btn:hover {
    background: #EF4444;
    color: white;
    transform: scale(1.1);
}

/* View Players Button */
.view-players-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.4);
    border-radius: 8px;
    color: rgba(59, 130, 246, 0.9);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    font-family: var(--font-secondary);
}

.view-players-btn:hover {
    background: rgba(59, 130, 246, 0.25);
    border-color: var(--primary-purple);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(107, 70, 193, 0.2);
}

.view-players-btn i {
    font-size: 0.9rem;
}

/* Players Modal Styles */
.players-modal-content {
    max-width: 600px;
    width: 90%;
}

.players-modal-body {
    padding: 1.5rem 2rem 2rem;
}

.players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.player-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(107, 70, 193, 0.2);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.player-card:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-purple);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(107, 70, 193, 0.2);
}

.player-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid rgba(107, 70, 193, 0.3);
}

.player-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.player-info {
    flex: 1;
    min-width: 0;
}

.player-name {
    font-family: var(--font-primary);
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-role {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.no-players {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-style: italic;
    grid-column: 1 / -1;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8) !important;
    backdrop-filter: blur(5px);
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s ease;
    align-items: center;
    justify-content: center;
}

.modal[style*="block"] {
    display: flex !important;
    opacity: 1;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.modal-content {
    background: linear-gradient(145deg, #1a1b3e, #2a2d5f) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 0;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    position: relative;
}

.modal-header {
    padding: 2rem 2rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-family: var(--font-primary);
    color: white;
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.close-modal:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.match-form {
    padding: 2rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-family: var(--font-secondary);
}

.form-group input,
.form-group select {
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(107, 70, 193, 0.3);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: var(--font-secondary);
    transition: all 0.3s ease;
    cursor: pointer;
}

.form-group select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 8px 12px;
    font-size: 0.9rem;
    border: none;
}

.form-group select option:hover,
.form-group select option:checked {
    background: var(--primary-purple);
    color: #FFFFFF;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-purple);
    box-shadow: 0 0 10px rgba(107, 70, 193, 0.3);
    background: rgba(255, 255, 255, 0.08);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

/* Players Checkboxes */
.players-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.8rem;
    margin-top: 0.5rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.checkbox-item:hover {
    background: rgba(107, 70, 193, 0.1);
}

.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-purple);
    cursor: pointer;
}

.checkbox-item span {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(30, 41, 59, 0.8);
    margin: 1rem;
    border-radius: 16px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 8;
}

/* Specific styling for auth required state */
#authRequiredState.empty-state {
    margin: 0;
    border-radius: 0;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border: none;
    box-shadow: none;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.empty-state i {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    color: #CBD5E0;
}

.empty-state h3 {
    font-family: var(--font-primary);
    font-size: 1.6rem;
    margin-bottom: 1rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.empty-state p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.7);
    max-width: 400px;
    margin: 0 auto;
}

.empty-state .login-link {
    display: inline-block;
    margin-top: 1rem;
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.empty-state .login-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    text-decoration: none;
    color: white;
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.loading-state i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    animation: spin 1s linear infinite;
}

/* User Status Styles */
.user-status {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: var(--font-secondary);
    transition: all 0.3s ease;
    margin-top: 1rem;
}

.user-status.logged-in {
    background: rgba(16, 185, 129, 0.2);
    color: #10B981;
    border: 1px solid #10B981;
}

.user-status.logged-out {
    background: rgba(239, 68, 68, 0.2);
    color: #EF4444;
    border: 1px solid #EF4444;
}

.user-status .status-text {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.user-status.logged-in .status-text::before {
    content: '✓';
    font-weight: bold;
}

.user-status.logged-out .status-text::before {
    content: '⚠';
    font-weight: bold;
}

/* Footer Section */
.footer {
    background: #1a1a2e;
    position: relative;
    z-index: 1;
    margin-top: 0;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 1.5rem;
}

.btn-primary,
.btn-secondary {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-family: var(--font-secondary);
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 15px rgba(107, 70, 193, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(107, 70, 193, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* ===========================
   DESKTOP ENHANCEMENTS
   =========================== */

/* Desktop-specific empty state styling (769px and above) */
@media (min-width: 769px) {
    .empty-state {
        padding: 2.5rem 3rem; /* Reduced from 5rem 4rem to make it more compact */
        background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
        backdrop-filter: blur(20px);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 20px; /* Slightly reduced border radius */
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4); /* Reduced shadow spread */
        margin: 1.5rem auto; /* Reduced top/bottom margin */
        max-width: 550px; /* Reduced max width */
        position: relative;
        overflow: visible; /* Changed from hidden to visible to ensure login button is not clipped */
        z-index: 10; /* Ensure empty state appears above table container */
    }

    /* Ensure authentication required state is properly displayed and centered */
    #authRequiredState {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        visibility: visible !important;
        opacity: 1 !important;
        z-index: 20 !important;
        margin: auto !important;
    }
    
    /* Ensure all content inside auth required state is centered */
    #authRequiredState * {
        text-align: center !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* When user is authenticated, hide auth required and show table */
    .authenticated #authRequiredState {
        display: none !important;
    }

    .authenticated #tableWrapper {
        display: block !important;
    }

    .empty-state::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 4px;
        background: var(--gradient-primary);
    }

    .empty-state i {
        font-size: 3.5rem; /* Reduced from 5rem to make it more compact */
        margin-bottom: 1.5rem; /* Reduced from 2rem */
        color: #667eea;
        text-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
    }

    .empty-state h3 {
        font-size: 2rem; /* Reduced from 2.5rem */
        margin-bottom: 1rem; /* Reduced from 1.5rem */
        color: rgba(255, 255, 255, 0.95);
        font-weight: 800;
        text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
        letter-spacing: 1px;
    }

    .empty-state p {
        font-size: 1.1rem; /* Reduced from 1.2rem */
        line-height: 1.6; /* Reduced from 1.8 */
        color: rgba(255, 255, 255, 0.8);
        max-width: 400px; /* Reduced from 500px */
        margin: 0 auto 2rem auto; /* Reduced bottom margin from 2.5rem */
        font-weight: 500;
    }

    .empty-state .login-link {
        display: inline-flex !important; /* Added !important to ensure visibility */
        align-items: center;
        gap: 0.7rem; /* Slightly reduced gap */
        margin-top: 1.5rem; /* Reduced from 2rem */
        padding: 1rem 2.5rem; /* Reduced padding for more compact button */
        background: var(--gradient-primary);
        border-radius: 12px; /* Slightly reduced border radius */
        font-weight: 700;
        font-size: 1rem; /* Slightly reduced font size */
        box-shadow: 0 8px 25px rgba(107, 70, 193, 0.4); /* Reduced shadow */
        border: 1px solid rgba(255, 255, 255, 0.1);
        text-transform: uppercase;
        letter-spacing: 1px;
        visibility: visible !important; /* Ensure the button is always visible */
        opacity: 1 !important; /* Ensure the button is always opaque */
        z-index: 1000; /* Ensure button appears above other elements */
    }

    .empty-state .login-link::before {
        content: '🔐';
        font-size: 1.3rem;
    }

    .empty-state .login-link:hover {
        transform: translateY(-4px) scale(1.03);
        box-shadow: 0 15px 45px rgba(107, 70, 193, 0.6);
        background: linear-gradient(135deg, rgba(107, 70, 193, 0.9) 0%, rgba(59, 130, 246, 0.9) 100%);
    }
}

/* ===========================
   RESPONSIVE DESIGN - ENHANCED
   =========================== */

/* Tablet Landscape (1024px and below) */
@media (max-width: 1024px) {
    .page-title {
        font-size: 3rem;
    }
    
    .controls-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
        padding: 0 0.5rem;
    }

    .controls-actions {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .table-wrapper {
        font-size: 0.85rem;
    }

    .matches-table th,
    .matches-table td {
        padding: 0.8rem 0.6rem;
    }
    
    .player-tag {
        font-size: 0.75rem;
        padding: 0.25rem 0.6rem;
    }
}

/* Tablet Portrait & Mobile Landscape (768px and below) */
@media (max-width: 768px) {
    /* Page Header */
    .page-header {
        padding: 70px 20px 20px;
    }
    
    .page-title {
        font-size: clamp(2rem, 8vw, 2.5rem);
        letter-spacing: 1px;
    }

    /* Stats Section */
    .stats-summary {
        padding: 1.5rem 0 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0 15px;
    }

    .stat-card {
        padding: 1.2rem;
        flex-direction: row;
        align-items: center;
    }

    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }

    .stat-content h3 {
        font-size: 1.6rem;
    }

    .stat-content .stat-label {
        font-size: 0.85rem;
    }

    /* Controls Section */
    .controls-section {
        padding: 1rem 0 0.5rem;
    }

    .controls-header {
        gap: 1rem;
        padding: 0 15px;
    }

    .section-title {
        font-size: clamp(1.6rem, 6vw, 1.8rem);
    }

    .controls-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        width: 100%;
    }

    .admin-controls {
        display: flex;
        justify-content: center;
        width: 100%;
    }

    .add-match-btn {
        width: 100%;
        max-width: 350px;
        justify-content: center;
        padding: 0.9rem 1.5rem;
        font-size: 0.95rem;
    }

    .filters {
        flex-direction: column;
        gap: 0.8rem;
        width: 100%;
    }

    .filter-select {
        width: 100%;
        padding: 0.85rem 1rem;
        font-size: 0.9rem;
        min-height: 48px;
        /* Fix mobile dropdown overflow */
        max-height: 48px;
        overflow: hidden;
        position: relative;
        z-index: 10;
    }
    
    /* Fix dropdown options overflow on mobile */
    .filter-select option {
        padding: 0.8rem 1rem !important;
        font-size: 0.9rem !important;
        background: var(--bg-secondary) !important;
        color: var(--text-primary) !important;
        border: none !important;
        max-width: 100vw !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    
    /* Ensure select dropdown stays within viewport */
    .filters {
        position: relative;
        overflow: visible;
        z-index: 10;
    }

    /* Matches Section - Full Width Mobile Layout */
    .matches-section {
        padding: 0;
        margin: 0;
    }
    
    /* Remove global container padding for matches section on mobile */
    .matches-section .container {
        padding: 0 !important;
    }

    .table-container {
        border-radius: 0;
        background: transparent;
        backdrop-filter: none;
        border: none;
        box-shadow: none;
        margin: 0;
        width: 100%;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        height: auto;
        max-height: 60vh;
    }

    .table-wrapper {
        overflow-x: hidden;
        overflow-y: auto;
        scrollbar-width: thin;
        scrollbar-color: #667eea rgba(107, 70, 193, 0.1);
        -webkit-overflow-scrolling: touch;
        padding: 0;
        width: 100%;
        box-sizing: border-box;
        height: auto;
    }

    /* Enhanced scrollbar for mobile */
    .table-wrapper::-webkit-scrollbar {
        width: 8px;
    }

    .table-wrapper::-webkit-scrollbar-track {
        background: rgba(107, 70, 193, 0.1);
        border-radius: 4px;
    }

    .table-wrapper::-webkit-scrollbar-thumb {
        background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
        border-radius: 4px;
        border: 1px solid rgba(255, 255, 255, 0.2);
    }

    .table-wrapper::-webkit-scrollbar-thumb:hover {
        background: linear-gradient(180deg, #5a67d8 0%, #6b46c1 100%);
    }

    /* Transform table to stacked card layout for mobile */
    .matches-table {
        width: 100%;
        border-collapse: separate;
        border-spacing: 0;
    }

    .matches-table thead {
        display: none; /* Hide headers on mobile */
    }

    .matches-table tbody {
        display: block;
        width: 100%;
    }

    .matches-table tr {
        display: block;
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 12px;
        margin-bottom: 1rem;
        padding: 1.2rem;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
        transition: all 0.3s ease;
        width: 100%;
        box-sizing: border-box;
    }

    /* Alternating row colors for better mobile UX - Dark theme */
    .matches-table tr:nth-child(even) {
        background: linear-gradient(145deg, rgba(59, 130, 246, 0.08), rgba(147, 51, 234, 0.05)) !important;
        border-color: rgba(59, 130, 246, 0.2) !important;
        box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15) !important;
    }

    .matches-table tr:nth-child(odd) {
        background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02)) !important;
        border-color: rgba(255, 255, 255, 0.1) !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
    }

    /* Enhanced font colors for better contrast and readability */
    .matches-table tr:nth-child(even) .date-display,
    .matches-table tr:nth-child(even) .tournament-name {
        color: rgba(255, 255, 255, 0.9) !important;
        font-weight: 700 !important;
    }

    .matches-table tr:nth-child(even) .tournament-type {
        color: rgba(255, 255, 255, 0.7) !important;
        font-weight: 600 !important;
    }

    .matches-table tr:nth-child(even) .earnings-amount {
        color: #10B981 !important;
        font-weight: 800 !important;
        text-shadow: 0 1px 2px rgba(16, 185, 129, 0.2) !important;
    }

    /* Standard odd row text colors */
    .matches-table tr:nth-child(odd) .date-display,
    .matches-table tr:nth-child(odd) .tournament-name {
        color: rgba(255, 255, 255, 0.9) !important;
        font-weight: 700 !important;
    }

    .matches-table tr:nth-child(odd) .tournament-type {
        color: rgba(255, 255, 255, 0.7) !important;
        font-weight: 600 !important;
    }

    .matches-table tr:nth-child(odd) .earnings-amount {
        color: #10B981 !important;
        font-weight: 800 !important;
    }

    .matches-table tr:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 25px rgba(107, 70, 193, 0.25) !important;
        background: linear-gradient(145deg, rgba(107, 70, 193, 0.2), rgba(107, 70, 193, 0.15)) !important;
    }

    .matches-table td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.8rem 0;
        border-bottom: 1px solid rgba(107, 70, 193, 0.08);
        background: transparent;
        width: 100%;
        position: relative;
    }

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

    .matches-table td:before {
        content: attr(data-label);
        font-weight: 700;
        color: rgba(135, 206, 235, 0.9);
        font-size: 0.8rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        font-family: var(--font-primary);
        flex-shrink: 0;
        width: 100px;
        margin-right: 1rem;
    }

    /* Center the action column labels */
    .matches-table td.admin-column:before,
    .matches-table td.action-cell:before {
        text-align: center;
        width: 100%;
        margin-right: 0;
        margin-bottom: 0.5rem;
    }

    .matches-table td > * {
        flex: 1;
        text-align: right;
    }

    /* Center action column content in mobile */
    .matches-table td.admin-column > *,
    .matches-table td.action-cell > * {
        text-align: center;
        justify-content: center;
    }

    /* Specific styling for action buttons container */
    .matches-table td.admin-column,
    .matches-table td.action-cell {
        justify-content: center;
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .matches-table td.admin-column .action-buttons,
    .matches-table td.action-cell .action-buttons {
        justify-content: center;
        margin: 0 auto;
        text-align: center;
    }

    /* Mobile-specific cell styling - Optimized for flex layout */
    .date-display {
        font-size: 0.95rem;
        font-weight: 600;
        color: rgba(255, 255, 255, 0.9);
        text-align: right;
    }

    .org-badge {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
        white-space: nowrap;
        display: inline-block;
        border-radius: 12px;
    }

    .tournament-info {
        text-align: right;
        max-width: 200px;
    }

    .tournament-name {
        font-size: 0.9rem;
        line-height: 1.2;
        color: rgba(255, 255, 255, 0.9);
        font-weight: 700;
        margin-bottom: 0.2rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .tournament-type {
        font-size: 0.75rem;
        color: rgba(255, 255, 255, 0.7);
        text-transform: uppercase;
        font-weight: 600;
    }

    .position-badge {
        width: 50px;
        height: 28px;
        font-size: 0.85rem;
        display: inline-flex;
        justify-content: center;
        align-items: center;
        font-weight: bold;
        flex-shrink: 0;
    }

    .view-players-btn {
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
        white-space: nowrap;
        min-height: 36px;
        display: flex;
        justify-content: center;
        align-items: center;
        border-radius: 8px;
        flex-shrink: 0;
    }

    .earnings-amount {
        font-size: 1.1rem;
        font-weight: 700;
        color: #10B981;
        text-align: right;
    }

    .action-buttons {
        justify-content: center;
        gap: 0.6rem;
        display: flex;
        align-items: center;
        flex-shrink: 0;
    }

    .edit-match-btn,
    .delete-match-btn {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
        padding: 0;
        display: inline-flex;
        justify-content: center;
        align-items: center;
        border-radius: 6px;
    }

    /* Modal Optimization */
    .modal-content {
        width: 95%;
        margin: 1rem;
        max-height: 85vh;
    }

    .modal-header {
        padding: 1.5rem 1.5rem 1rem;
    }

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

    .close-modal {
        font-size: 1.3rem;
        padding: 0.4rem;
    }

    .match-form {
        padding: 1.5rem;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
        margin-bottom: 1.2rem;
    }

    .form-group {
        margin-bottom: 1rem;
    }

    .form-group label {
        font-size: 0.85rem;
        margin-bottom: 0.4rem;
    }

    .form-group input,
    .form-group select {
        padding: 0.85rem 0.9rem;
        font-size: 0.9rem;
        min-height: 48px;
    }

    .players-checkboxes {
        grid-template-columns: 1fr;
        gap: 0.6rem;
    }

    .checkbox-item {
        padding: 0.8rem;
        border: 1px solid rgba(107, 70, 193, 0.15);
        border-radius: 10px;
        background: rgba(107, 70, 193, 0.05);
        min-height: 48px;
    }

    .checkbox-item input[type="checkbox"] {
        width: 20px;
        height: 20px;
    }

    .checkbox-item span {
        font-size: 0.9rem;
    }

    .form-actions {
        flex-direction: column;
        gap: 0.8rem;
        padding-top: 1.2rem;
        margin-top: 1.2rem;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        padding: 1rem;
        font-size: 0.95rem;
        min-height: 48px;
    }

    /* Players Modal */
    .players-modal-content {
        width: 95%;
        max-width: 500px;
    }

    .players-modal-body {
        padding: 1.2rem 1.5rem 1.5rem;
    }

    .players-grid {
        grid-template-columns: 1fr;
        gap: 0.8rem;
        max-height: 350px;
    }

    .player-card {
        padding: 0.9rem;
    }

    .player-avatar {
        width: 45px;
        height: 45px;
    }

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

    .player-role {
        font-size: 0.75rem;
    }

    /* Empty State */
    .empty-state {
        padding: 2.5rem 1.5rem;
        margin: 0;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        border-radius: 0;
        background: rgba(30, 41, 59, 0.8);
        color: rgba(255, 255, 255, 0.9);
    }

    .empty-state i {
        font-size: 3rem;
    }

    .empty-state h3 {
        font-size: 1.4rem;
    }

    .empty-state p {
        font-size: 0.9rem;
    }

    .empty-state .login-link {
        padding: 11px 22px;
        font-size: 0.95rem;
        width: 100%;
        max-width: 280px;
    }
}

/* Mobile Portrait (480px and below) */
@media (max-width: 480px) {
    /* Page Header */
    .page-header {
        padding: 65px 15px 20px;
    }

    .page-title {
        font-size: 1.8rem;
        letter-spacing: 0.5px;
    }

    /* Stats Section */
    .stats-summary {
        padding: 1.2rem 0 0.8rem;
    }

    .stats-grid {
        gap: 0.8rem;
        padding: 0 10px;
    }

    .stat-card {
        padding: 1rem;
        gap: 0.8rem;
    }

    .stat-icon {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }

    .stat-content h3 {
        font-size: 1.4rem;
    }

    .stat-content .stat-label {
        font-size: 0.8rem;
    }

    /* Controls */
    .controls-section {
        padding: 0.8rem 0 0.4rem;
    }

    .controls-header {
        padding: 0 10px;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .add-match-btn {
        padding: 0.85rem 1.2rem;
        font-size: 0.9rem;
    }

    .filter-select {
        padding: 0.8rem 0.9rem;
        font-size: 0.85rem;
        /* Additional mobile constraints for very small devices */
        max-width: calc(100vw - 20px);
        box-sizing: border-box;
        position: relative;
    }

    /* Matches Section */
    .matches-section {
        padding: 0.4rem 10px 0.8rem;
    }

    .table-container {
        border-radius: 14px;
        height: auto;
        max-height: 50vh;
    }

    .table-wrapper {
        height: auto;
        max-height: 50vh;
        padding: 0.8rem;
    }

    .matches-table tbody {
        padding: 0.8rem;
    }

    .matches-table tr {
        padding: 1rem;
        margin-bottom: 1rem;
        border-radius: 14px;
    }

    .matches-table td {
        padding: 0.7rem 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
        min-height: auto;
        border-bottom: 1px solid rgba(107, 70, 193, 0.08);
        background: transparent;
    }

    .matches-table td:before {
        font-size: 0.8rem;
        margin-right: 0;
        margin-bottom: 0.3rem;
        width: 100%;
        display: block;
        font-weight: 700;
        color: rgba(135, 206, 235, 0.9);
        text-transform: uppercase;
        letter-spacing: 0.5px;
        font-family: var(--font-primary);
    }

    .matches-table td > * {
        width: 100%;
        text-align: left;
        justify-content: flex-start;
        display: block;
    }

    /* Center action column content in mobile */
    .matches-table td.admin-column > *,
    .matches-table td.action-cell > * {
        text-align: center;
        justify-content: center;
    }

    /* Specific styling for action buttons container in smaller mobile */
    .matches-table td.admin-column,
    .matches-table td.action-cell {
        justify-content: center;
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .matches-table td.admin-column .action-buttons,
    .matches-table td.action-cell .action-buttons {
        justify-content: center;
        margin: 0 auto;
        text-align: center;
        width: auto;
    }

    .date-display {
        font-size: 0.85rem;
    }

    .org-badge {
        font-size: 0.7rem;
        padding: 0.35rem 0.7rem;
    }

    .tournament-info {
        text-align: left;
        align-items: flex-start;
        width: 100%;
    }

    .tournament-name {
        font-size: 0.85rem;
    }

    .tournament-type {
        font-size: 0.7rem;
    }

    .position-badge {
        width: 42px;
        height: 26px;
        font-size: 0.8rem;
        align-self: flex-start;
    }

    .view-players-btn {
        padding: 0.65rem 0.9rem;
        font-size: 0.8rem;
        width: 100%;
        justify-content: center;
    }

    .earnings-amount {
        font-size: 1rem;
        align-self: flex-start;
        font-weight: 700;
        color: #10B981;
        margin: 0.2rem 0;
    }

    .action-buttons {
        justify-content: center;
        width: 100%;
        gap: 0.6rem;
        margin-top: 0.3rem;
    }

    .edit-match-btn,
    .delete-match-btn {
        width: 40px;
        height: 40px;
        font-size: 0.95rem;
        flex-shrink: 0;
    }

    /* Modal - Full Screen */
    .modal-content {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
    }

    .modal-header {
        padding: 1.2rem 1.2rem 0.9rem;
        position: sticky;
        top: 0;
        background: linear-gradient(145deg, #1a1b3e, #2a2d5f);
        z-index: 10;
    }

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

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

    .match-form {
        padding: 1.2rem;
        max-height: calc(100vh - 80px);
        overflow-y: auto;
    }

    .form-group {
        margin-bottom: 0.9rem;
    }

    .form-group label {
        font-size: 0.8rem;
    }

    .form-group input,
    .form-group select {
        padding: 0.8rem;
        font-size: 0.85rem;
    }

    .checkbox-item {
        padding: 0.7rem;
    }

    .checkbox-item input[type="checkbox"] {
        width: 18px;
        height: 18px;
    }

    .checkbox-item span {
        font-size: 0.85rem;
    }

    .form-actions {
        position: sticky;
        bottom: 0;
        background: linear-gradient(145deg, #1a1b3e, #2a2d5f);
        padding: 1rem;
        margin: 0 -1.2rem -1.2rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .btn-primary,
    .btn-secondary {
        padding: 0.9rem;
        font-size: 0.9rem;
    }

    /* Players Modal */
    .players-modal-content {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
    }

    .players-modal-body {
        padding: 1rem;
        max-height: calc(100vh - 80px);
        overflow-y: auto;
    }

    .players-grid {
        max-height: none;
    }

    .player-card {
        padding: 0.8rem;
    }

    .player-avatar {
        width: 40px;
        height: 40px;
    }

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

    .player-role {
        font-size: 0.7rem;
    }

    /* Empty State */
    .empty-state {
        padding: 2rem 1rem;
        margin: 0.5rem;
    }

    .empty-state i {
        font-size: 2.5rem;
    }

    .empty-state h3 {
        font-size: 1.2rem;
    }

    .empty-state p {
        font-size: 0.85rem;
    }

    .empty-state .login-link {
        padding: 10px 20px;
        font-size: 0.9rem;
        width: 100%;
    }
}

/* Extra Small Devices (360px and below) */
@media (max-width: 360px) {
    .page-title {
        font-size: 1.6rem;
    }

    .section-title {
        font-size: 1.3rem;
    }

    .stat-card {
        padding: 0.9rem;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    .stat-content h3 {
        font-size: 1.3rem;
    }

    .stat-content .stat-label {
        font-size: 0.75rem;
    }

    .add-match-btn {
        padding: 0.8rem 1rem;
        font-size: 0.85rem;
    }

    .filter-select {
        padding: 0.75rem 0.8rem;
        font-size: 0.8rem;
    }

    .matches-table tr {
        padding: 0.9rem;
    }

    .matches-table td {
        padding: 0.6rem 0;
    }

    .matches-table td:before {
        font-size: 0.75rem;
    }

    .org-badge,
    .position-badge {
        font-size: 0.65rem;
        padding: 0.3rem 0.6rem;
    }

    .tournament-name {
        font-size: 0.8rem;
    }

    .tournament-type {
        font-size: 0.65rem;
    }

    .view-players-btn {
        padding: 0.6rem 0.8rem;
        font-size: 0.75rem;
    }

    .earnings-amount {
        font-size: 0.95rem;
    }

    .edit-match-btn,
    .delete-match-btn {
        width: 38px;
        height: 38px;
        font-size: 0.9rem;
    }

    .form-group input,
    .form-group select {
        padding: 0.75rem;
        font-size: 0.8rem;
    }

    .checkbox-item {
        padding: 0.65rem;
    }

    .checkbox-item span {
        font-size: 0.8rem;
    }
}

/* Landscape Orientation - Mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .page-header {
        padding: 60px 20px 25px;
    }

    .page-title {
        font-size: 1.5rem;
    }

    .stats-summary {
        padding: 1rem 0 0.5rem;
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.8rem;
    }

    .stat-card {
        padding: 0.8rem;
        flex-direction: column;
        text-align: center;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        margin: 0 auto 0.5rem;
    }

    .modal-content {
        max-height: 95vh;
        overflow-y: auto;
    }

    .match-form {
        max-height: calc(95vh - 80px);
    }

    .players-modal-body {
        max-height: calc(95vh - 80px);
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .matches-table tr:hover,
    .add-match-btn:hover,
    .export-btn:hover,
    .edit-match-btn:hover,
    .delete-match-btn:hover,
    .view-players-btn:hover,
    .player-card:hover {
        transform: none;
    }
    
    .matches-table tr:hover {
        box-shadow: 0 4px 12px rgba(107, 70, 193, 0.1);
    }

    /* Add touch-friendly active states */
    .matches-table tr:active {
        background: rgba(107, 70, 193, 0.05);
    }

    .add-match-btn:active {
        transform: scale(0.98);
    }

    .edit-match-btn:active,
    .delete-match-btn:active {
        transform: scale(0.95);
    }

    .view-players-btn:active {
        transform: scale(0.98);
    }

    .filter-select:active {
        transform: scale(0.99);
    }

    /* Ensure minimum tap targets */
    .edit-match-btn,
    .delete-match-btn {
        min-width: 44px;
        min-height: 44px;
    }

    .add-match-btn {
        min-height: 48px;
    }

    .view-players-btn {
        min-height: 44px;
    }

    .filter-select {
        min-height: 48px;
    }
    
    /* Fix dropdown overflow on mobile devices */
    .filter-select {
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b46c1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: right 1rem center;
        background-size: 1rem;
        padding-right: 3rem;
        max-height: 48px;
        overflow: hidden;
    }
    
    /* Constrain select dropdown to viewport */
    .filters {
        position: relative;
        z-index: 1000;
        overflow: visible;
    }

    .checkbox-item {
        min-height: 48px;
    }
}

/* High DPI Displays (Retina) */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .player-avatar img {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* Mobile scrollbar and scroll indicator */
@media (max-width: 768px) {
    .table-wrapper::-webkit-scrollbar {
        height: 4px;
    }
    
    .table-wrapper::-webkit-scrollbar-track {
        background: rgba(107, 70, 193, 0.1);
        border-radius: 2px;
        margin: 0 1rem;
    }
    
    .table-wrapper::-webkit-scrollbar-thumb {
        background: linear-gradient(90deg, #667eea, #764ba2);
        border-radius: 2px;
    }
    
    /* Scroll indicator dots - only show when there are matches */
    .matches-section:not(.no-matches)::after {
        content: "↓ Scroll to see more matches ↓";
        display: block;
        text-align: center;
        color: rgba(135, 206, 235, 0.9);
        font-size: 0.8rem;
        font-weight: 600;
        padding: 1rem;
        opacity: 0.7;
    }
    
    /* Ensure content doesn't get too compressed */
    .container {
        min-width: 280px;
    }

    /* Smooth scrolling for modals */
    .match-form,
    .players-modal-body {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
}

/* Accessibility improvements for mobile */
@media (max-width: 768px) {
    /* Focus indicators for keyboard navigation */
    .add-match-btn:focus,
    .filter-select:focus,
    .view-players-btn:focus {
        outline: 2px solid #667eea;
        outline-offset: 2px;
    }
    
    .edit-match-btn:focus,
    .delete-match-btn:focus {
        outline: 2px solid currentColor;
        outline-offset: 2px;
    }
    
    /* Better text sizing for readability */
    .matches-table td {
        line-height: 1.5;
    }
    
    .tournament-name,
    .earnings-amount {
        line-height: 1.4;
    }

    /* Prevent text selection on buttons */
    .add-match-btn,
    .edit-match-btn,
    .delete-match-btn,
    .view-players-btn {
        user-select: none;
        -webkit-user-select: none;
        -webkit-touch-callout: none;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .admin-controls,
    .action-buttons,
    .modal,
    .filters {
        display: none !important;
    }

    .page-header {
        padding: 2rem 0;
        background: white !important;
    }

    .page-title {
        color: black !important;
        text-shadow: none !important;
    }

    .stats-summary,
    .matches-section {
        background: white !important;
    }

    .table-container {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }

    .matches-table {
        font-size: 0.8rem;
    }

    .matches-table th,
    .matches-table td {
        padding: 0.5rem;
        color: black !important;
    }

    .matches-table thead {
        background: #f5f5f5 !important;
    }

    /* Hide admin column only when printing, not on mobile */
    .admin-column {
        display: none !important;
    }
}

/* ===========================
   MOBILE HORIZONTAL LAYOUT - LABEL:VALUE PAIRS
   =========================== */

/* All Mobile Devices - Comprehensive Coverage */
@media screen and (max-width: 768px) {
    /* Force table to display as cards with horizontal layout */
    .matches-table {
        width: 100% !important;
        display: block !important;
        border-collapse: separate !important;
        border-spacing: 0 !important;
    }

    /* Hide table headers on mmy obile */
    .matches-table thead {
        display: none !important;
    }

    /* Make tbody block-level */
    .matches-table tbody {
        display: block !important;
        width: 100% !important;
    }

    /* Transform each row into a compact card */
    .matches-table tbody tr {
        display: block !important;
        width: 100% !important;
        background: rgba(30, 41, 59, 0.8) !important;
        border: 1px solid rgba(107, 70, 193, 0.2) !important;
        border-radius: 8px !important;
        margin-bottom: 0.8rem !important;
        padding: 0.8rem !important;
        box-shadow: 0 2px 8px rgba(107, 70, 193, 0.1) !important;
        box-sizing: border-box !important;
    }

    /* Each cell becomes a horizontal row with label and value on same line */
    .matches-table tbody tr td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        width: 100% !important;
        padding: 0.3rem 0 !important;
        border: none !important;
        background: transparent !important;
        border-bottom: 1px solid rgba(107, 70, 193, 0.08) !important;
        font-size: 0.85rem !important;
        line-height: 1.2 !important;
    }

    /* Remove border from last cell */
    .matches-table tbody tr td:last-child {
        border-bottom: none !important;
    }

    /* Add labels using CSS content - keep on same line */
    .matches-table tbody tr td:before {
        content: attr(data-label) ":" !important;
        font-weight: bold !important;
        color: rgba(135, 206, 235, 0.9) !important;
        font-size: 0.8rem !important;
        text-transform: uppercase !important;
        letter-spacing: 0.3px !important;
        margin-right: 0.8rem !important;
        flex-shrink: 0 !important;
        display: inline !important;
        white-space: nowrap !important;
    }

    /* Values align to the right on same line */
    .matches-table tbody tr td > * {
        margin-left: auto !important;
        text-align: right !important;
        flex-shrink: 0 !important;
        display: inline !important;
    }

    /* Hide admin columns on mobile by default, but show when admin is logged in */
    .matches-table tbody tr td.admin-column,
    .matches-table tbody tr td.action-cell {
        display: none;
    }
    
    /* Show admin columns when admin is logged in */
    .matches-table tbody tr td.admin-column.admin-visible,
    .matches-table tbody tr td.action-cell.admin-visible {
        display: flex !important;
    }

    /* Enhance card appearance with alternating colors */
    .matches-table tbody tr:nth-child(even) {
        background: linear-gradient(145deg, rgba(59, 130, 246, 0.08), rgba(147, 51, 234, 0.05)) !important;
    }

    .matches-table tbody tr:hover {
        transform: translateY(-1px) !important;
        box-shadow: 0 4px 12px rgba(107, 70, 193, 0.15) !important;
    }

    /* Optimize specific elements for compact mobile display */
    .matches-table .date-display {
        font-size: 0.8rem !important;
        font-weight: 600 !important;
    }

    .matches-table .org-badge {
        font-size: 0.7rem !important;
        padding: 0.2rem 0.4rem !important;
        white-space: nowrap !important;
        border-radius: 6px !important;
    }

    .matches-table .tournament-info {
        text-align: right !important;
        display: inline-block !important;
    }

    .matches-table .tournament-name {
        font-size: 0.75rem !important;
        font-weight: 600 !important;
        line-height: 1.1 !important;
        margin-bottom: 0.1rem !important;
    }

    .matches-table .tournament-type {
        font-size: 0.65rem !important;
        color: rgba(255, 255, 255, 0.7) !important;
    }

    .matches-table .position-badge {
        width: 30px !important;
        height: 18px !important;
        font-size: 0.7rem !important;
        display: inline-flex !important;
        justify-content: center !important;
        align-items: center !important;
        border-radius: 9px !important;
    }

    .matches-table .view-players-btn {
        padding: 0.25rem 0.5rem !important;
        font-size: 0.65rem !important;
        min-height: 20px !important;
        white-space: nowrap !important;
        border-radius: 6px !important;
    }

    .matches-table .earnings-amount {
        font-size: 0.8rem !important;
        font-weight: 700 !important;
        color: #10B981 !important;
    }

    /* Reduce table container height for better fit */
    .table-container {
        max-height: 45vh !important;
    }

    .table-wrapper {
        padding: 0 !important;
    }
}

/* Extra coverage for very small devices */
@media screen and (max-width: 480px) {
    .matches-table tbody tr {
        padding: 0.6rem !important;
        margin-bottom: 0.8rem !important;
    }

    .matches-table tbody tr td {
        display: block !important;
        padding: 0.4rem 0 !important;
        border-bottom: 1px solid rgba(107, 70, 193, 0.08) !important;
        text-align: left !important;
    }

    .matches-table tbody tr td:before {
        content: attr(data-label) !important;
        display: block !important;
        font-weight: bold !important;
        color: rgba(135, 206, 235, 0.9) !important;
        font-size: 0.7rem !important;
        text-transform: uppercase !important;
        letter-spacing: 0.3px !important;
        margin-bottom: 0.2rem !important;
        line-height: 1.2 !important;
    }

    .matches-table tbody tr td > * {
        display: block !important;
        margin: 0 !important;
        text-align: left !important;
        font-size: 0.8rem !important;
        line-height: 1.3 !important;
    }

    .matches-table .date-display {
        font-size: 0.8rem !important;
        font-weight: 600 !important;
    }

    .matches-table .org-badge {
        font-size: 0.7rem !important;
        padding: 0.2rem 0.4rem !important;
        display: inline-block !important;
        margin-top: 0.1rem !important;
    }

    .matches-table .tournament-info {
        text-align: left !important;
    }

    .matches-table .tournament-name {
        font-size: 0.8rem !important;
        font-weight: 600 !important;
        margin-bottom: 0.1rem !important;
    }

    .matches-table .tournament-type {
        font-size: 0.7rem !important;
        color: rgba(255, 255, 255, 0.7) !important;
    }

    .matches-table .position-badge {
        width: 35px !important;
        height: 20px !important;
        font-size: 0.7rem !important;
        display: inline-flex !important;
        justify-content: center !important;
        align-items: center !important;
        margin-top: 0.1rem !important;
    }

    .matches-table .view-players-btn {
        font-size: 0.7rem !important;
        padding: 0.3rem 0.6rem !important;
        margin-top: 0.1rem !important;
        display: inline-block !important;
    }

   

    .matches-table .earnings-amount {
        font-size: 0.9rem !important;
        font-weight: 700 !important;
        color: #10B981 !important;
        margin-top: 0.1rem !important;
    }
}

/* Adjust the page header margin to prevent overlap with the navbar in mobile view */
@media (max-width: 768px) {
    .page-header {
        margin-top: 50px; /* Add margin to push content below the navbar */
    }
}

