/*
 * REFACTORED ELO RANKING SYSTEM - PART 3
 * Complete CSS and JavaScript Files
 */

/* ============================================================================
   FILE: assets/css/style.css
   PURPOSE: Complete application styling
   ============================================================================ */

/* CSS Variables */
:root {
    --primary-color: #BD3A34;
    --primary-dark: #013057;
    --secondary-color: #DCF2FF;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #DCF2FF;
    
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --text-dark: #333;
    --text-muted: #666;
    --text-light: #999;
    
    --border-color: #e0e0e0;
    --border-radius: 8px;
    --box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    --box-shadow-lg: 0 10px 30px rgba(0,0,0,0.2);
    
    --spacing-xs: 5px;
    --spacing-sm: 10px;
    --spacing-md: 20px;
    --spacing-lg: 30px;
    
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    color: var(--text-dark);
    line-height: 1.6;
    background: #f5f5f5;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* Navigation */
.navbar {
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid #e5e7eb;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px var(--spacing-md);
    position: relative;
    flex-wrap: nowrap;
    gap: 8px;
}

/* Online pill */
.online-pill-container {
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.online-pill {
    background: #28a745;
    color: white;
    border: none;
    border-radius: 18px;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    line-height: 1;
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.online-pill:hover {
    background: #218838;
}

.online-popup {
    display: none;
    position: absolute;
    left: 0;
    top: calc(100% + 8px);
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 180px;
    max-width: 250px;
    z-index: 1000;
}

.online-popup-header {
    font-weight: 600;
    margin-bottom: 6px;
    color: #333;
    font-size: 13px;
}

.online-popup-list {
    color: #666;
    font-size: 13px;
    max-height: 200px;
    overflow-y: auto;
}

.navbar-brand {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
}

.navbar-brand a {
    font-size: 1.3em;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.2;
}

.navbar-logo {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

.navbar-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mobile navbar adjustments */
@media (max-width: 480px) {
    .navbar .container {
        padding: 4px 8px;
        gap: 6px;
    }
    
    .online-pill {
        padding: 0 10px;
        font-size: 13px;
        min-width: 32px;
        height: 32px;
        border-radius: 16px;
    }
    
    .navbar-brand a {
        font-size: 1em;
        gap: 6px;
    }
    
    .navbar-logo {
        width: 32px;
        height: 32px;
    }
    
    .admin-burger {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
}

@media (max-width: 360px) {
    .navbar-brand a {
        font-size: 0.85em;
        gap: 4px;
    }
    
    .navbar-logo {
        width: 28px;
        height: 28px;
    }
    
    .online-pill {
        padding: 0 8px;
        font-size: 12px;
        min-width: 28px;
        height: 28px;
        border-radius: 14px;
    }
    
    .admin-burger {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
}

/* Navbar burgers container */
.navbar-burgers {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Admin burger buttons */
.admin-burger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s ease;
    position: relative;
}

.admin-burger:hover {
    background: #e5e7eb;
}

.admin-burger.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.admin-burger.active span {
    filter: brightness(10);
}

.super-admin-burger {
    background: #fef3c7;
    border-color: #f59e0b;
}

.super-admin-burger:hover {
    background: #fde68a;
}

.super-admin-burger.active {
    background: #f59e0b;
    border-color: #d97706;
}

/* Admin dropdown menus */
.admin-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border-radius: 8px;
    min-width: 220px;
    z-index: 1002;
    overflow: hidden;
}

.admin-menu.active {
    display: block;
    animation: dropdownFade 0.2s ease;
}

.admin-menu-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 10px 14px;
    font-weight: 600;
    font-size: 0.9em;
}

.super-admin-burger + .admin-menu .admin-menu-header {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.admin-menu a {
    display: block;
    padding: 10px 14px;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 0.9em;
    border-bottom: 1px solid #f3f4f6;
    transition: all 0.15s ease;
}

.admin-menu a:last-child {
    border-bottom: none;
}

.admin-menu a:hover {
    background: #f3f4f6;
    color: var(--primary-color);
}

.burger-menu {
    display: flex;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    z-index: 1001;
}

.burger-menu span {
    width: 25px;
    height: 3px;
    background: var(--primary-color);
    margin: 3px 0;
    transition: all 0.3s ease;
    border-radius: 3px;
}

.burger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.burger-menu.active span:nth-child(2) {
    opacity: 0;
}

.burger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

.navbar-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    box-shadow: var(--box-shadow);
    border-radius: var(--border-radius);
    min-width: 250px;
    flex-direction: column;
    gap: 0;
    z-index: 1000;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
}

.navbar-menu.active {
    display: flex;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    padding: var(--spacing-sm) 0;
    -webkit-overflow-scrolling: touch;
}

.navbar-menu > a {
    color: var(--text-dark);
    text-decoration: none;
    padding: 6px 8px;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.9em;
    position: relative;
    white-space: nowrap;
    width: 100%;
    border-bottom: 1px solid var(--border-color);
}

.navbar-menu > a:hover {
    background: #f3f4f6;
    color: var(--primary-color);
}

.navbar-menu > a.active {
    background: linear-gradient(135deg, #667eea15, #764ba215);
    color: var(--primary-color);
    font-weight: 600;
}

.navbar-menu > a:last-of-type {
    border-bottom: none;
}

/* Dropdown */
.navbar-menu .dropdown {
    width: 100%;
    position: relative;
}

.navbar-menu .dropdown-toggle {
    cursor: pointer;
    color: var(--text-dark);
    text-decoration: none;
    padding: 6px 8px;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.9em;
    display: block;
    width: 100%;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.navbar-menu .dropdown-toggle:hover {
    background: #f3f4f6;
    color: var(--primary-color);
}

.navbar-menu .dropdown-menu {
    display: none;
    position: static;
    background: #f5f5f5;
    box-shadow: none;
    border: none;
    border-radius: 0;
    width: 100%;
    margin-top: 0;
    padding: 0;
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
}

.navbar-menu .dropdown.active .dropdown-menu {
    display: block;
}

/* Custom scrollbar for mobile menu */
.navbar-menu::-webkit-scrollbar,
.navbar-menu .dropdown-menu::-webkit-scrollbar {
    width: 6px;
}

.navbar-menu::-webkit-scrollbar-track,
.navbar-menu .dropdown-menu::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.navbar-menu::-webkit-scrollbar-thumb,
.navbar-menu .dropdown-menu::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.navbar-menu::-webkit-scrollbar-thumb:hover,
.navbar-menu .dropdown-menu::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

@keyframes dropdownFade {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown:hover .dropdown-menu,
.dropdown .dropdown-menu:hover {
    display: block;
    animation: dropdownFade 0.2s ease;
}

.navbar-menu .dropdown-menu a {
    display: block;
    padding: 6px 10px;
    color: var(--text-dark);
    text-decoration: none;
    transition: all 0.15s ease;
    font-size: 0.88em;
    border-bottom: 1px solid var(--border-color);
    background: #f9f9f9;
}

.navbar-menu .dropdown-menu a:last-child {
    border-bottom: 1px solid var(--border-color);
}

.navbar-menu .dropdown-menu a:hover {
    background: #e5e7eb;
    color: var(--primary-color);
}

.user-dropdown .dropdown-toggle {
    background: linear-gradient(135deg, #667eea15, #764ba215);
    color: var(--primary-color);
    font-weight: 600;
}

/* Flash Messages - Toast Notification Style */
.flash-message {
    position: fixed;
    top: 80px;
    right: 20px;
    left: 20px;
    max-width: 500px;
    margin: 0 auto;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    animation: slideInDown 0.4s ease;
    z-index: 10000;
    font-weight: 500;
}

.flash-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border: 2px solid var(--success-color);
}

.flash-error {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border: 2px solid var(--danger-color);
}

@keyframes slideInDown {
    from {
        transform: translateY(-100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Auto-hide flash messages after 5 seconds */
.flash-message.fade-out {
    animation: fadeOut 0.5s ease forwards;
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* Main Content */
.main-content {
    min-height: calc(100vh - 200px);
    padding: var(--spacing-sm) 0 var(--spacing-lg) 0;
}

/* Page Headings */
.main-content h1 {
    text-align: center;
    margin-top: 0;
    margin-bottom: var(--spacing-sm);
    color: var(--primary-color);
    font-size: 1.6em;
    font-weight: 700;
}

/* Footer */
.footer {
    background: white;
    padding: var(--spacing-lg) 0;
    text-align: center;
    color: var(--text-muted);
    margin-top: var(--spacing-lg);
    box-shadow: 0 -2px 5px rgba(0,0,0,0.05);
}

/* Forms */
.form-group {
    margin-bottom: var(--spacing-md);
}

label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: 600;
    color: var(--text-dark);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    padding: 8px 10px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.3s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

textarea {
    resize: vertical;
}

small {
    display: block;
    margin-top: var(--spacing-xs);
    color: var(--text-muted);
    font-size: 0.875em;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-weight: normal;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 30px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.3s, transform 0.2s;
    box-shadow: var(--box-shadow);
}

.btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-primary {
    background: var(--primary-color);
}

.btn-secondary {
    background: var(--text-muted);
}

.btn-success {
    background: var(--success-color);
}

.btn-warning {
    background: var(--warning-color);
}

.btn-danger {
    background: var(--danger-color);
}

.btn-red {
    background: #BD3A34;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
}

.btn-block {
    width: 100%;
}

.btn-small {
    padding: 6px 12px;
    font-size: 14px;
}

.button-group {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
}

/* Filter Section */
.filter-section {
    background: white;
    padding: 10px 15px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: var(--spacing-md);
}

.filter-group {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.filter-group > .form-group {
    flex: 1;
    min-width: 200px;
}

/* Search Section */
.search-section {
    background: white;
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: var(--spacing-md);
}

.search-section .form-group {
    margin-bottom: 0;
}

.search-section input[type="text"] {
    width: 100%;
    max-width: 500px;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-top: var(--spacing-md);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: #f5f5f5;
    font-weight: 600;
    color: var(--text-dark);
}

.data-table tr:hover {
    background: #f9f9f9;
}

.rank {
    font-weight: bold;
    color: var(--primary-color);
}

.rating {
    font-size: 1.2em;
    font-weight: 600;
}

/* Cards */
.match-card,
.profile-card,
.sport-section {
    background: white;
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: var(--spacing-md);
}

.match-card {
    background: white;
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    border-left: 4px solid var(--primary-color);
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: visible;
    z-index: auto;
}

.match-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.match-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
    min-height: 32px;
}

.match-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
    align-items: flex-start;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.status-full {
    background: #10b981;
    color: white;
}

.status-open {
    background: #f59e0b;
    color: white;
}

.match-datetime {
    font-size: 0.95em;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 6px;
    line-height: 1.4;
}

.match-location {
    font-size: 0.85em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.match-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: var(--spacing-sm);
    align-items: center;
    position: relative;
    z-index: 1;
}

.match-actions .btn-small {
    flex: 0 1 auto;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
    z-index: 1;
    padding: 6px 10px;
    font-size: 13px;
}

.match-actions .status-badge {
    flex: 0 0 auto;
}

.match-date {
    font-size: 0.85em;
    color: var(--text-muted);
    margin-bottom: var(--spacing-sm);
}

.match-result {
    margin-top: var(--spacing-sm);
    font-size: 0.95em;
}

.winner {
    color: var(--success-color);
    font-weight: 600;
}

.loser {
    color: var(--danger-color);
}

.match-notes {
    font-size: 0.85em;
    color: var(--text-muted);
    margin-top: 4px;
    margin-bottom: 0;
    font-style: italic;
    line-height: 1.4;
}

.match-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #f3f4f6;
    color: #374151;
    font-size: 0.75em;
    font-weight: 600;
    border-radius: 12px;
    text-transform: capitalize;
}

/* Page Header */
.page-header {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    gap: var(--spacing-sm);
}

.page-header h1 {
    margin: 0;
    font-size: 1.6em;
    color: var(--primary-color);
    font-weight: 700;
}

.btn-icon {
    font-size: 1.2em;
    font-weight: 600;
}

.btn-text {
    margin-left: 4px;
}

/* Matches Grid */
.matches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: var(--spacing-md);
}

/* Upcoming Matches Table */
.upcoming-matches-table td {
    vertical-align: middle;
}

.upcoming-matches-table .actions-cell {
    white-space: nowrap;
}

.upcoming-matches-table .actions-cell .btn {
    margin-right: 4px;
}

.upcoming-matches-table .actions-cell .btn:last-child {
    margin-right: 0;
}

.upcoming-matches-container {
    /* overflow-x: auto; - Removed as it causes button positioning issues */
}

/* Club Session Cards - Refactored for proper button containment */
.club-session-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 16px;
    overflow: hidden;
    border-left: 4px solid var(--primary-color);
    display: flex;
    flex-direction: column;
}

.session-card-content {
    padding: 16px;
    flex: 1;
}

.session-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.session-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: var(--text-dark);
    flex: 1;
}

.session-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.sport-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: white;
}

.sport-tennis { background: var(--sport-color-tennis, #4CAF50); }
.sport-padel { background: var(--sport-color-padel, #2196F3); }
.sport-pickleball { background: var(--sport-color-pickleball, #FF9800); }

.session-info {
    margin-bottom: 12px;
    font-size: 14px;
    color: #666;
}

.session-datetime,
.session-location {
    margin-bottom: 4px;
}

.session-description {
    font-size: 14px;
    color: #555;
    line-height: 1.5;
    margin-bottom: 12px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.session-participants-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    font-size: 14px;
}

.badge-full {
    background: #dc3545;
    color: white;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

.badge-available {
    background: #28a745;
    color: white;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

.session-participants-list {
    margin-top: 8px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.session-participants-list .participant-tag {
    display: inline-block;
    background: white;
    padding: 4px 10px;
    margin: 4px;
    border-radius: 12px;
    font-size: 13px;
    border: 1px solid #ddd;
}

.session-actions-container {
    border-top: 1px solid #eee;
    padding: 12px 16px;
    background: #fafafa;
}

.session-message {
    color: #666;
    font-size: 14px;
    text-align: center;
}

.session-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.session-btn {
    padding: 8px 14px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    flex: 0 1 auto;
    white-space: nowrap;
}

.session-btn-view {
    background: #17a2b8;
    color: white;
}

.session-btn-view:hover {
    background: #138496;
}

.session-btn-join {
    background: var(--primary-color);
    color: white;
}

.session-btn-join:hover {
    background: var(--primary-dark);
}

.session-btn-leave {
    background: #ffc107;
    color: #333;
}

.session-btn-leave:hover {
    background: #e0a800;
}

.session-btn-disabled {
    background: #6c757d;
    color: white;
    cursor: not-allowed;
    opacity: 0.6;
}

.session-btn-share {
    background: #6c757d;
    color: white;
    min-width: 40px;
}

.session-btn-share:hover {
    background: #5a6268;
}

@media (max-width: 768px) {
    .session-header {
        flex-direction: column;
    }
    
    .session-actions {
        gap: 6px;
    }
    
    .session-btn {
        padding: 7px 12px;
        font-size: 13px;
    }
}

/* Table Filter Dropdowns and Inputs */
.table-filter,
.table-filter-input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: white;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    transition: all 0.2s;
}

.table-filter {
    cursor: pointer;
}

.table-filter-input {
    font-weight: 400;
}

.table-filter-input::placeholder {
    color: #9ca3af;
    font-weight: 400;
    font-style: italic;
}

.table-filter:hover,
.table-filter-input:hover {
    border-color: #9ca3af;
}

.table-filter:focus,
.table-filter-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.upcoming-matches-table thead th {
    padding: 12px;
    background: #f9fafb;
    vertical-align: middle;
}

.upcoming-matches-table thead .filter-row th {
    border-bottom: 2px solid #e5e7eb;
}

/* Mobile Filters */
.mobile-filters {
    display: none;
}

@media (max-width: 768px) {
    .mobile-filters {
        display: block;
        margin-bottom: var(--spacing-md);
    }
}

/* Responsive Utility Classes */
.desktop-only {
    display: block;
}

table.desktop-only {
    display: table;
}

.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }
    
    .mobile-only {
        display: block !important;
    }
}

/* Club Sessions Table */
.club-sessions-table {
    width: 100%;
}

.club-sessions-table td {
    vertical-align: middle;
}

.club-sessions-table .actions-cell {
    white-space: nowrap;
}

.club-sessions-table .actions-cell .btn {
    margin-right: 4px;
}

.club-sessions-table .actions-cell .btn:last-child {
    margin-right: 0;
}

/* Joined Indicators */
.joined-indicator {
    display: inline-block;
    padding: 2px 8px;
    background: #10b981;
    color: white;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 700;
    margin-left: 6px;
    vertical-align: middle;
}

.user-joined-match {
    border-left-color: #10b981 !important;
    background: #f0fdf4;
}

.user-joined-row {
    background: #f0fdf4;
}

.user-joined-row:hover {
    background: #dcfce7 !important;
}

/* Player Links */
.player-link {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dashed currentColor;
    transition: all 0.2s ease;
    cursor: pointer;
}

.player-link:hover {
    border-bottom-style: solid;
    opacity: 0.8;
}

.winner .player-link {
    color: var(--success-color);
}

.loser .player-link {
    color: var(--danger-color);
}

/* Leaderboard Player Name Links */
.player-name-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
    border-bottom: 1px solid transparent;
}

.player-name-link:hover {
    border-bottom-color: var(--primary-color);
    opacity: 0.8;
}

/* Badges */
.sport-badge,
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
    margin-right: var(--spacing-sm);
    flex-shrink: 0;
}

.sport-tennis {
    background: #fef3c7;
    color: #92400e;
}

.sport-padel {
    background: #dbeafe;
    color: #1e40af;
}

.sport-pickleball {
    background: #dcfce7;
    color: #166534;
}

.badge-admin {
    background: #dbeafe;
    color: #1e40af;
}

.badge-user {
    background: #f3f4f6;
    color: #6b7280;
}

.badge-active {
    background: #d1fae5;
    color: #065f46;
}

.badge-inactive {
    background: #fee2e2;
    color: #991b1b;
}

.badge-anonymized {
    background: #e5e7eb;
    color: #4b5563;
}

.text-warning {
    color: #b45309 !important;
}

.text-warning:hover {
    background: #fef3c7 !important;
}

/* Stats */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: var(--spacing-md);
}

.quick-stat-card {
    background: white;
    padding: 15px;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--box-shadow);
}

.quick-stat-value {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--primary-color);
}

.quick-stat-label {
    font-size: 0.9em;
    color: var(--text-muted);
    margin-top: var(--spacing-xs);
}

.quick-stat-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.quick-stat-link:hover {
    text-decoration: underline;
    color: var(--primary-dark);
}

.stats-card {
    background: var(--primary-dark);
    color: white;
    padding: var(--spacing-lg);
    border-radius: 12px;
    margin-bottom: var(--spacing-md);
    box-shadow: 0 8px 20px rgba(121, 161, 184, 0.3);
}

.stats-card h2 {
    margin: 0 0 var(--spacing-md) 0;
    font-size: 1.5em;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
}

.stat-item {
    text-align: center;
    background: rgba(255, 255, 255, 0.15);
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
    backdrop-filter: blur(10px);
}

.stat-value {
    font-size: 2.5em;
    font-weight: bold;
    display: block;
    line-height: 1;
    margin-bottom: var(--spacing-xs);
}

.stat-label {
    font-size: 0.85em;
    opacity: 0.95;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Player Search */
.player-select-wrapper {
    position: relative;
}

.player-search {
    width: 100%;
    padding: 10px 35px 10px 10px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 16px;
    margin-bottom: var(--spacing-xs);
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
}

.player-search:focus {
    border-color: var(--primary-color);
    outline: none;
}

.player-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius);
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin-top: 4px;
}

.player-dropdown.active {
    display: block;
}

.player-option {
    padding: 12px 15px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f3f4f6;
}

.player-option:last-child {
    border-bottom: none;
}

.player-option:hover {
    background: linear-gradient(135deg, #667eea08, #764ba208);
    color: var(--primary-color);
}

/* Doubles Fields */
.doubles-fields {
    display: none;
}

/* Action Buttons */
.match-actions {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    gap: var(--spacing-sm);
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2em;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.action-btn:hover {
    opacity: 1;
}

.edit-btn:hover {
    color: var(--primary-color);
}

.delete-btn:hover {
    color: var(--danger-color);
}

.action-buttons {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-overlay.active {
    display: flex;
}

.modal-card {
    background: white;
    padding: var(--spacing-lg);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--box-shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-note {
    background: #f0f0f0;
    padding: var(--spacing-sm);
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-md);
    font-size: 0.9em;
    color: var(--text-muted);
}

.modal-actions {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
}

.modal-actions button {
    flex: 1;
}

/* Auth Pages */
.auth-page {
    background: var(--bg-gradient);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-container {
    width: 100%;
    max-width: 450px;
    padding: var(--spacing-md);
}

.auth-card,
.setup-container {
    background: white;
    padding: var(--spacing-lg);
    border-radius: 12px;
    box-shadow: var(--box-shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: var(--spacing-md);
}

.login-logo img {
    width: 120px;
    height: 120px;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.auth-card h1,
.setup-container h1 {
    text-align: center;
    margin-bottom: var(--spacing-sm);
    color: var(--primary-color);
}

.auth-card h2,
.setup-container h2 {
    text-align: center;
    margin-bottom: var(--spacing-md);
    color: var(--text-dark);
}

.auth-links {
    text-align: center;
    margin-top: var(--spacing-md);
}

.auth-links a {
    color: var(--primary-color);
    text-decoration: none;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* Profile Page */
.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.profile-info {
    background: white;
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.profile-info p {
    margin-bottom: var(--spacing-sm);
}

/* Profile Photo */
.profile-photo-section {
    text-align: center;
}

.profile-photo {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--primary-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.profile-photo-placeholder {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: var(--border-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1.1em;
    font-weight: 600;
    border: 4px dashed var(--text-light);
}

/* Small Player Photo (for lists/cards) */
.player-photo-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
    vertical-align: middle;
    margin-right: 8px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.player-photo-small:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.player-photo-placeholder-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--border-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.8em;
    font-weight: 600;
    vertical-align: middle;
    margin-right: 8px;
}

/* Photo Lightbox Modal */
.photo-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    padding: 20px;
}

.photo-lightbox.active {
    display: flex;
}

.photo-lightbox img {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

@media (min-width: 480px) {
    .photo-lightbox img {
        width: 200px;
        height: 200px;
    }
}

@media (min-width: 768px) {
    .photo-lightbox img {
        width: 256px;
        height: 256px;
    }
}

.photo-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: transform 0.2s;
}

.photo-lightbox-close:hover {
    transform: scale(1.1);
}

.profile-photo {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.profile-photo:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

/* Arrange Match */
.created-match-card {
    margin-top: var(--spacing-md);
}

.success-card {
    background: var(--bg-gradient);
    color: white;
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
}

.success-card h3 {
    margin: 0 0 15px 0;
    color: white;
}

.share-link-box {
    background: rgba(255,255,255,0.2);
    padding: 15px;
    border-radius: var(--border-radius);
    margin: 15px 0;
    word-break: break-all;
}

.share-link-box input {
    width: 100%;
    background: white;
    border: none;
    padding: 10px;
    border-radius: 4px;
    font-family: monospace;
}

.upcoming-section {
    margin-top: var(--spacing-lg);
}

/* Alerts */
.alert {
    padding: 12px;
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-md);
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid var(--success-color);
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid var(--danger-color);
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid var(--info-color);
}

/* Code Example */
.code-example {
    background: #f5f5f5;
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-md);
}

.code-example code {
    font-family: monospace;
    font-size: 0.9em;
}

/* Page Description */
.page-description {
    margin-bottom: var(--spacing-md);
    color: var(--text-muted);
}

/* Rating Changes */
.rating-change {
    font-size: 0.9em;
    padding: 2px 6px;
    border-radius: 4px;
}

.rating-up {
    color: var(--success-color);
    background: #d1fae5;
}

.rating-down {
    color: var(--danger-color);
    background: #fee2e2;
}

/* Trending Indicators */
.trend-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    font-size: 0.9em;
    padding: 4px 8px;
    border-radius: 4px;
}

.trend-up {
    color: var(--success-color);
    background: #d1fae5;
}

.trend-down {
    color: var(--danger-color);
    background: #fee2e2;
}

.trend-neutral {
    color: var(--text-muted);
    background: #f3f4f6;
}

.trend-arrow {
    font-size: 1.2em;
    font-weight: bold;
}

/* Form Indicators */
.form-indicator {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin: 0 2px;
}

.form-win {
    background: var(--success-color);
}

.form-loss {
    background: var(--danger-color);
}

/* Streak Badges */
.streak-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: var(--border-radius);
    font-weight: 600;
    margin-left: var(--spacing-sm);
}

.streak-positive {
    background: rgba(16, 185, 129, 0.12); /* subtle green */
    color: var(--success-color);
}

.streak-negative {
    background: #fee2e2;
    color: #991b1b;
}

/* Types Grid */
.types-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
}

.type-card {
    background: #70A1B8;
    padding: var(--spacing-sm);
    border-radius: var(--border-radius);
    text-align: center;
}

/* Stats Layout - Two Column on Desktop */
.stats-layout-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

/* Chart Container */
#rating-chart-container {
    margin-top: 0;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: #f9f9f9;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .container {
        padding: 0 var(--spacing-sm);
    }

    .navbar .container {
        padding: 12px var(--spacing-sm);
        flex-wrap: wrap;
    }

    .navbar-brand a {
        font-size: 1.1em;
        color: var(--primary-dark);
    }

    .navbar-menu {
        left: 0;
        right: 0;
        min-width: 100%;
    }

    h1 {
        font-size: 1.3em;
    }

    h2 {
        font-size: 1.1em;
    }

    h3 {
        font-size: 1em;
    }

    .main-content h1 {
        font-size: 1.3em;
    }

    .modal-card {
        padding: var(--spacing-sm);
        max-height: 95vh;
    }

    .modal-header {
        margin-bottom: var(--spacing-sm);
    }

    .modal-actions {
        margin-top: var(--spacing-sm);
    }

    .modal-note {
        padding: 8px;
        margin-bottom: var(--spacing-sm);
        font-size: 0.85em;
    }

    .page-header {
        flex-direction: column;
        align-items: center;
        gap: var(--spacing-sm);
    }

    .page-header h1 {
        font-size: 1.4em;
        text-align: center;
    }

    .page-header .btn {
        width: auto;
        justify-content: center;
    }

    .matches-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }

    .btn-text {
        display: inline;
    }

    .filter-section {
        padding: 8px 12px;
    }

    .filter-group {
        display: grid;
        grid-template-columns: 1fr 1fr;
        column-gap: 10px;
        row-gap: 10px;
    }

    .filter-group > .form-group {
        min-width: 0;
        margin-bottom: 0;
    }

    .filter-group select {
        width: 100%;
        min-width: 0;
    }

    .filter-group > .form-group:last-child {
        margin-bottom: 0;
    }

    /* Player search field spans full width on mobile */
    .filter-group > .form-group.player-select-wrapper {
        grid-column: 1 / -1;
    }

    .sport-badge,
    .badge {
        padding: 3px 6px;
        font-size: 0.75em;
        margin-right: 4px;
    }

    .form-group {
        margin-bottom: var(--spacing-sm);
    }

    .form-group label {
        font-size: 0.9em;
        margin-bottom: 4px;
    }

    .form-group select,
    .form-group input[type="text"],
    .form-group input[type="email"],
    .form-group input[type="password"],
    .form-group input[type="number"],
    .form-group input[type="datetime-local"] {
        font-size: 14px;
        padding: 8px;
    }

    .button-group {
        flex-direction: row;
    }

    .button-group .btn {
        flex: 1;
    }
    
    .data-table {
        font-size: 0.9em;
    }
    
    .match-actions {
        position: static;
        float: right;
        margin-bottom: var(--spacing-sm);
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons .btn-small {
        width: 100%;
    }
    
    .profile-grid {
        grid-template-columns: 1fr;
    }
}

@media screen and (max-width: 600px) {
    /* Center h2 headings on mobile */
    h2 {
        text-align: center;
    }

    /* Filter group - ensure proper spacing on portrait mobile */
    .filter-section {
        padding: 8px 12px;
    }

    .filter-group {
        display: grid;
        grid-template-columns: 1fr 1fr;
        column-gap: 10px;
        row-gap: 10px;
    }

    .filter-group > .form-group {
        min-width: 0;
    }

    .filter-group > .form-group:not(.player-select-wrapper) {
        overflow: hidden;
    }

    .filter-group select {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        box-sizing: border-box;
        font-size: 15px;
    }

    /* Quick Stats - 2 column layout on mobile portrait */
    .quick-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .quick-stat-card {
        padding: 12px;
    }

    .quick-stat-value {
        font-size: 1.3em;
    }

    .quick-stat-label {
        font-size: 0.75em;
    }

    .data-table thead {
        display: none;
    }

    .data-table tbody {
        display: grid;
        grid-template-columns: 1fr;
        gap: 15px;
    }

    /* Redesigned mobile player cards (not for users table) */
    .data-table tr:not(#users-table tr) {
        display: block;
        background: white;
        border: 1px solid var(--border-color);
        border-radius: var(--border-radius);
        padding: 0;
        overflow: hidden;
    }

    /* Photo and name section at top */
    .data-table td[data-label="Player"] {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 12px 10px 10px 10px;
        border-bottom: 2px solid #f0f0f0;
        background: linear-gradient(to bottom, #f9fafb 0%, white 100%);
    }

    .data-table td[data-label="Player"]::before {
        display: none;
    }

    .data-table td[data-label="Player"] .player-photo-small,
    .data-table td[data-label="Player"] .player-photo-placeholder-small {
        width: 60px;
        height: 60px;
        margin: 0 0 8px 0;
        font-size: 1.5em;
        border: 2px solid var(--primary-color);
    }

    .data-table td[data-label="Player"] .player-name-link {
        font-size: 1.1em;
        font-weight: 600;
        color: var(--text-color);
    }

    /* Stats boxes grid */
    .data-table td[data-label="Rank"],
    .data-table td[data-label="Rating"],
    .data-table td[data-label="Trend (7d)"],
    .data-table td[data-label="Games"] {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 8px;
        border: none;
        background: #f9fafb;
        text-align: center;
        min-height: 70px;
    }

    /* Create a compact grid for stat boxes (not for users table) */
    .data-table tr:not(#users-table tr) {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "player player"
            "rank rating"
            "skill trend"
            "games games";
        gap: 0;
    }

    .data-table td[data-label="Player"] {
        grid-area: player;
    }

    .data-table td[data-label="Rank"] {
        grid-area: rank;
        border-right: 1px solid #e5e7eb;
        border-bottom: 1px solid #e5e7eb;
    }

    .data-table td[data-label="Rating"] {
        grid-area: rating;
        border-bottom: 1px solid #e5e7eb;
    }

    .data-table td[data-label="Trend (7d)"] {
        grid-area: trend;
        border-right: 1px solid #e5e7eb;
    }

    /* Skill Level box: appear like other stat boxes */
    .data-table td[data-label="Skill Level"] {
        grid-area: skill;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 8px;
        border: none;
        background: #f9fafb;
        text-align: center;
        min-height: 70px;
        border-bottom: 1px solid #e5e7eb;
        color: #374151;
        font-weight: 600;
        font-size: 1em;
    }

    /* Ensure the label shown above the value reads nicely */
    .data-table td[data-label="Skill Level"]::before {
        content: attr(data-label);
        font-weight: 600;
        text-transform: uppercase;
        font-size: 0.65em;
        color: var(--text-muted);
        letter-spacing: 0.5px;
        margin-bottom: 6px;
    }

    .data-table td[data-label="Games"] {
        grid-area: games;
    }

    /* Match skill badge used in arranged matches (mobile card and modal) */
    .match-skill {
        display: inline-block;
        background: #f9fafb;
        color: #374151;
        padding: 8px 10px;
        border-radius: 8px;
        font-weight: 600;
        font-size: 0.95em;
        margin-bottom: 10px;
        box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    }

    /* Mobile portrait: stack reset-password input and generate button for usability */
    @media (max-width: 480px) {
        #reset-password-modal .modal-card .form-group > div {
            flex-direction: column !important;
            align-items: stretch !important;
        }
        #reset-password-modal .modal-card .form-group > div input,
        #reset-password-modal .modal-card .form-group > div button {
            width: 100% !important;
            box-sizing: border-box;
        }
        #reset-password-modal .modal-card .form-group > div button {
            margin-top: 8px !important;
        }
        #reset-password-modal .modal-card .form-group > div input {
            flex: unset !important;
        }
    }


    .data-table td::before {
        content: attr(data-label);
        font-weight: 600;
        text-transform: uppercase;
        font-size: 0.65em;
        color: var(--text-muted);
        letter-spacing: 0.5px;
        margin-bottom: 6px;
    }

    .data-table td[data-label="Player"]::before {
        display: none;
    }

    /* Style the values in stat boxes */
    .data-table .rank,
    .data-table .rating {
        font-size: 1.5em;
        font-weight: 700;
        color: var(--primary-color);
    }

    .data-table td[data-label="Games"] {
        font-size: 1.3em;
        font-weight: 600;
        color: #6b7280;
    }

    /* Trend indicators look good already, just ensure proper sizing */
    .trend-indicator {
        margin-top: 4px;
        font-size: 1em;
    }


    /* Improved stats card on mobile */
    .stats-card {
        padding: var(--spacing-md);
    }

    .stats-card h2 {
        font-size: 1.2em;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-sm);
    }

    .stat-item {
        padding: var(--spacing-sm);
    }

    .stat-value {
        font-size: 1.8em;
    }

    /* Head-to-Head Records - Improved mobile cards */
    #stats-table tr {
        display: block;
        background: white;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        margin-bottom: var(--spacing-md);
        overflow: hidden;
        box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    }

    #stats-table td {
        display: block;
        padding: 12px 16px;
        border-bottom: 1px solid #f3f4f6;
        text-align: left;
    }

    #stats-table td:last-child {
        border-bottom: none;
    }

    #stats-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6b7280;
        font-size: 0.85em;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        display: block;
        margin-bottom: 4px;
    }

    #stats-table td[data-label="Opponent"] {
        background: var(--primary-dark);
        color: white;
        font-size: 1.1em;
        font-weight: 600;
        padding: 16px;
    }

    #stats-table td[data-label="Opponent"]::before {
        color: rgba(255,255,255,0.8);
        margin-bottom: 6px;
    }

    #stats-table td[data-label="Opponent"] a {
        color: white;
        text-decoration: none;
    }

    #stats-table td[data-label="Win Rate"] {
        background: #f9fafb;
        font-size: 1.15em;
        font-weight: 700;
        color: var(--primary-color);
    }

    .stat-label {
        font-size: 0.75em;
    }

    /* Stack stats layout on mobile */
    .stats-layout-wrapper {
        grid-template-columns: 1fr;
    }

    /* Footer text smaller on mobile */
    .footer {
        font-size: 0.85em;
        padding: var(--spacing-md) 0;
    }

    /* Smaller login logo on mobile */
    .login-logo img {
        width: 80px;
        height: 80px;
    }

    /* Flash messages on mobile */
    .flash-message {
        top: 60px;
        right: 10px;
        left: 10px;
        font-size: 0.9em;
        padding: 12px 16px;
    }
}

/* User Actions Dropdown */
.user-actions-dropdown {
    position: relative;
    display: inline-block;
}

.actions-dropdown-toggle {
    cursor: pointer;
    white-space: nowrap;
}

.actions-dropdown-menu {
    display: none;
    position: fixed;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    min-width: 200px;
    z-index: 10000;
}

.actions-dropdown-menu.active {
    display: block;
}

.actions-dropdown-menu a {
    display: block;
    padding: 10px 15px;
    color: var(--text-dark);
    text-decoration: none;
    transition: background 0.2s;
}

.actions-dropdown-menu a:hover {
    background: #f5f5f5;
}

.actions-dropdown-menu a.text-danger {
    color: var(--danger-color);
}

.actions-dropdown-menu a.text-danger:hover {
    background: #fee;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 5px 0;
}

/* Dropdown header with close button */
.dropdown-header {
    display: none; /* Hidden on desktop */
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.dropdown-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.dropdown-close:hover {
    background: #e9ecef;
    color: #333;
}

/* Mobile optimizations for user actions dropdown */
@media screen and (max-width: 600px) {
    /* Override table row overflow for users table to allow dropdown */
    .admin-users-page .table-responsive {
        overflow: visible !important;
        overflow-x: visible !important;
    }

    #users-table,
    #users-table tbody,
    #users-table tr,
    #users-table td {
        overflow: visible !important;
    }

    /* Make actions dropdown appear as bottom sheet on mobile */
    .actions-dropdown-menu {
        position: fixed;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        top: auto !important;
        transform: none;
        min-width: auto;
        max-width: none;
        z-index: 10001;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
        max-height: 80vh;
        overflow-y: auto;
    }

    /* Show header with close button on mobile */
    .dropdown-header {
        display: flex;
    }

    /* Add overlay background when dropdown is active */
    .user-actions-dropdown.dropdown-active::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 10000;
    }

    .actions-dropdown-menu a {
        padding: 16px 20px;
        font-size: 16px;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .actions-dropdown-menu a:last-child {
        border-bottom: none;
    }
    
    .actions-dropdown-menu .dropdown-divider {
        margin: 0;
        height: 8px;
        background: #f0f0f0;
    }

    /* Adjust users table for mobile - simplified card layout */
    #users-table {
        border: none;
    }

    #users-table thead {
        display: none;
    }

    #users-table tbody {
        display: block;
    }

    #users-table tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid var(--border-color);
        border-radius: var(--border-radius);
        background: white;
        padding: 15px;
    }

    #users-table td {
        display: block;
        padding: 8px 0;
        border: none;
        text-align: left;
    }

    #users-table td::before {
        content: attr(data-label);
        font-weight: 600;
        display: inline-block;
        width: 100px;
        color: var(--text-muted);
    }

    #users-table td[data-label="Photo"] {
        text-align: center;
        padding: 10px 0;
    }

    #users-table td[data-label="Photo"]::before {
        display: none;
    }

    #users-table td[data-label="Actions"] {
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid var(--border-color);
    }

    #users-table td[data-label="Actions"]::before {
        display: none;
    }

    /* Match types grid mobile optimization */
    .types-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .type-card {
        padding: 15px;
        font-size: 1.05em;
    }

    /* Filter groups - stack vertically on mobile (admin pages only) */
    .admin-users-page .filter-group,
    .admin-match-types-page .filter-group,
    .create-user-form .filter-group,
    .create-type-form .filter-group {
        flex-direction: column !important;
        gap: var(--spacing-md) !important;
    }

    .admin-users-page .filter-group .form-group,
    .admin-match-types-page .filter-group .form-group,
    .create-user-form .filter-group .form-group,
    .create-type-form .filter-group .form-group {
        width: 100% !important;
        margin-bottom: 0;
    }

    /* Ensure all buttons are full-width on mobile for better touch targets */
    .btn:not(.btn-small):not(.close-modal):not(.photo-lightbox-close) {
        width: 100%;
        text-align: center;
    }

    /* Match cards - ensure good spacing */
    .match-card {
        padding: 12px !important;
        margin-bottom: 12px !important;
    }

    .match-actions {
        margin-top: 8px;
        gap: 6px;
    }

    /* Better button layout on mobile */
    .match-actions .btn-small {
        font-size: 13px;
        padding: 8px 10px;
        white-space: nowrap;
    }

    .match-actions .status-badge {
        margin-bottom: 4px;
    }

    .match-datetime {
        font-size: 0.9em;
        margin-bottom: 4px;
    }

    .match-location {
        font-size: 0.8em;
        margin-bottom: 2px;
    }

    .match-notes {
        font-size: 0.8em;
        margin-top: 2px;
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger-color); }
.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }
.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-md); }

/*
 * =============================================================================
 * END OF CSS - Continue to JavaScript in next section
 * =============================================================================
 */