:root {
    --primary-color: #007AFF;
    --background-color: #F2F2F7;
    --sidebar-width: 300px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    /* Status Colors */
    --status-playing: #34C759;
    --status-queued: #FF9500;
    --status-resting: #5856D6;
    --status-waiting: #FF3B30;
    --status-nogames: #8E8E93;
    /* Updated Mesh Gradient Variables - Harmonic Green Theme */
    --court-gradient-1: hsl(145, 50%, 72%);
    --court-gradient-2: hsl(135, 45%, 78%);
    --court-gradient-3: hsl(155, 40%, 75%);
    --court-overlay-1: rgba(255, 255, 255, 0.15);
    --court-overlay-2: rgba(0, 0, 0, 0.08);
    --court-shadow-1: rgba(0, 80, 40, 0.1);
    --court-shadow-2: rgba(0, 100, 50, 0.08);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background-color);
}

.container {
    display: grid;
    grid-template-columns: 300px 1fr 300px;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    position: relative; /* For absolute positioning of drag handle */
    min-width: 200px;
    max-width: 600px;
    width: 300px; /* Default width */
    transition: width 0.2s ease; /* Smooth width changes */
    background-color: white;
    border-right: 1px solid #E5E5EA;
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    min-height: 0; /* Important for nested flex scrolling */
    z-index: 10; /* Ensure sidebar is above other content */
}

.sidebar-header {
    flex-shrink: 0;
    margin-bottom: var(--spacing-lg);
}

.import-section {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-md);
    background: rgba(0, 0, 0, 0.02);
    border-radius: 12px;
}

#playerImport {
    padding: var(--spacing-sm);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    min-height: 80px;
    resize: vertical;
    background: white;
    font-size: 0.9em;
}

.primary-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    transition: opacity 0.2s;
    margin-bottom: var(--spacing-sm);
    height: 40px;
    min-width: 100px;
}

.primary-button:hover {
    opacity: 0.9;
}

/* Common styles for both desktop and mobile player lists */
.players-list,
.mobile-players-list {
    padding-bottom: 0;
    overflow-y: auto;
    height: auto;
}

.player-item {
    padding: 6px 10px; /* Further reduced padding */
    border-radius: 6px; /* Smaller radius */
    background: white;
    margin-bottom: 6px; /* Reduced margin */
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    transition: all 0.2s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
    min-width: 0; /* Enable flex item shrinking */
    gap: 6px; /* Reduced gap */
}

.player-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.player-info {
    display: flex;
    flex-direction: column;
    gap: 2px; /* Reduced gap */
    min-width: 0; /* Enable flex item shrinking */
    flex: 1; /* Allow it to grow and shrink */
}

.player-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px; /* Reduced gap */
    flex-wrap: wrap;
    margin-bottom: 2px; /* Reduced margin */
}

.player-name-level {
    display: flex;
    align-items: center;
    gap: 6px; /* Reduced gap */
    min-width: 0; /* Enable flex item shrinking */
    flex: 1;
}

.player-name {
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0; /* Enable text truncation */
    font-size: 0.95em; /* Slightly smaller font */
}

.player-stats {
    display: flex;
    align-items: center;
    gap: 6px; /* Reduced gap */
    font-size: 0.75em; /* Even smaller font */
    color: #666;
    flex-wrap: wrap;
    min-width: 0; /* Enable flex item shrinking */
}

.games-played, .last-game, .status-badge {
    display: flex;
    align-items: center;
    gap: 2px; /* Reduced gap */
}

.games-played i {
    color: #FFD700;
}

.last-game i {
    color: var(--primary-color);
}

.player-statuses {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: flex-end;
    flex-shrink: 0; /* Prevent status badges from shrinking */
}

.status-badge {
    font-size: 0.75em; /* Even smaller font */
    padding: 1px 3px; /* Reduced padding */
    border-radius: 3px;
    display: flex;
    align-items: center;
    gap: 2px; /* Reduced gap */
    background: rgba(0, 0, 0, 0.05);
    color: #666;
    flex-shrink: 0; /* Prevent badge from shrinking */
    white-space: nowrap; /* Prevent text wrapping */
}

.status-badge i {
    font-size: 0.9em;
}

/* Level control styles */
.level-control {
    display: flex;
    align-items: center;
    gap: 4px;
}

.skill-badge {
    font-size: 0.7em; /* Even smaller font */
    padding: 1px 4px; /* Reduced padding */
    border-radius: 10px; /* Smaller radius */
    white-space: nowrap;
}

.level-buttons {
    display: flex;
    gap: 1px; /* Reduced gap */
}

.level-btn {
    width: 16px; /* Smaller buttons */
    height: 16px; /* Smaller buttons */
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65em; /* Smaller icon */
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 2px; /* Smaller radius */
    cursor: pointer;
}

/* Tab pane styles to fix scrolling */
.tab-pane {
    display: none !important; /* Use !important to ensure it's hidden */
    height: 100%;
    overflow: hidden;
    flex-direction: column;
}

.tab-pane.active {
    display: flex !important; /* Use !important to override the previous rule */
}

.sidebar {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.tab-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#players-tab, #mobile-players-tab {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.players-list-controls, .mobile-players-list-controls {
    flex-shrink: 0;
}

/* Mobile specific styles */
@media (max-width: 768px) {
    .mobile-players-content {
        display: flex;
        flex-direction: column;
        height: calc(100vh - 60px); /* Account for tab bar */
        padding: var(--spacing-md);
        padding-bottom: calc(80px + env(safe-area-inset-bottom));
        overflow-y: auto;
    }
    
    .mobile-players-list {
        flex: 1;
        overflow-y: auto;
        padding-bottom: 20px;
        margin-top: 15px;
    }
    
    .mobile-players-list-controls {
        position: relative;
        z-index: 10;
        background-color: white;
        padding-bottom: 10px;
        margin-bottom: 10px;
    }
    
    .filter-sort-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .status-filters {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 10px;
    }
    
    .sort-options {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    /* Fix for mobile players tab */
    .tab-content {
        overflow: visible;
    }
    
    #mobile-players-tab {
        overflow: visible;
        height: auto;
    }
    
    .mobile-players-list {
        height: auto;
        overflow: visible;
    }
    
    .mobile-players-content {
        overflow-y: auto;
        height: calc(100vh - 60px);
        padding-bottom: calc(80px + env(safe-area-inset-bottom));
    }
}

.main-content {
    flex: 1;
    min-width: 0; /* Allow content to shrink below its preferred width */
    overflow-y: auto;
    padding: var(--spacing-lg);
    position: relative;
    z-index: 5; /* Below sidebar but above other content */
}

.courts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px;
    max-width: 1600px; /* Increased to accommodate more courts */
    margin: 0 auto;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .courts-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .courts-container {
        grid-template-columns: 1fr;
    }
}

.court-2d {
    aspect-ratio: 1 / 1.5;
    width: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    border-radius: 24px;
    margin-bottom: 10px;
    background: 
        /* Corner shadows */
        radial-gradient(
            circle at 0 0,
            var(--court-shadow-1) 0%,
            transparent 35%
        ),
        radial-gradient(
            circle at 100% 100%,
            var(--court-shadow-2) 0%,
            transparent 35%
        ),
        /* Radial highlight */
        radial-gradient(
            circle at 30% 20%,
            var(--court-overlay-1) 0%,
            transparent 50%
        ),
        /* Subtle shadow overlay */
        linear-gradient(
            45deg,
            var(--court-overlay-2) 0%,
            transparent 40%
        ),
        /* Base gradient */
        linear-gradient(
            165deg,
            var(--court-gradient-1) 0%,
            var(--court-gradient-2) 50%,
            var(--court-gradient-3) 100%
        );
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.12),
        inset 0 2px 4px rgba(255, 255, 255, 0.25);
    touch-action: manipulation; /* Optimize for touch */
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on iOS */
    transform: translateZ(0); /* Enable hardware acceleration */
    will-change: transform; /* Optimize animations */
}

.court-simulation {
    flex: 1;
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
}

.court-bottom-section {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 20px 20px 0 0;
    padding: var(--spacing-md);
    box-shadow: 
        0 -4px 12px rgba(0, 0, 0, 0.08),
        0 -2px 4px rgba(0, 0, 0, 0.04);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

@media (max-width: 768px) {
    .court-actions {
        margin-bottom: 0px !important;
    }

    /* Update court touch handling */
    .court-2d {
        /* Remove aspect ratio */
        aspect-ratio: 1/2;
        height: auto;
        /* Keep other existing styles */
        touch-action: none;
        width: calc(100% - var(--spacing-md) * 2);
        max-width: 100%;
        margin: var(--spacing-md);
        border-radius: 24px;
    }

    /* Ensure container allows scrolling */
    .courts-container {
        touch-action: pan-y; /* Enable vertical scrolling */
        -webkit-overflow-scrolling: touch;
        overflow-y: auto;
        overflow-x: hidden;
        width: 100%;
        padding: 0;
        margin: 0;
        max-width: 100%;
        grid-template-columns: 100%;
    }

    /* Ensure view container allows scrolling */
    .view {
        touch-action: pan-y; /* Enable vertical scrolling */
        -webkit-overflow-scrolling: touch;
        overflow-y: auto;
    }
}

.court-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-md);
}

.court-number {
    font-size: 1.2em;
    font-weight: 600;
    mix-blend-mode: difference;
    color: rgba(148, 148, 148, 0.787);
}

.court-status {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 1);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
}

.time-elapsed {
    color: #666;
    margin-left: 4px;
    font-weight: normal;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--status-playing);
}

.elapsed-time {
    display: flex;
    align-items: center;
    gap: 4px;
    color: white;
    font-weight: 500;
}

.court-content {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.court-lines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid rgba(255, 255, 255, 0.95);
    margin: var(--spacing-md);
}

.doubles-sideline {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(255, 255, 255, 0.85);
}

.doubles-sideline.left {
    top: 15%;
}

.doubles-sideline.right {
    bottom: 15%;
}

.service-court {
    position: absolute;
    width: 15%;
    height: 35%;
    border: 1px dashed rgba(255, 255, 255, 0.75);
}

.service-court.top-left {
    top: 15%;
    left: 0;
}

.service-court.top-right {
    top: 15%;
    right: 0;
}

.service-court.bottom-left {
    bottom: 15%;
    left: 0;
}

.service-court.bottom-right {
    bottom: 15%;
    right: 0;
}

.net {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: white;
    
    transform: translateY(-50%);
}

.net-center {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    background: white;
    border-radius: 50%;
    
}

.team-section {
    position: relative;
    z-index: 1;
    padding: var(--spacing-sm);
    transition: opacity 0.3s ease;
}

.team-info {
    background: rgba(255, 255, 255, 0.98);
    padding: 8px;
    border-radius: 12px;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.06),
        0 1px 2px rgba(0, 0, 0, 0.04);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.team-players {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.player {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 6px;
    background: transparent;
    transition: background-color 0.2s ease;
}

.player span {
    font-size: 0.9em;
    font-weight: 500;
    color: #333;
}

.player:hover {
    background: rgba(0, 0, 0, 0.03);
}

/* Remove unnecessary player elements */
.player i,
.player-action-btn {
    display: none;
}

/* Active court styles */
.court-2d.active .court-status {
    color: var(--status-playing);
}

.court-2d.active .status-dot {
    background: var(--status-playing);
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .team-info {
        padding: 6px var(--spacing-sm);
    }

    .player {
        padding: 4px 6px;
    }

    .player-action-btn {
        opacity: 1;
        padding: 4px 6px;
    }

    .courts-container {
        grid-template-columns: 90vw; /* Single column for mobile */
        padding: var(--spacing-md);
        gap: var(--spacing-md);
        padding: 0px;
    }

    .court-2d {
        aspect-ratio: 3/4; /* More compact ratio for mobile */
        scroll-snap-align: center; /* Snap points for each court */
        scroll-snap-stop: always; /* Force stopping at snap points */
        touch-action: pan-x pan-y; /* Allow natural scrolling */
        pointer-events: none; /* Prevent touch interference */
        
        /* Keep existing styles */
        aspect-ratio: unset;
        min-height: 500px;
        width: calc(100% - var(--spacing-md) * 2);
        max-width: 100%;
        margin: var(--spacing-md);
        border-radius: 24px;
    }

    /* But allow touches on interactive elements */
    .court-header,
    .court-bottom-section,
    .queue-action-container,
    button {
        pointer-events: auto;
    }

    /* Ensure container scrolls smoothly */
    .courts-container {
        touch-action: pan-y;
        -webkit-overflow-scrolling: touch;
        padding-bottom: var(--spacing-lg);
    }
}

/* Tablet-specific optimizations */
@media (min-width: 769px) and (max-width: 1024px) {
    .courts-container {
        padding: 0px;
        grid-template-columns: repeat(2, calc(50% - var(--spacing-md))); /* Two columns for tablet */
    }

    .court-2d {
        aspect-ratio: 3/5; /* Balanced ratio for tablets */
        scroll-snap-align: center;
    }
}

/* Add momentum-based scrolling for iOS devices */
@supports (-webkit-touch-callout: none) {
    .courts-container {
        -webkit-overflow-scrolling: touch;
    }
}

.queue-preview {
    margin-top: var(--spacing-md);
    background: rgba(255, 255, 255, 0.98);
    border-radius: 16px;
    padding: var(--spacing-md);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.08),
        0 2px 4px rgba(0, 0, 0, 0.04);
}

.queue-preview h3 {
    font-size: 0.9em;
    color: #666;
    margin-bottom: var(--spacing-sm);
}

.queue-list {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 4px;
}

.queue-list::-webkit-scrollbar {
    width: 4px;
}

.queue-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 2px;
}

.queue-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
}

.queue-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.queue-item {
    margin-bottom: 8px;
    background: white;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.queue-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.queue-item .remove-queue-btn {
    background: none;
    border: none;
    color: #ff4444;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 0.9em;
    opacity: 0.7;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.queue-item .remove-queue-btn:hover {
    opacity: 1;
}

.queue-item .remove-queue-btn i {
    font-size: 0.9em;
}

.queue-number {
    background: white;
    color: black;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
}

.queue-players {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.team-a, .team-b {
    display: flex;
    align-items: center;
    gap: 8px;
}

.vs {
    color: #666;
    font-size: 0.9em;
    margin: 4px 0;
    font-style: italic;
}

.team-balance {
    font-size: 0.85em;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
}

.team-balance.balanced {
    background: rgba(52, 199, 89, 0.1);
    color: #34C759;
}

.team-balance.unbalanced {
    background: rgba(255, 149, 0, 0.1);
    color: #FF9500;
}

.queue-item .player {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.02);
    padding: 4px 8px;
    border-radius: 4px;
}

.queue-item.incomplete .player {
    opacity: 0.8;
}

.queue-item .waiting-text {
    color: #666;
    font-style: italic;
    font-size: 0.9em;
    margin-top: 4px;
}

.estimated-time {
    color: #666;
    font-size: 0.8em;
}

.court-2d:hover {
    transform: none;
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.12),
        inset 0 2px 4px rgba(255, 255, 255, 0.25);
    cursor: default;
    transition: none;
}

/* Update empty state styles */
.court-2d.empty {
    opacity: 1;
}

/* Remove empty team info styles since we're not showing them */
.team-info.empty {
    display: none;
}

/* Keep other empty state styles the same */
.queue-preview.empty {
    background: rgba(255, 255, 255, 0.9);
    min-height: 80px;
}

.quick-add-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    width: 100%;
    text-align: center;
    padding: 0 var(--spacing-lg);
    transition: all 0.3s ease;
}

.quick-add-btn {
    width: 100%;
    height: 40px;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.04);
    color: #333;
    border: none;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-bottom: var(--spacing-sm);
}

.quick-add-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

.quick-add-btn i {
    font-size: 1.2em;
}

/* Add mobile tab styles */
.mobile-tabs {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: var(--spacing-sm);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: var(--spacing-sm);
    background: none;
    border: none;
    color: #8E8E93;
    font-size: 0.8em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn i {
    font-size: 1.4em;
}

.tab-btn.active {
    color: var(--primary-color);
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.mobile-players-content {
    padding: var(--spacing-md);
    background: white;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Important for nested flex scrolling */
}

/* Update mobile styles */
@media (max-width: 768px) {
    /* Mobile tabs */
    .mobile-tabs {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: white;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        z-index: 100;
        height: 60px;
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .tab-btn {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 10px;
        background: none;
        border: none;
        color: #8E8E93;
        font-size: 12px;
        cursor: pointer;
    }
    
    .tab-btn i {
        font-size: 20px;
        margin-bottom: 4px;
    }
    
    .tab-btn.active {
        color: var(--primary-color);
    }
    
    /* Views */
    .view {
        display: none;
        height: calc(100vh - 60px); /* Account for tab bar */
        overflow-y: auto;
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .view.active {
        display: block;
    }
    
    /* Hide sidebar on mobile in courts view */
    #courts-view .sidebar {
        display: none;
    }
    
    /* Courts view layout */
    #courts-view .container {
        display: flex;
        flex-direction: column;
        height: 100%;
    }
    
    #courts-view .main-content {
        flex: 1;
        width: 100%;
        padding: 10px;
    }
    
    /* Courts container */
    .courts-container {
        width: 100%;
        padding: 0;
        margin: 0;
        max-width: 100%;
        grid-template-columns: 100%; /* Full width single column */
        display: grid;
        gap: 15px;
    }
    
    /* Players view */
    .mobile-players-content {
        display: flex;
        flex-direction: column;
        height: calc(100vh - 60px); /* Account for tab bar */
        padding: var(--spacing-md);
        padding-bottom: calc(80px + env(safe-area-inset-bottom));
        overflow-y: auto;
    }
    
    .mobile-players-list {
        flex: 1;
        overflow-y: auto;
        padding-bottom: 20px;
        margin-top: 15px;
    }
    
    .mobile-players-list-controls {
        position: relative;
        z-index: 10;
        background-color: white;
        padding-bottom: 10px;
        margin-bottom: 10px;
    }
    
    .filter-sort-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .status-filters {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 10px;
    }
    
    .sort-options {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    /* Queue view */
    .container .global-queue-container {
        display: none; /* Hide desktop queue on mobile */
    }
    
    .mobile-queue-content .global-queue-container {
        display: block; /* Show mobile queue in queue tab */
        width: 100%;
        padding: 10px;
    }
    
    .global-queue-section {
        width: 100%;
    }
}

/* Add safe area padding for iOS devices */
@supports (padding: env(safe-area-inset-bottom)) {
    .mobile-players-content {
        padding-bottom: calc(60px + env(safe-area-inset-bottom));
    }

    .mobile-tabs {
        padding-bottom: calc(var(--spacing-sm) + env(safe-area-inset-bottom));
    }
}

/* Add iPhone SE / smaller device optimization */
@media (max-width: 768px) and (max-height: 667px) {
    .court-2d {
        aspect-ratio: 6.1/9; /* Even shorter for small devices */
        max-height: calc(100vh - 160px);
    }
}

/* Update court gradient overlay for softer effect */
.court-2d::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
    opacity: 0.1;
    pointer-events: none;
}

/* Ensure court lines are visible on all backgrounds */
.court-lines {
    border-color: rgba(255, 255, 255, 0.95);
}

.doubles-sideline {
    background: rgba(255, 255, 255, 0.85);
}

.service-court {
    border-color: rgba(255, 255, 255, 0.75);
}

/* Modal Base Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

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

.modal-content {
    max-width: 480px;
    width: 90%;
    max-height: 85vh;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #000;
}

.modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Important for nested flex scrolling */
    padding: 20px;
    gap: var(--spacing-md);
}

.players-section {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0; /* Important for nested flex scrolling */
}

/* Update search container position */
.search-container {
    flex-shrink: 0;
    margin-bottom: var(--spacing-md);
}

/* Update section header position */
.section-header {
    flex-shrink: 0;
    margin-bottom: var(--spacing-md);
}

/* Update players grid position */
.players-grid {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px; /* Space for scrollbar */
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Search Input */
.player-search-input {
    width: 100%;
    height: 40px;
    padding: 0 16px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    font-size: 15px;
    background: #F5F5F7;
}

.player-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
}

/* Selected Count */
.selected-count {
    flex-shrink: 0;
    margin-top: 0;
}

/* Modal Footer */
.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-btn {
    height: 40px;
    min-width: 100px;
    padding: var(--spacing-sm) var(--spacing-md);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.modal-btn.secondary {
    background: rgba(0, 0, 0, 0.04);
    color: #666;
}

.modal-btn.secondary:hover {
    background: rgba(0, 0, 0, 0.06);
}

.modal-btn.primary {
    background: var(--primary-color);
    color: white;
}

.modal-btn.primary:hover {
    opacity: 0.9;
}

/* Updated player chip styling */
.players-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.player-chip {
    padding: 16px;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.player-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.player-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.player-name {
    font-size: 15px;
    font-weight: 500;
    color: #000;
}

.player-stats {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* Style stat chips */
.player-stats > span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    background: rgba(0, 0, 0, 0.05);
    color: #666;
}

.player-stats .games-played {
    background: rgba(255, 215, 0, 0.1);
    color: #B8860B;
}

.player-stats .last-game-time {
    background: rgba(0, 122, 255, 0.1);
    color: var(--primary-color);
}

.player-stats .player-current-status {
    background: rgba(88, 86, 214, 0.1);
    color: var(--status-resting);
}

.player-stats i {
    font-size: 11px;
}

.selection-indicator {
    font-size: 13px;
    font-weight: 500;
    color: #666;
    padding: 6px 12px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.player-chip.selected .selection-indicator {
    background: rgba(52, 199, 89, 0.1);
    color: var(--status-playing);
}

.player-chip.selected {
    border-color: var(--status-playing);
}

/* Update disabled state */
.player-chip.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f5f5f7;
}

/* Queue Modal specific overrides */
.queue-modal .player-chip.selected {
    border-color: var(--primary-color);
}

.queue-modal .player-chip.selected .selection-indicator {
    background: rgba(0, 122, 255, 0.1);
    color: var(--primary-color);
}

/* Add transition styles */
.court-2d .team-section {
    transition: all 0.3s ease;
}

.court-2d.empty .team-section {
    opacity: 0;
}

.court-2d.active .team-section {
    opacity: 1;
}

.quick-add-container {
    transition: opacity 0.3s ease;
}

.court-2d.active .quick-add-container {
    opacity: 1;
    pointer-events: auto;
}

/* Add danger button style */
.danger-button {
    background: rgba(255, 59, 48, 0.1);
    color: var(--status-waiting);
    border: none;
    height: 40px;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    transition: background-color 0.2s ease;
    margin-bottom: var(--spacing-sm);
    min-width: 100px;
}

.danger-button:hover {
    background: rgba(255, 59, 48, 0.15);
}

.danger-button i {
    opacity: 0.8;
}

/* Update start game button style */
.start-game-btn {
    background: rgba(52, 199, 89, 0.1) !important;
    color: var(--status-playing) !important;
    border: none;
    font-size: 0.9em;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 12px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: none;
    width: 100%;
    margin-bottom: 10px;
    max-width: none;
    height: 40px;
}

.start-game-btn:hover {
    background: rgba(52, 199, 89, 0.15) !important;
}

.start-game-btn i {
    color: var(--status-playing) !important;
}

/* Add any missing component-specific styles */
.court-2d.ready .status-dot {
    background: var(--status-queued);
}

.court-2d.in_progress .status-dot {
    background: var(--status-playing);
}

/* Add transition for status changes */
.court-2d {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.team-section {
    transition: opacity 0.3s ease;
}

/* Toast Container */
.toast-container {
    position: fixed;
    top: calc(env(safe-area-inset-top) + 16px);
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

/* Toast Notification */
.toast {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateX(100%);
    animation: toast-slide-in 0.3s ease forwards;
    position: relative;
    overflow: hidden;
    min-width: 200px;
    max-width: 400px;
    pointer-events: auto;
}

/* Toast Types */
.toast-success {
    background: rgba(52, 199, 89, 0.9);
}

.toast-error {
    background: rgba(255, 59, 48, 0.9);
}

.toast-warning {
    background: rgba(255, 149, 0, 0.9);
}

.toast-info {
    background: rgba(0, 122, 255, 0.9);
}

/* Toast Count Badge */
.toast-count {
    margin-left: 6px;
    font-size: 0.9em;
    opacity: 0.8;
}

/* Toast Progress Bar */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    transform-origin: left;
}

/* Toast Animations */
@keyframes toast-slide-in {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toast-progress {
    from {
        transform: scaleX(1);
    }
    to {
        transform: scaleX(0);
    }
}

.toast-fade-out {
    animation: toast-fade-out 0.3s ease forwards;
}

@keyframes toast-fade-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Adjust for mobile */
@media (max-width: 768px) {
    .toast-container {
        left: 16px;
        right: 16px;
    }
    
    .toast {
        width: 100%;
        max-width: none;
    }
}

/* Add queue button styles */
.queue-action-container {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
}

/* Update queue button styles */
.add-to-queue-btn {
    height: 40px !important; /* Force height with !important to override any conflicts */
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.04);
    border: none;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.add-to-queue-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

/* Update court actions layout */
.court-actions {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    
}

/* Add margin to complete game button */
.complete-game-btn {
    background: rgba(52, 199, 89, 0.1) !important;
    color: var(--status-playing) !important;
    border: none;
    margin-bottom: 5px;
}

/* Consistent button styles */
.court-button {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 8px;
    border: none;
    background: rgba(0, 0, 0, 0.04);
    color: #333;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-bottom: var(--spacing-sm);
}

.court-button:hover {
    background: rgba(0, 0, 0, 0.06);
}

.court-button i {
    color: #666;
    font-size: 14px;
}

/* Queue section */
.queue-section {
    margin-top: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
}

.queue-header {
    font-size: 0.75em;
    color: #666;
    margin-bottom: 4px;
}

.queue-list {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 4px;
}

.queue-list::-webkit-scrollbar {
    width: 4px;
}

.queue-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 2px;
}

.queue-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
}

.queue-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.queue-item {
    margin-bottom: 8px;
    background: white;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.queue-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.queue-item .remove-queue-btn {
    background: none;
    border: none;
    color: #ff4444;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 0.9em;
    opacity: 0.7;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.queue-item .remove-queue-btn:hover {
    opacity: 1;
}

.queue-item .remove-queue-btn i {
    font-size: 0.9em;
}

.queue-number {
    background: white;
    color: black;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
}

.queue-players {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.team-a, .team-b {
    display: flex;
    align-items: center;
    gap: 8px;
}

.vs {
    color: #666;
    font-size: 0.9em;
    margin: 4px 0;
    font-style: italic;
}

.team-balance {
    font-size: 0.85em;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
}

.team-balance.balanced {
    background: rgba(52, 199, 89, 0.1);
    color: #34C759;
}

.team-balance.unbalanced {
    background: rgba(255, 149, 0, 0.1);
    color: #FF9500;
}

.queue-item .player {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.02);
    padding: 4px 8px;
    border-radius: 4px;
}

.queue-item.incomplete .player {
    opacity: 0.8;
}

.queue-item .waiting-text {
    color: #666;
    font-style: italic;
    font-size: 0.9em;
    margin-top: 4px;
}

.estimated-time {
    color: #666;
    font-size: 0.8em;
}

.court-2d:hover {
    transform: none;
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.12),
        inset 0 2px 4px rgba(255, 255, 255, 0.25);
    cursor: default;
    transition: none;
}

/* Update empty state styles */
.court-2d.empty {
    opacity: 1;
}

/* Remove empty team info styles since we're not showing them */
.team-info.empty {
    display: none;
}

/* Keep other empty state styles the same */
.queue-preview.empty {
    background: rgba(255, 255, 255, 0.9);
    min-height: 80px;
}

.quick-add-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    width: 100%;
    text-align: center;
    padding: 0 var(--spacing-lg);
    transition: all 0.3s ease;
}

.quick-add-btn {
    width: 100%;
    height: 40px;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.04);
    color: #333;
    border: none;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-bottom: var(--spacing-sm);
}

.quick-add-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

.quick-add-btn i {
    font-size: 1.2em;
}

/* Add mobile tab styles */
.mobile-tabs {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: var(--spacing-sm);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: var(--spacing-sm);
    background: none;
    border: none;
    color: #8E8E93;
    font-size: 0.8em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn i {
    font-size: 1.4em;
}

.tab-btn.active {
    color: var(--primary-color);
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.mobile-players-content {
    padding: var(--spacing-md);
    background: white;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Important for nested flex scrolling */
}

/* Update mobile styles */
@media (max-width: 768px) {
    /* Mobile tabs */
    .mobile-tabs {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: white;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        z-index: 100;
        height: 60px;
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .tab-btn {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 10px;
        background: none;
        border: none;
        color: #8E8E93;
        font-size: 12px;
        cursor: pointer;
    }
    
    .tab-btn i {
        font-size: 20px;
        margin-bottom: 4px;
    }
    
    .tab-btn.active {
        color: var(--primary-color);
    }
    
    /* Views */
    .view {
        display: none;
        height: calc(100vh - 60px); /* Account for tab bar */
        overflow-y: auto;
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .view.active {
        display: block;
    }
    
    /* Hide sidebar on mobile in courts view */
    #courts-view .sidebar {
        display: none;
    }
    
    /* Courts view layout */
    #courts-view .container {
        display: flex;
        flex-direction: column;
        height: 100%;
    }
    
    #courts-view .main-content {
        flex: 1;
        width: 100%;
        padding: 10px;
    }
    
    /* Courts container */
    .courts-container {
        width: 100%;
        padding: 0;
        margin: 0;
        max-width: 100%;
        grid-template-columns: 100%; /* Full width single column */
        display: grid;
        gap: 15px;
    }
    
    /* Players view */
    .mobile-players-content {
        display: flex;
        flex-direction: column;
        height: calc(100vh - 60px); /* Account for tab bar */
        padding: var(--spacing-md);
        padding-bottom: calc(80px + env(safe-area-inset-bottom));
        overflow-y: auto;
    }
    
    .mobile-players-list {
        flex: 1;
        overflow-y: auto;
        padding-bottom: 20px;
        margin-top: 15px;
    }
    
    .mobile-players-list-controls {
        position: relative;
        z-index: 10;
        background-color: white;
        padding-bottom: 10px;
        margin-bottom: 10px;
    }
    
    .filter-sort-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .status-filters {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 10px;
    }
    
    .sort-options {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    /* Queue view */
    .container .global-queue-container {
        display: none; /* Hide desktop queue on mobile */
    }
    
    .mobile-queue-content .global-queue-container {
        display: block; /* Show mobile queue in queue tab */
        width: 100%;
        padding: 10px;
    }
    
    .global-queue-section {
        width: 100%;
    }
}

/* Add safe area padding for iOS devices */
@supports (padding: env(safe-area-inset-bottom)) {
    .mobile-players-content {
        padding-bottom: calc(60px + env(safe-area-inset-bottom));
    }

    .mobile-tabs {
        padding-bottom: calc(var(--spacing-sm) + env(safe-area-inset-bottom));
    }
}

/* Add iPhone SE / smaller device optimization */
@media (max-width: 768px) and (max-height: 667px) {
    .court-2d {
        aspect-ratio: 6.1/9; /* Even shorter for small devices */
        max-height: calc(100vh - 160px);
    }
}

/* Update court gradient overlay for softer effect */
.court-2d::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
    opacity: 0.1;
    pointer-events: none;
}

/* Ensure court lines are visible on all backgrounds */
.court-lines {
    border-color: rgba(255, 255, 255, 0.95);
}

.doubles-sideline {
    background: rgba(255, 255, 255, 0.85);
}

.service-court {
    border-color: rgba(255, 255, 255, 0.75);
}

/* Modal Base Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

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

.modal-content {
    max-width: 480px;
    width: 90%;
    max-height: 85vh;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #000;
}

.modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Important for nested flex scrolling */
    padding: 20px;
    gap: var(--spacing-md);
}

.players-section {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0; /* Important for nested flex scrolling */
}

/* Update search container position */
.search-container {
    flex-shrink: 0;
    margin-bottom: var(--spacing-md);
}

/* Update section header position */
.section-header {
    flex-shrink: 0;
    margin-bottom: var(--spacing-md);
}

/* Update players grid position */
.players-grid {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px; /* Space for scrollbar */
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Search Input */
.player-search-input {
    width: 100%;
    height: 40px;
    padding: 0 16px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    font-size: 15px;
    background: #F5F5F7;
}

.player-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
}

/* Selected Count */
.selected-count {
    flex-shrink: 0;
    margin-top: 0;
}

/* Modal Footer */
.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-btn {
    height: 40px;
    min-width: 100px;
    padding: var(--spacing-sm) var(--spacing-md);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.modal-btn.secondary {
    background: rgba(0, 0, 0, 0.04);
    color: #666;
}

.modal-btn.secondary:hover {
    background: rgba(0, 0, 0, 0.06);
}

.modal-btn.primary {
    background: var(--primary-color);
    color: white;
}

.modal-btn.primary:hover {
    opacity: 0.9;
}

/* Updated player chip styling */
.players-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.player-chip {
    padding: 16px;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.player-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.player-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.player-name {
    font-size: 15px;
    font-weight: 500;
    color: #000;
}

.player-stats {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* Style stat chips */
.player-stats > span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    background: rgba(0, 0, 0, 0.05);
    color: #666;
}

.player-stats .games-played {
    background: rgba(255, 215, 0, 0.1);
    color: #B8860B;
}

.player-stats .last-game-time {
    background: rgba(0, 122, 255, 0.1);
    color: var(--primary-color);
}

.player-stats .player-current-status {
    background: rgba(88, 86, 214, 0.1);
    color: var(--status-resting);
}

.player-stats i {
    font-size: 11px;
}

.selection-indicator {
    font-size: 13px;
    font-weight: 500;
    color: #666;
    padding: 6px 12px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.player-chip.selected .selection-indicator {
    background: rgba(52, 199, 89, 0.1);
    color: var(--status-playing);
}

.player-chip.selected {
    border-color: var(--status-playing);
}

/* Update disabled state */
.player-chip.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f5f5f7;
}

/* Queue Modal specific overrides */
.queue-modal .player-chip.selected {
    border-color: var(--primary-color);
}

.queue-modal .player-chip.selected .selection-indicator {
    background: rgba(0, 122, 255, 0.1);
    color: var(--primary-color);
}

/* Add transition styles */
.court-2d .team-section {
    transition: all 0.3s ease;
}

.court-2d.empty .team-section {
    opacity: 0;
}

.court-2d.active .team-section {
    opacity: 1;
}

.quick-add-container {
    transition: opacity 0.3s ease;
}

.court-2d.active .quick-add-container {
    opacity: 1;
    pointer-events: auto;
}

/* Add danger button style */
.danger-button {
    background: rgba(255, 59, 48, 0.1);
    color: var(--status-waiting);
    border: none;
    height: 40px;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    transition: background-color 0.2s ease;
    margin-bottom: var(--spacing-sm);
    min-width: 100px;
}

.danger-button:hover {
    background: rgba(255, 59, 48, 0.15);
}

.danger-button i {
    opacity: 0.8;
}

/* Update start game button style */
.start-game-btn {
    background: rgba(52, 199, 89, 0.1) !important;
    color: var(--status-playing) !important;
    border: none;
    font-size: 0.9em;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 12px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: none;
    width: 100%;
    margin-bottom: 10px;
    max-width: none;
    height: 40px;
}

.start-game-btn:hover {
    background: rgba(52, 199, 89, 0.15) !important;
}

.start-game-btn i {
    color: var(--status-playing) !important;
}

/* Add any missing component-specific styles */
.court-2d.ready .status-dot {
    background: var(--status-queued);
}

.court-2d.in_progress .status-dot {
    background: var(--status-playing);
}

/* Add transition for status changes */
.court-2d {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.team-section {
    transition: opacity 0.3s ease;
}

/* Toast Container */
.toast-container {
    position: fixed;
    top: calc(env(safe-area-inset-top) + 16px);
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

/* Toast Notification */
.toast {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateX(100%);
    animation: toast-slide-in 0.3s ease forwards;
    position: relative;
    overflow: hidden;
    min-width: 200px;
    max-width: 400px;
    pointer-events: auto;
}

/* Toast Types */
.toast-success {
    background: rgba(52, 199, 89, 0.9);
}

.toast-error {
    background: rgba(255, 59, 48, 0.9);
}

.toast-warning {
    background: rgba(255, 149, 0, 0.9);
}

.toast-info {
    background: rgba(0, 122, 255, 0.9);
}

/* Toast Count Badge */
.toast-count {
    margin-left: 6px;
    font-size: 0.9em;
    opacity: 0.8;
}

/* Toast Progress Bar */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    transform-origin: left;
}

/* Toast Animations */
@keyframes toast-slide-in {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toast-progress {
    from {
        transform: scaleX(1);
    }
    to {
        transform: scaleX(0);
    }
}

.toast-fade-out {
    animation: toast-fade-out 0.3s ease forwards;
}

@keyframes toast-fade-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Adjust for mobile */
@media (max-width: 768px) {
    .toast-container {
        left: 16px;
        right: 16px;
    }
    
    .toast {
        width: 100%;
        max-width: none;
    }
}

/* Add queue button styles */
.queue-action-container {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
}

/* Update queue button styles */
.add-to-queue-btn {
    height: 40px !important; /* Force height with !important to override any conflicts */
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.04);
    border: none;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.add-to-queue-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

/* Update court actions layout */
.court-actions {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    
}

/* Add margin to complete game button */
.complete-game-btn {
    background: rgba(52, 199, 89, 0.1) !important;
    color: var(--status-playing) !important;
    border: none;
    margin-bottom: 5px;
}

/* Consistent button styles */
.court-button {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 8px;
    border: none;
    background: rgba(0, 0, 0, 0.04);
    color: #333;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-bottom: var(--spacing-sm);
}

.court-button:hover {
    background: rgba(0, 0, 0, 0.06);
}

.court-button i {
    color: #666;
    font-size: 14px;
}

/* Queue section */
.queue-section {
    margin-top: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
}

.queue-header {
    font-size: 0.75em;
    color: #666;
    margin-bottom: 4px;
}

.queue-list {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 4px;
}

.queue-list::-webkit-scrollbar {
    width: 4px;
}

.queue-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 2px;
}

.queue-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
}

.queue-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.queue-item {
    margin-bottom: 8px;
    background: white;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.queue-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.queue-item .remove-queue-btn {
    background: none;
    border: none;
    color: #ff4444;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 0.9em;
    opacity: 0.7;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.queue-item .remove-queue-btn:hover {
    opacity: 1;
}

.queue-item .remove-queue-btn i {
    font-size: 0.9em;
}

.queue-number {
    background: white;
    color: black;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
}

.queue-players {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.team-a, .team-b {
    display: flex;
    align-items: center;
    gap: 8px;
}

.vs {
    color: #666;
    font-size: 0.9em;
    margin: 4px 0;
    font-style: italic;
}

.team-balance {
    font-size: 0.85em;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
}

.team-balance.balanced {
    background: rgba(52, 199, 89, 0.1);
    color: #34C759;
}

.team-balance.unbalanced {
    background: rgba(255, 149, 0, 0.1);
    color: #FF9500;
}

.queue-item .player {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.02);
    padding: 4px 8px;
    border-radius: 4px;
}

.queue-item.incomplete .player {
    opacity: 0.8;
}

.queue-item .waiting-text {
    color: #666;
    font-style: italic;
    font-size: 0.9em;
    margin-top: 4px;
}

.estimated-time {
    color: #666;
    font-size: 0.8em;
}

.court-2d:hover {
    transform: none;
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.12),
        inset 0 2px 4px rgba(255, 255, 255, 0.25);
    cursor: default;
    transition: none;
}

/* Update empty state styles */
.court-2d.empty {
    opacity: 1;
}

/* Remove empty team info styles since we're not showing them */
.team-info.empty {
    display: none;
}

/* Keep other empty state styles the same */
.queue-preview.empty {
    background: rgba(255, 255, 255, 0.9);
    min-height: 80px;
}

.quick-add-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    width: 100%;
    text-align: center;
    padding: 0 var(--spacing-lg);
    transition: all 0.3s ease;
}

.quick-add-btn {
    width: 100%;
    height: 40px;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.04);
    color: #333;
    border: none;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-bottom: var(--spacing-sm);
}

.quick-add-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

.quick-add-btn i {
    font-size: 1.2em;
}

/* Add mobile tab styles */
.mobile-tabs {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: var(--spacing-sm);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: var(--spacing-sm);
    background: none;
    border: none;
    color: #8E8E93;
    font-size: 0.8em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn i {
    font-size: 1.4em;
}

.tab-btn.active {
    color: var(--primary-color);
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.mobile-players-content {
    padding: var(--spacing-md);
    background: white;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Important for nested flex scrolling */
}

/* Update mobile styles */
@media (max-width: 768px) {
    /* Mobile tabs */
    .mobile-tabs {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: white;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        z-index: 100;
        height: 60px;
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .tab-btn {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 10px;
        background: none;
        border: none;
        color: #8E8E93;
        font-size: 12px;
        cursor: pointer;
    }
    
    .tab-btn i {
        font-size: 20px;
        margin-bottom: 4px;
    }
    
    .tab-btn.active {
        color: var(--primary-color);
    }
    
    /* Views */
    .view {
        display: none;
        height: calc(100vh - 60px); /* Account for tab bar */
        overflow-y: auto;
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .view.active {
        display: block;
    }
    
    /* Hide sidebar on mobile in courts view */
    #courts-view .sidebar {
        display: none;
    }
    
    /* Courts view layout */
    #courts-view .container {
        display: flex;
        flex-direction: column;
        height: 100%;
    }
    
    #courts-view .main-content {
        flex: 1;
        width: 100%;
        padding: 10px;
    }
    
    /* Courts container */
    .courts-container {
        width: 100%;
        padding: 0;
        margin: 0;
        max-width: 100%;
        grid-template-columns: 100%; /* Full width single column */
        display: grid;
        gap: 15px;
    }
    
    /* Players view */
    .mobile-players-content {
        display: flex;
        flex-direction: column;
        height: calc(100vh - 60px); /* Account for tab bar */
        padding: var(--spacing-md);
        padding-bottom: calc(80px + env(safe-area-inset-bottom));
        overflow-y: auto;
    }
    
    .mobile-players-list {
        flex: 1;
        overflow-y: auto;
        padding-bottom: 20px;
        margin-top: 15px;
    }
    
    .mobile-players-list-controls {
        position: relative;
        z-index: 10;
        background-color: white;
        padding-bottom: 10px;
        margin-bottom: 10px;
    }
    
    .filter-sort-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .status-filters {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 10px;
    }
    
    .sort-options {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    /* Queue view */
    .container .global-queue-container {
        display: none; /* Hide desktop queue on mobile */
    }
    
    .mobile-queue-content .global-queue-container {
        display: block; /* Show mobile queue in queue tab */
        width: 100%;
        padding: 10px;
    }
    
    .global-queue-section {
        width: 100%;
    }
}

/* Add safe area padding for iOS devices */
@supports (padding: env(safe-area-inset-bottom)) {
    .mobile-players-content {
        padding-bottom: calc(60px + env(safe-area-inset-bottom));
    }

    .mobile-tabs {
        padding-bottom: calc(var(--spacing-sm) + env(safe-area-inset-bottom));
    }
}

/* Add iPhone SE / smaller device optimization */
@media (max-width: 768px) and (max-height: 667px) {
    .court-2d {
        aspect-ratio: 6.1/9; /* Even shorter for small devices */
        max-height: calc(100vh - 160px);
    }
}

/* Update court gradient overlay for softer effect */
.court-2d::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
    opacity: 0.1;
    pointer-events: none;
}

/* Ensure court lines are visible on all backgrounds */
.court-lines {
    border-color: rgba(255, 255, 255, 0.95);
}

.doubles-sideline {
    background: rgba(255, 255, 255, 0.85);
}

.service-court {
    border-color: rgba(255, 255, 255, 0.75);
}

/* Modal Base Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

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

.modal-content {
    max-width: 480px;
    width: 90%;
    max-height: 85vh;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #000;
}

.modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Important for nested flex scrolling */
    padding: 20px;
    gap: var(--spacing-md);
}

.players-section {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0; /* Important for nested flex scrolling */
}

/* Update search container position */
.search-container {
    flex-shrink: 0;
    margin-bottom: var(--spacing-md);
}

/* Update section header position */
.section-header {
    flex-shrink: 0;
    margin-bottom: var(--spacing-md);
}

/* Update players grid position */
.players-grid {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px; /* Space for scrollbar */
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Search Input */
.player-search-input {
    width: 100%;
    height: 40px;
    padding: 0 16px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    font-size: 15px;
    background: #F5F5F7;
}

.player-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
}

/* Selected Count */
.selected-count {
    flex-shrink: 0;
    margin-top: 0;
}

/* Modal Footer */
.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-btn {
    height: 40px;
    min-width: 100px;
    padding: var(--spacing-sm) var(--spacing-md);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.modal-btn.secondary {
    background: rgba(0, 0, 0, 0.04);
    color: #666;
}

.modal-btn.secondary:hover {
    background: rgba(0, 0, 0, 0.06);
}

.modal-btn.primary {
    background: var(--primary-color);
    color: white;
}

.modal-btn.primary:hover {
    opacity: 0.9;
}

/* Updated player chip styling */
.players-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.player-chip {
    padding: 16px;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.player-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.player-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.player-name {
    font-size: 15px;
    font-weight: 500;
    color: #000;
}

.player-stats {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* Style stat chips */
.player-stats > span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    background: rgba(0, 0, 0, 0.05);
    color: #666;
}

.player-stats .games-played {
    background: rgba(255, 215, 0, 0.1);
    color: #B8860B;
}

.player-stats .last-game-time {
    background: rgba(0, 122, 255, 0.1);
    color: var(--primary-color);
}

.player-stats .player-current-status {
    background: rgba(88, 86, 214, 0.1);
    color: var(--status-resting);
}

.player-stats i {
    font-size: 11px;
}

.selection-indicator {
    font-size: 13px;
    font-weight: 500;
    color: #666;
    padding: 6px 12px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.player-chip.selected .selection-indicator {
    background: rgba(52, 199, 89, 0.1);
    color: var(--status-playing);
}

.player-chip.selected {
    border-color: var(--status-playing);
}

/* Update disabled state */
.player-chip.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f5f5f7;
}

/* Queue Modal specific overrides */
.queue-modal .player-chip.selected {
    border-color: var(--primary-color);
}

.queue-modal .player-chip.selected .selection-indicator {
    background: rgba(0, 122, 255, 0.1);
    color: var(--primary-color);
}

/* Add transition styles */
.court-2d .team-section {
    transition: all 0.3s ease;
}

.court-2d.empty .team-section {
    opacity: 0;
}

.court-2d.active .team-section {
    opacity: 1;
}

.quick-add-container {
    transition: opacity 0.3s ease;
}

.court-2d.active .quick-add-container {
    opacity: 1;
    pointer-events: auto;
}

/* Add danger button style */
.danger-button {
    background: rgba(255, 59, 48, 0.1);
    color: var(--status-waiting);
    border: none;
    height: 40px;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    transition: background-color 0.2s ease;
    margin-bottom: var(--spacing-sm);
    min-width: 100px;
}

.danger-button:hover {
    background: rgba(255, 59, 48, 0.15);
}

.danger-button i {
    opacity: 0.8;
}

/* Update start game button style */
.start-game-btn {
    background: rgba(52, 199, 89, 0.1) !important;
    color: var(--status-playing) !important;
    border: none;
    font-size: 0.9em;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 12px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: none;
    width: 100%;
    margin-bottom: 10px;
    max-width: none;
    height: 40px;
}

.start-game-btn:hover {
    background: rgba(52, 199, 89, 0.15) !important;
}

.start-game-btn i {
    color: var(--status-playing) !important;
}

/* Add any missing component-specific styles */
.court-2d.ready .status-dot {
    background: var(--status-queued);
}

.court-2d.in_progress .status-dot {
    background: var(--status-playing);
}

/* Add transition for status changes */
.court-2d {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.team-section {
    transition: opacity 0.3s ease;
}

/* Toast Container */
.toast-container {
    position: fixed;
    top: calc(env(safe-area-inset-top) + 16px);
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

/* Toast Notification */
.toast {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateX(100%);
    animation: toast-slide-in 0.3s ease forwards;
    position: relative;
    overflow: hidden;
    min-width: 200px;
    max-width: 400px;
    pointer-events: auto;
}

/* Toast Types */
.toast-success {
    background: rgba(52, 199, 89, 0.9);
}

.toast-error {
    background: rgba(255, 59, 48, 0.9);
}

.toast-warning {
    background: rgba(255, 149, 0, 0.9);
}

.toast-info {
    background: rgba(0, 122, 255, 0.9);
}

/* Toast Count Badge */
.toast-count {
    margin-left: 6px;
    font-size: 0.9em;
    opacity: 0.8;
}

/* Toast Progress Bar */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    transform-origin: left;
}

/* Toast Animations */
@keyframes toast-slide-in {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toast-progress {
    from {
        transform: scaleX(1);
    }
    to {
        transform: scaleX(0);
    }
}

.toast-fade-out {
    animation: toast-fade-out 0.3s ease forwards;
}

@keyframes toast-fade-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Adjust for mobile */
@media (max-width: 768px) {
    .toast-container {
        left: 16px;
        right: 16px;
    }
    
    .toast {
        width: 100%;
        max-width: none;
    }
}

/* Add queue button styles */
.queue-action-container {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
}

/* Update queue button styles */
.add-to-queue-btn {
    height: 40px !important; /* Force height with !important to override any conflicts */
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.04);
    border: none;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.add-to-queue-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

/* Update court actions layout */
.court-actions {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    
}

/* Add margin to complete game button */
.complete-game-btn {
    background: rgba(52, 199, 89, 0.1) !important;
    color: var(--status-playing) !important;
    border: none;
    margin-bottom: 5px;
}

/* Consistent button styles */
.court-button {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 8px;
    border: none;
    background: rgba(0, 0, 0, 0.04);
    color: #333;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-bottom: var(--spacing-sm);
}

.court-button:hover {
    background: rgba(0, 0, 0, 0.06);
}

.court-button i {
    color: #666;
    font-size: 14px;
}

/* Queue section */
.queue-section {
    margin-top: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
}

.queue-header {
    font-size: 0.75em;
    color: #666;
    margin-bottom: 4px;
}

.queue-list {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 4px;
}

.queue-list::-webkit-scrollbar {
    width: 4px;
}

.queue-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 2px;
}

.queue-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
}

.queue-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.queue-item {
    margin-bottom: 8px;
    background: white;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.queue-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.queue-item .remove-queue-btn {
    background: none;
    border: none;
    color: #ff4444;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 0.9em;
    opacity: 0.7;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.queue-item .remove-queue-btn:hover {
    opacity: 1;
}

.queue-item .remove-queue-btn i {
    font-size: 0.9em;
}

.queue-number {
    background: white;
    color: black;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
}

.queue-players {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.team-a, .team-b {
    display: flex;
    align-items: center;
    gap: 8px;
}

.vs {
    color: #666;
    font-size: 0.9em;
    margin: 4px 0;
    font-style: italic;
}

.team-balance {
    font-size: 0.85em;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
}

.team-balance.balanced {
    background: rgba(52, 199, 89, 0.1);
    color: #34C759;
}

.team-balance.unbalanced {
    background: rgba(255, 149, 0, 0.1);
    color: #FF9500;
}

.queue-item .player {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.02);
    padding: 4px 8px;
    border-radius: 4px;
}

.queue-item.incomplete .player {
    opacity: 0.8;
}

.queue-item .waiting-text {
    color: #666;
    font-style: italic;
    font-size: 0.9em;
    margin-top: 4px;
}

.estimated-time {
    color: #666;
    font-size: 0.8em;
}

.court-2d:hover {
    transform: none;
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.12),
        inset 0 2px 4px rgba(255, 255, 255, 0.25);
    cursor: default;
    transition: none;
}

/* Update empty state styles */
.court-2d.empty {
    opacity: 1;
}

/* Remove empty team info styles since we're not showing them */
.team-info.empty {
    display: none;
}

/* Keep other empty state styles the same */
.queue-preview.empty {
    background: rgba(255, 255, 255, 0.9);
    min-height: 80px;
}

.quick-add-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    width: 100%;
    text-align: center;
    padding: 0 var(--spacing-lg);
    transition: all 0.3s ease;
}

.quick-add-btn {
    width: 100%;
    height: 40px;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.04);
    color: #333;
    border: none;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-bottom: var(--spacing-sm);
}

.quick-add-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

.quick-add-btn i {
    font-size: 1.2em;
}

/* Add mobile tab styles */
.mobile-tabs {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: var(--spacing-sm);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: var(--spacing-sm);
    background: none;
    border: none;
    color: #8E8E93;
    font-size: 0.8em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn i {
    font-size: 1.4em;
}

.tab-btn.active {
    color: var(--primary-color);
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.mobile-players-content {
    padding: var(--spacing-md);
    background: white;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Important for nested flex scrolling */
}

/* Update mobile styles */
@media (max-width: 768px) {
    /* Mobile tabs */
    .mobile-tabs {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: white;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        z-index: 100;
        height: 60px;
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .tab-btn {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 10px;
        background: none;
        border: none;
        color: #8E8E93;
        font-size: 12px;
        cursor: pointer;
    }
    
    .tab-btn i {
        font-size: 20px;
        margin-bottom: 4px;
    }
    
    .tab-btn.active {
        color: var(--primary-color);
    }
    
    /* Views */
    .view {
        display: none;
        height: calc(100vh - 60px); /* Account for tab bar */
        overflow-y: auto;
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .view.active {
        display: block;
    }
    
    /* Hide sidebar on mobile in courts view */
    #courts-view .sidebar {
        display: none;
    }
    
    /* Courts view layout */
    #courts-view .container {
        display: flex;
        flex-direction: column;
        height: 100%;
    }
    
    #courts-view .main-content {
        flex: 1;
        width: 100%;
        padding: 10px;
    }
    
    /* Courts container */
    .courts-container {
        width: 100%;
        padding: 0;
        margin: 0;
        max-width: 100%;
        grid-template-columns: 100%; /* Full width single column */
        display: grid;
        gap: 15px;
    }
    
    /* Players view */
    .mobile-players-content {
        display: flex;
        flex-direction: column;
        height: calc(100vh - 60px); /* Account for tab bar */
        padding: var(--spacing-md);
        padding-bottom: calc(80px + env(safe-area-inset-bottom));
        overflow-y: auto;
    }
    
    .mobile-players-list {
        flex: 1;
        overflow-y: auto;
        padding-bottom: 20px;
        margin-top: 15px;
    }
    
    .mobile-players-list-controls {
        position: relative;
        z-index: 10;
        background-color: white;
        padding-bottom: 10px;
        margin-bottom: 10px;
    }
    
    .filter-sort-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .status-filters {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 10px;
    }
    
    .sort-options {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    /* Queue view */
    .container .global-queue-container {
        display: none; /* Hide desktop queue on mobile */
    }
    
    .mobile-queue-content .global-queue-container {
        display: block; /* Show mobile queue in queue tab */
        width: 100%;
        padding: 10px;
    }
    
    .global-queue-section {
        width: 100%;
    }
}

/* Add safe area padding for iOS devices */
@supports (padding: env(safe-area-inset-bottom)) {
    .mobile-players-content {
        padding-bottom: calc(60px + env(safe-area-inset-bottom));
    }

    .mobile-tabs {
        padding-bottom: calc(var(--spacing-sm) + env(safe-area-inset-bottom));
    }
}

/* Add iPhone SE / smaller device optimization */
@media (max-width: 768px) and (max-height: 667px) {
    .court-2d {
        aspect-ratio: 6.1/9; /* Even shorter for small devices */
        max-height: calc(100vh - 160px);
    }
}

/* Update court gradient overlay for softer effect */
.court-2d::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
    opacity: 0.1;
    pointer-events: none;
}

/* Ensure court lines are visible on all backgrounds */
.court-lines {
    border-color: rgba(255, 255, 255, 0.95);
}

.doubles-sideline {
    background: rgba(255, 255, 255, 0.85);
}

.service-court {
    border-color: rgba(255, 255, 255, 0.75);
}

/* Modal Base Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

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

.modal-content {
    max-width: 480px;
    width: 90%;
    max-height: 85vh;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #000;
}

.modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Important for nested flex scrolling */
    padding: 20px;
    gap: var(--spacing-md);
}

.players-section {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0; /* Important for nested flex scrolling */
}

/* Update search container position */
.search-container {
    flex-shrink: 0;
    margin-bottom: var(--spacing-md);
}

/* Update section header position */
.section-header {
    flex-shrink: 0;
    margin-bottom: var(--spacing-md);
}

/* Update players grid position */
.players-grid {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px; /* Space for scrollbar */
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Search Input */
.player-search-input {
    width: 100%;
    height: 40px;
    padding: 0 16px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    font-size: 15px;
    background: #F5F5F7;
}

.player-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
}

/* Selected Count */
.selected-count {
    flex-shrink: 0;
    margin-top: 0;
}

/* Modal Footer */
.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-btn {
    height: 40px;
    min-width: 100px;
    padding: var(--spacing-sm) var(--spacing-md);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.modal-btn.secondary {
    background: rgba(0, 0, 0, 0.04);
    color: #666;
}

.modal-btn.secondary:hover {
    background: rgba(0, 0, 0, 0.06);
}

.modal-btn.primary {
    background: var(--primary-color);
    color: white;
}

.modal-btn.primary:hover {
    opacity: 0.9;
}

/* Updated player chip styling */
.players-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.player-chip {
    padding: 16px;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.player-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.player-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.player-name {
    font-size: 15px;
    font-weight: 500;
    color: #000;
}

.player-stats {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* Style stat chips */
.player-stats > span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    background: rgba(0, 0, 0, 0.05);
    color: #666;
}

.player-stats .games-played {
    background: rgba(255, 215, 0, 0.1);
    color: #B8860B;
}

.player-stats .last-game-time {
    background: rgba(0, 122, 255, 0.1);
    color: var(--primary-color);
}

.player-stats .player-current-status {
    background: rgba(88, 86, 214, 0.1);
    color: var(--status-resting);
}

.player-stats i {
    font-size: 11px;
}

.selection-indicator {
    font-size: 13px;
    font-weight: 500;
    color: #666;
    padding: 6px 12px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.player-chip.selected .selection-indicator {
    background: rgba(52, 199, 89, 0.1);
    color: var(--status-playing);
}

.player-chip.selected {
    border-color: var(--status-playing);
}

/* Update disabled state */
.player-chip.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f5f5f7;
}

/* Queue Modal specific overrides */
.queue-modal .player-chip.selected {
    border-color: var(--primary-color);
}

.queue-modal .player-chip.selected .selection-indicator {
    background: rgba(0, 122, 255, 0.1);
    color: var(--primary-color);
}

/* Add transition styles */
.court-2d .team-section {
    transition: all 0.3s ease;
}

.court-2d.empty .team-section {
    opacity: 0;
}

.court-2d.active .team-section {
    opacity: 1;
}

.quick-add-container {
    transition: opacity 0.3s ease;
}

.court-2d.active .quick-add-container {
    opacity: 1;
    pointer-events: auto;
}

/* Add danger button style */
.danger-button {
    background: rgba(255, 59, 48, 0.1);
    color: var(--status-waiting);
    border: none;
    height: 40px;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    transition: background-color 0.2s ease;
    margin-bottom: var(--spacing-sm);
    min-width: 100px;
}

.danger-button:hover {
    background: rgba(255, 59, 48, 0.15);
}

.danger-button i {
    opacity: 0.8;
}

/* Update start game button style */
.start-game-btn {
    background: rgba(52, 199, 89, 0.1) !important;
    color: var(--status-playing) !important;
    border: none;
    font-size: 0.9em;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 12px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: none;
    width: 100%;
    margin-bottom: 10px;
    max-width: none;
    height: 40px;
}

.start-game-btn:hover {
    background: rgba(52, 199, 89, 0.15) !important;
}

.start-game-btn i {
    color: var(--status-playing) !important;
}

/* Add any missing component-specific styles */
.court-2d.ready .status-dot {
    background: var(--status-queued);
}

.court-2d.in_progress .status-dot {
    background: var(--status-playing);
}

/* Add transition for status changes */
.court-2d {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.team-section {
    transition: opacity 0.3s ease;
}

/* Toast Container */
.toast-container {
    position: fixed;
    top: calc(env(safe-area-inset-top) + 16px);
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

/* Toast Notification */
.toast {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateX(100%);
    animation: toast-slide-in 0.3s ease forwards;
    position: relative;
    overflow: hidden;
    min-width: 200px;
    max-width: 400px;
    pointer-events: auto;
}

/* Toast Types */
.toast-success {
    background: rgba(52, 199, 89, 0.9);
}

.toast-error {
    background: rgba(255, 59, 48, 0.9);
}

.toast-warning {
    background: rgba(255, 149, 0, 0.9);
}

.toast-info {
    background: rgba(0, 122, 255, 0.9);
}

/* Toast Count Badge */
.toast-count {
    margin-left: 6px;
    font-size: 0.9em;
    opacity: 0.8;
}

/* Toast Progress Bar */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    transform-origin: left;
}

/* Toast Animations */
@keyframes toast-slide-in {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toast-progress {
    from {
        transform: scaleX(1);
    }
    to {
        transform: scaleX(0);
    }
}

.toast-fade-out {
    animation: toast-fade-out 0.3s ease forwards;
}

@keyframes toast-fade-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Adjust for mobile */
@media (max-width: 768px) {
    .toast-container {
        left: 16px;
        right: 16px;
    }
    
    .toast {
        width: 100%;
        max-width: none;
    }
}

/* Add queue button styles */
.queue-action-container {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
}

/* Update queue button styles */
.add-to-queue-btn {
    height: 40px !important; /* Force height with !important to override any conflicts */
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.04);
    border: none;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.add-to-queue-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

/* Update court actions layout */
.court-actions {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    
}

/* Add margin to complete game button */
.complete-game-btn {
    background: rgba(52, 199, 89, 0.1) !important;
    color: var(--status-playing) !important;
    border: none;
    margin-bottom: 5px;
}

/* Consistent button styles */
.court-button {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 8px;
    border: none;
    background: rgba(0, 0, 0, 0.04);
    color: #333;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-bottom: var(--spacing-sm);
}

.court-button:hover {
    background: rgba(0, 0, 0, 0.06);
}

.court-button i {
    color: #666;
    font-size: 14px;
}

/* Queue section */
.queue-section {
    margin-top: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
}

.queue-header {
    font-size: 0.75em;
    color: #666;
    margin-bottom: 4px;
}

.queue-list {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 4px;
}

.queue-list::-webkit-scrollbar {
    width: 4px;
}

.queue-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 2px;
}

.queue-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
}

.queue-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.queue-item {
    margin-bottom: 8px;
    background: white;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.queue-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.queue-match {
    display: flex;
    align-items: center;
    padding: 4px var(--spacing-sm);
    background: rgba(255, 255, 255, 0.8);
    border-radius: 6px;
    font-size: 0.8em;
    color: #333;
}

.match-number {
    background: rgba(0, 0, 0, 0.1);
    color: #666;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75em;
    margin-right: 4px;
}

/* Remove colored team indicators in queue */
.queue-match .team-a,
.queue-match .team-b {
    color: #333;
    font-weight: 500;
}

.queue-match .vs {
    color: #999;
    font-size: 0.9em;
    padding: 0 4px;
}

/* Update action buttons for monochromatic look */
.court-button,
.add-to-queue-btn,
.complete-game-btn {
    background: rgba(0, 0, 0, 0.04);
    color: #333;
    border: none;
    height: 40px;
    font-size: 0.9em;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 12px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.court-button:hover,
.add-to-queue-btn:hover,
.complete-game-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

.court-button i,
.add-to-queue-btn i,
.complete-game-btn i {
    color: #666;
}

/* Update remaining matches indicator */
.queue-match.remaining {
    justify-content: center;
    color: #666;
    background: rgba(0, 0, 0, 0.02);
    font-size: 0.75em;
}

/* Queue Modal Team Styles */
.queue-modal .team-selection {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.team-indicator {
    font-size: 0.8em;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: auto;
}

.player-chip.team-a {
    background: rgba(52, 199, 89, 0.1);
    border: 1px solid rgba(52, 199, 89, 0.2);
}

.player-chip.team-b {
    background: rgba(0, 122, 255, 0.1);
    border: 1px solid rgba(0, 122, 255, 0.2);
}

.player-chip.team-a .team-indicator {
    background: var(--status-playing);
    color: white;
}

.player-chip.team-b .team-indicator {
    background: var(--primary-color);
    color: white;
}

.matchup-preview {
    text-align: center;
    padding: var(--spacing-md);
    margin: var(--spacing-md) 0;
    border-radius: 12px;
    font-size: 0.9em;
    color: #666;
}

.matchup-preview.ready {
    background: rgba(52, 199, 89, 0.1);
    color: var(--status-playing);
    font-weight: 500;
}

/* Queue display in court */
.queue-match {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
    font-size: 0.9em;
}

.queue-match .vs {
    color: #666;
    font-weight: 500;
    padding: 0 var(--spacing-sm);
}

/* Secondary button style */
.secondary-button {
    background: rgba(0, 0, 0, 0.04);
    color: #333;
    border: none;
    height: 40px;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    transition: background-color 0.2s ease;
    margin-bottom: var(--spacing-sm);
    min-width: 100px;
}

.secondary-button:hover {
    background: rgba(0, 0, 0, 0.06);
}

.secondary-button i {
    opacity: 0.7;
}

/* Update status colors */
.court-2d.in_progress .court-status {
    color: var(--status-playing);
}

.court-2d.ready .court-status {
    color: var(--status-queued);
}

.court-2d.empty .court-status {
    color: var(--status-nogames);
}

/* Update complete game button style */
.complete-game-btn {
    background: rgba(52, 199, 89, 0.1) !important;
    color: var(--status-playing) !important;
    border: none;
}

.complete-game-btn:hover {
    background: rgba(52, 199, 89, 0.15) !important;
}

.complete-game-btn i {
    color: var(--status-playing) !important;
}

/* Hide the button in empty courts */
.court-2d.empty .complete-game-btn {
    display: none;
}

/* Search input styling */
.search-container {
    margin-bottom: var(--spacing-md);
}

.player-search-input {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    font-size: 1em;
    background: #F5F5F7;
    transition: all 0.2s ease;
}

.player-search-input:focus {
    outline: none;
    background: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.1);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.empty-state p {
    font-size: 15px;
    font-weight: 500;
    margin: 8px 0;
}

.empty-state span {
    font-size: 13px;
    opacity: 0.8;
}

/* Add section for sort buttons */
.sort-options {
    display: flex;
    gap: 8px;
    margin-bottom: var(--spacing-md);
}

.sort-btn {
    padding: 6px 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    background: white;
    color: #666;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sort-btn:hover {
    background: #F5F5F7;
}

.sort-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Update section header styling */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-md);
}

.section-header h4 {
    font-size: 15px;
    font-weight: 600;
    color: #000;
}

/* Update selected count styling */
.selected-count {
    margin-top: var(--spacing-md);
    padding: 12px;
    background: #F5F5F7;
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    transition: all 0.2s ease;
}

.selected-count.full {
    background: rgba(52, 199, 89, 0.1);
    color: var(--status-playing);
}

/* Update player chip styling */
.player-chip {
    padding: 16px;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.player-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.player-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.player-name {
    font-size: 15px;
    font-weight: 500;
    color: #000;
}

.player-stats {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* Style stat chips */
.player-stats > span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    background: rgba(0, 0, 0, 0.05);
    color: #666;
}

.player-stats .games-played {
    background: rgba(255, 215, 0, 0.1);
    color: #B8860B;
}

.player-stats .last-game-time {
    background: rgba(0, 122, 255, 0.1);
    color: var(--primary-color);
}

.player-stats .player-current-status {
    background: rgba(88, 86, 214, 0.1);
    color: var(--status-resting);
}

.player-stats i {
    font-size: 11px;
}

.selection-indicator {
    font-size: 13px;
    font-weight: 500;
    color: #666;
    padding: 6px 12px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.player-chip.selected .selection-indicator {
    background: rgba(52, 199, 89, 0.1);
    color: var(--status-playing);
}

.player-chip.selected {
    border-color: var(--status-playing);
}

/* Update disabled state */
.player-chip.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f5f5f7;
}

/* Queue Modal specific overrides */
.queue-modal .player-chip.selected {
    border-color: var(--primary-color);
}

.queue-modal .player-chip.selected .selection-indicator {
    background: rgba(0, 122, 255, 0.1);
    color: var(--primary-color);
}

/* Style scrollbar */
.players-grid::-webkit-scrollbar {
    width: 8px;
}

.players-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.players-grid::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.players-grid::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Update player chip team styling */
.player-chip.selected.team-a {
    background: rgba(52, 199, 89, 0.1);
    border-color: var(--status-playing);
}

.player-chip.selected.team-b {
    background: rgba(0, 122, 255, 0.1);
    border-color: var(--primary-color);
}

.player-chip.selected.team-a .selection-indicator {
    color: var(--status-playing);
}

.player-chip.selected.team-b .selection-indicator {
    color: var(--primary-color);
}

/* Update selected count team colors */
.team-count.team-a {
    background: rgba(52, 199, 89, 0.1);
    color: var(--status-playing);
}

.team-count.team-b {
    background: rgba(0, 122, 255, 0.1);
    color: var(--primary-color);
}

/* Add team indicators */
.team-indicator {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 8px;
}

.team-a .team-indicator {
    background: rgba(52, 199, 89, 0.1);
    color: var(--status-playing);
}

.team-b .team-indicator {
    background: rgba(0, 122, 255, 0.1);
    color: var(--primary-color);
}

/* Update selected count to show teams */
.selected-count.has-teams {
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
}

.team-count {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 13px;
}

.team-count.team-a {
    background: rgba(52, 199, 89, 0.1);
    color: var(--status-playing);
}

.team-count.team-b {
    background: rgba(0, 122, 255, 0.1);
    color: var(--primary-color);
}

/* Queue Modal specific styles */
.queue-modal .player-chip.selected {
    background: rgba(0, 122, 255, 0.05);
    border-color: var(--primary-color);
}

.queue-modal .player-chip.selected .selection-indicator {
    color: var(--primary-color);
}

.queue-modal .selected-count {
    background: rgba(0, 122, 255, 0.05);
    color: var(--primary-color);
}

/* Update shuttlecock animation styles */
@keyframes flyAround {
    0% {
        transform: translate(20%, 20%) rotate(30deg) scale(2);
        animation-timing-function: ease-out;
        opacity: 0.9;
    }
    25% {
        transform: translate(70%, 30%) rotate(-45deg) scale(1.5);
        animation-timing-function: ease-in;
        opacity: 0.7;
    }
    50% {
        transform: translate(60%, 70%) rotate(60deg) scale(2);
        animation-timing-function: ease-out;
        opacity: 0.9;
    }
    75% {
        transform: translate(30%, 60%) rotate(-30deg) scale(1.5);
        animation-timing-function: ease-in;
        opacity: 0.7;
    }
    100% {
        transform: translate(20%, 20%) rotate(30deg) scale(2);
        animation-timing-function: ease-out;
        opacity: 0.9;
    }
}

/* Second shuttlecock with different physics */
@keyframes flyAroundAlt {
    0% {
        transform: translate(70%, 70%) rotate(-45deg) scale(2);
        animation-timing-function: ease-out;
        opacity: 0.9;
    }
    25% {
        transform: translate(30%, 40%) rotate(30deg) scale(1.5);
        animation-timing-function: ease-in;
        opacity: 0.7;
    }
    50% {
        transform: translate(20%, 20%) rotate(-60deg) scale(2);
        animation-timing-function: ease-out;
        opacity: 0.9;
    }
    75% {
        transform: translate(60%, 50%) rotate(45deg) scale(1.5);
        animation-timing-function: ease-in;
        opacity: 0.7;
    }
    100% {
        transform: translate(70%, 70%) rotate(-45deg) scale(2);
        animation-timing-function: ease-out;
        opacity: 0.9;
    }
}

.court-2d.in_progress::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='32' height='32' viewBox='0 0 32 32' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M16 4L19 10H13L16 4Z' fill='white' fill-opacity='0.9'/%3E%3Cpath d='M19 10C19 10 22 15 22 18C22 21 19 26 16 26C13 26 10 21 10 18C10 15 13 10 13 10H19Z' fill='white' fill-opacity='0.7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    pointer-events: none;
    animation: flyAround 6s infinite cubic-bezier(0.45, 0, 0.55, 1);
    z-index: 1;
}

.court-2d.in_progress::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='32' height='32' viewBox='0 0 32 32' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M16 4L19 10H13L16 4Z' fill='white' fill-opacity='0.9'/%3E%3Cpath d='M19 10C19 10 22 15 22 18C22 21 19 26 16 26C13 26 10 21 10 18C10 15 13 10 13 10H19Z' fill='white' fill-opacity='0.7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    pointer-events: none;
    animation: flyAroundAlt 7s infinite cubic-bezier(0.45, 0, 0.55, 1);
    z-index: 1;
}

/* Mobile Import Form Improvements */
#mobilePlayerImport {
    padding: var(--spacing-md);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    min-height: 120px; /* Taller for mobile */
    width: 100%;
    resize: vertical;
    background: white;
    margin-bottom: var(--spacing-md);
}

/* Mobile Import Section */
.mobile-players-content .import-section {
    padding: var(--spacing-md);
    margin: var(--spacing-md) 0;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

/* Mobile Button Container */
.mobile-players-content .import-section .button-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

/* Mobile Import Button */
#mobileImportButton {
    width: 100%;
    height: 48px; /* Taller touch target */
    padding: var(--spacing-md);
}

/* Mobile Reset Button */
#mobileResetButton {
    width: 100%;
    height: 48px; /* Taller touch target */
    padding: var(--spacing-md);
}

/* Improve touch targets for mobile */
@media (max-width: 768px) {
    .mobile-players-content {
        padding: var(--spacing-md);
        padding-bottom: calc(80px + env(safe-area-inset-bottom));
    }

    .mobile-players-content .import-section {
        margin-bottom: var(--spacing-lg);
    }

    /* Add some spacing between the header and import section */
    .mobile-players-content .sidebar-header {
        margin-bottom: var(--spacing-md);
    }
}

/* Add momentum scrolling for iOS devices */
@supports (-webkit-touch-callout: none) {
    .views-container,
    .courts-container,
    .mobile-players-content {
        -webkit-overflow-scrolling: touch;
    }
}

/* Add subtle parallax effect during scroll */
@media (max-width: 1024px) {
    .court-2d .court-lines {
        transition: transform 0.2s ease-out;
    }

    .courts-container:active .court-2d .court-lines {
        transform: scale(0.98);
    }
}

/* Fix horizontal scrolling on mobile */
@media (max-width: 768px) {
    /* Prevent horizontal overflow */
    body {
        overflow-x: hidden;
        width: 100%;
        position: relative;
    }

    /* Ensure views stay within viewport */
    .views-container {
        width: 100%;
        overflow-x: hidden;
    }

    .view {
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }

    /* Update courts container sizing */
    .courts-container {
        width: 100%;
        padding: 0;
        margin: 0;
        max-width: 100%;
        grid-template-columns: 100%; /* Full width single column */
    }

    /* Ensure court fits within viewport */
    .court-2d {
        width: 100%;
        max-width: 100%;
        margin: 0 0 var(--spacing-md) 0;
        border-radius: 24px; /* Keep the border radius */
    }

    /* Fix mobile players content width */
    .mobile-players-content {
        width: 100%;
        max-width: 100%;
        padding-left: var(--spacing-md);
        padding-right: var(--spacing-md);
        box-sizing: border-box;
    }

    /* Ensure import section stays within bounds */
    .import-section {
 
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Remove parallax effect on mobile */
    .courts-container:active .court-2d .court-lines {
        transform: none;
    }

    .court-2d .court-lines {
        transition: none;
    }

    /* Add bottom spacing for tab bar */
    .views-container {
        padding-bottom: calc(60px + env(safe-area-inset-bottom));
    }
}

/* Prevent zoom on mobile inputs */
#playerImport,
#mobilePlayerImport {
    font-size: 12px;
    max-height: 150px;
    touch-action: manipulation; /* Prevent double-tap zoom */
}

@media (max-width: 768px) {
    #playerImport,
    #mobilePlayerImport {
        font-size: 16px !important;
        -webkit-text-size-adjust: none; /* Change from 100% to none */
        touch-action: pan-x pan-y; /* Allow scrolling but prevent zoom */
    }
}

.offline-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    text-align: center;
    padding: var(--spacing-lg);
}

.offline-container button {
    margin-top: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: 8px;
    background: var(--primary-color);
    color: white;
    border: none;
    font-size: 16px;
    cursor: pointer;
}

.magic-queue-btn {
    background: linear-gradient(
        135deg,
        rgba(147, 51, 234, 0.1) 0%,
        rgba(79, 70, 229, 0.1) 100%
    );
    color: #6366F1;
    border: 1px solid rgba(99, 102, 241, 0.2);
    font-size: 0.9em;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 12px;
    height: 40px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    margin-bottom: var(--spacing-sm);
}

.magic-queue-btn:hover {
    transform: translateY(-1px);
    box-shadow: 
        0 4px 12px rgba(99, 102, 241, 0.15),
        0 2px 4px rgba(99, 102, 241, 0.1);
    background: linear-gradient(
        135deg,
        rgba(147, 51, 234, 0.15) 0%,
        rgba(79, 70, 229, 0.15) 100%
    );
}

.magic-queue-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

/* Add sparkle effect */
.magic-queue-btn::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(
        circle,
        rgba(255, 255, 255, 0.1) 0%,
        transparent 70%
    );
    transform: rotate(45deg);
    animation: sparkle 3s infinite linear;
    pointer-events: none;
}

@keyframes sparkle {
    from {
        transform: rotate(0deg) translate(-50%, -50%);
    }
    to {
        transform: rotate(360deg) translate(-50%, -50%);
    }
}

.magic-queue-btn i {
    color: #6366F1;
    font-size: 1.1em;
    animation: wiggle 2s infinite;
}

@keyframes wiggle {
    0%, 100% {
        transform: rotate(-5deg);
    }
    50% {
        transform: rotate(5deg);
    }
}

/* Add responsive adjustments */
@media (max-width: 768px) {
    .magic-queue-btn {
        height: 48px; /* Larger touch target on mobile */
        font-size: 1em;
    }
    
    .magic-queue-btn i {
        font-size: 1.2em;
    }
}

/* Add disabled state */
.magic-queue-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
    transform: none;
    box-shadow: none;
}

.magic-queue-btn:disabled i {
    animation: none;
    color: #666;
}

/* Add loading state */
.magic-queue-btn.loading {
    background: rgba(99, 102, 241, 0.1);
    cursor: wait;
}

.magic-queue-btn.loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Add these styles where other queue-related styles are */
.queue-item .remove-queue-btn {
    background: none;
    border: none;
    color: #ff4444;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 0.9em;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.queue-item .remove-queue-btn:hover {
    opacity: 1;
}

/* Update view container styles */
.views-container {
    position: relative;
    height: 100vh;
    overflow-x: hidden;
}

.view {
    display: none;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.view.active {
    display: block;
}

/* Ensure mobile players view takes full height */


/* Update mobile tab styles */
@media (max-width: 768px) {
    .mobile-tabs {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: white;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        z-index: 100;
        height: 60px;
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .tab-btn {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 10px;
        background: none;
        border: none;
        color: #8E8E93;
        font-size: 12px;
        cursor: pointer;
    }
    
    .tab-btn i {
        font-size: 20px;
        margin-bottom: 4px;
    }
    
    .tab-btn.active {
        color: var(--primary-color);
    }
    
    .view {
        display: none;
        height: calc(100vh - 60px); /* Account for tab bar */
        overflow-y: auto;
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .view.active {
        display: block;
    }
}

/* Add these styles for the sidebar toggle */
.sidebar-toggle-btn {
    position: absolute;
    left: var(--sidebar-width);
    top: 50%;
    transform: translateY(-50%);
    background: white;
    border: 1px solid #E5E5EA;
    border-left: none;
    height: 40px;
    width: 20px;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8E8E93;
    z-index: 100;
    transition: all 0.3s ease;
}

.sidebar-toggle-btn:hover {
    background: #f5f5f7;
    color: var(--primary-color);
}

/* Add transition to sidebar */
.sidebar {
    transition: transform 0.3s ease, width 0.3s ease;
}

/* Collapsed state styles */
.container.sidebar-collapsed .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-width)));
    width: 0;
}

.container.sidebar-collapsed .sidebar-toggle-btn {
    left: 0;
}

/* Hide toggle button on mobile */
@media (max-width: 768px) {
    .sidebar-toggle-btn {
        display: none;
    }
}

/* Ensure main content adjusts when sidebar is collapsed */
.main-content {
    transition: margin-left 0.3s ease;
}

.container.sidebar-collapsed .main-content {
    margin-left: 0;
}

/* Add to your existing CSS */
.level-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: 12px;
    flex-wrap: nowrap; /* Prevent wrapping */
}

.player-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap; /* Allow wrapping for small screens */
    min-width: 0; /* Enable flex item shrinking */
}

.skill-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
    min-width: 48px;
    justify-content: center;
    white-space: nowrap;
    flex-shrink: 0; /* Prevent badge from shrinking */
}

.skill-badge.level-1 { background: #E1E1E1; color: #666; }    /* Beginner */
.skill-badge.level-2 { background: #FFECB3; color: #FF6F00; } /* Novice */
.skill-badge.level-3 { background: #C8E6C9; color: #2E7D32; } /* Casual */
.skill-badge.level-4 { background: #B3E5FC; color: #0277BD; } /* Regular */
.skill-badge.level-5 { background: #BBDEFB; color: #1565C0; } /* Intermediate */
.skill-badge.level-6 { background: #D1C4E9; color: #4527A0; } /* Competitive */
.skill-badge.level-7 { background: #E1BEE7; color: #6A1B9A; } /* Advanced */
.skill-badge.level-8 { background: #FFCDD2; color: #C62828; } /* Club Pro */
.skill-badge.level-9 { background: #FFE0B2; color: #E65100; } /* Elite */
.skill-badge.level-10 { background: #B2EBF2; color: #006064; border: 1px solid #00BCD4; } /* All-Star */

.level-buttons {
    display: flex;
    gap: 4px;
}

.level-btn {
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.05);
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: all 0.2s ease;
}



.level-btn:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
}

.level-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Add hover tooltip for skill level names */
.skill-badge:hover::after {
    content: attr(title);
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    transform: translateY(24px);
}

/* Empty state styling */
.empty-state {
    padding: var(--spacing-lg);
    text-align: center;
    color: #8E8E93;
    background: rgba(142, 142, 147, 0.05);
    border-radius: 12px;
    
}

.empty-state-icon {
    position: relative;
    display: inline-block;
    margin-bottom: var(--spacing-md);
}

.empty-state-icon .fa-users {
    font-size: 2.5em;
    color: #C7C7CC;
}

.empty-state-plus {
    position: absolute;
    bottom: -5px;
    right: -10px;
    font-size: 1em;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    padding: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.empty-state-title {
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    color: #3A3A3C;
}

.empty-state-text {
    font-size: 0.9em;
    line-height: 1.4;
    margin-bottom: var(--spacing-md);
}

.empty-state-list {
    list-style: none;
    padding: 0;
    margin: var(--spacing-md) 0 0;
    text-align: left;
}

.empty-state-list li {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
    color: #636366;
}

.empty-state-list i {
    color: var(--primary-color);
    width: 16px;
    text-align: center;
}

/* Add styles for court player skill badges */
.court-player {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: white;
    border-radius: 8px;
    margin-bottom: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.court-player .player-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.court-player .skill-badge {
    font-size: 0.75em;
    padding: 2px 6px;
    min-width: auto;
}

.court-player .player-name {
    font-weight: 500;
    color: #333;
}

/* Make the remove button more subtle */
.court-player .remove-player {
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.court-player .remove-player:hover {
    opacity: 1;
}

.pull-refresh-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--background-color);
    transform: translateY(-100%);
    transition: transform 0.2s ease-out;
    z-index: 1000;
    gap: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pull-refresh-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--primary-color);
}

.pull-refresh-text {
    color: var(--text-color);
    font-size: 14px;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Add these styles to ensure consistent mobile display */
.mobile-players-list {
    padding: var(--spacing-md);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-height: 0; /* Important for nested flex scrolling */
}

/* Ensure player items look consistent on mobile */
.mobile-players-list .player-item {
    margin-bottom: var(--spacing-sm);
    padding: var(--spacing-md);
    background: white;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Adjust spacing for mobile view */
@media (max-width: 768px) {
    .mobile-players-content {
        display: flex;
        flex-direction: column;
        height: 100%;
        overflow-y: auto; /* Make entire content scrollable */
        -webkit-overflow-scrolling: touch;
        padding-bottom: calc(60px + env(safe-area-inset-bottom));
    }

    /* Remove fixed positioning styles from import section */
    .mobile-players-content .import-section {
        flex-shrink: 0; /* Prevent shrinking */
        margin: var(--spacing-md);
        margin-bottom: var(--spacing-md);
        background: white; /* Make it stand out from the list */
        border: 1px solid rgba(0, 0, 0, 0.05);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }

    /* Update mobile players list to not be independently scrollable */
    .mobile-players-list {
        flex: none; /* Remove flex growing */
        padding: var(--spacing-md);
        padding-top: 0; /* Remove top padding since import section has margin */
    }

    /* Ensure proper spacing between items */
    .mobile-players-list .player-item:first-child {
        margin-top: 0;
    }

    /* Optimize touch targets */
    .mobile-players-list .player-item {
        margin-bottom: var(--spacing-md);
    }

    /* Make buttons more touch-friendly */
    .button-container {
        gap: var(--spacing-sm);
    }

    .secondary-button,
    .danger-button {
        height: 44px; /* Slightly taller for better touch targets */
    }
}

/* Update import section styles */
.import-section {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-md);
    background: rgba(0, 0, 0, 0.02);
    border-radius: 12px;
}

/* Add button container */
.button-container {
    display: flex;
    gap: var(--spacing-md);
}

/* Update button styles */
.secondary-button,
.danger-button {
    flex: 1;
    height: 40px;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 8px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    transition: opacity 0.2s;
    border: none;
}

.secondary-button {
    background-color: var(--primary-color);
    color: white;
}

.danger-button {
    background-color: #FF3B30;
    color: white;
}

.secondary-button:hover,
.danger-button:hover {
    opacity: 0.9;
}

/* Mobile specific adjustments */
@media (max-width: 768px) {
    .button-container {
        gap: var(--spacing-sm); /* Slightly smaller gap on mobile */
    }
}

/* Sidebar drag handle */
.sidebar-drag-handle {
    position: absolute;
    top: 0;
    right: -8px;
    width: 16px;
    height: 100%;
    cursor: col-resize;
    z-index: 1000; /* Ensure it's above everything */
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    touch-action: none; /* Prevent scrolling while dragging on touch devices */
}

/* Visual indicator for the drag handle */
.drag-handle-line {
    width: 4px;
    height: 100%;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
    transition: background-color 0.2s;
}

.sidebar-drag-handle:hover .drag-handle-line {
    background: rgba(0, 0, 0, 0.2);
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.05);
}

.sidebar-dragging .drag-handle-line {
    background: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

/* Prevent text selection while dragging */
.sidebar-dragging {
    user-select: none !important;
    cursor: col-resize !important;
}

.sidebar-dragging * {
    user-select: none !important;
    pointer-events: none;
}

/* Update sidebar styles */
.sidebar {
    position: relative;
    min-width: 200px;
    max-width: 600px;
    width: 300px;
    transition: width 0.2s ease;
    z-index: 100;
    will-change: width;
}

/* When dragging, disable transitions */
.sidebar-dragging .sidebar {
    transition: none;
}

/* Add responsive adjustments for very small screens */
@media (max-width: 400px) {
    .player-item {
        flex-direction: column;
        align-items: stretch;
    }

    .player-statuses {
        justify-content: flex-start;
        margin-top: var(--spacing-sm);
    }
}

/* Update sidebar styles for collapse animation */
.sidebar {
    position: relative;
    min-width: 0; /* Allow complete collapse */
    max-width: 600px;
    width: 300px;
    transition: width 0.2s ease;
    z-index: 100;
    will-change: width;
}

/* Handle collapsed state */
.container.sidebar-collapsed .sidebar {
    width: 0 !important;
    min-width: 0;
    padding: 0;
    border: none;
}

/* Adjust toggle button position */
.sidebar-toggle-btn {
    position: absolute;
    left: 100%;
    top: 20px;
    z-index: 101;
    background: white;
    border: 1px solid #E5E5EA;
    border-left: none;
    padding: 8px;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.container.sidebar-collapsed .sidebar-toggle-btn {
    transform: translateX(-100%);
}

/* Hide drag handle when collapsed */
.container.sidebar-collapsed .sidebar-drag-handle {
    display: none;
}

.credit-line {
    font-size: 0.8em;
    color: #8E8E93;
    margin-top: 4px;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.credit-line a {
    color: var(--primary-color);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.credit-line a:hover {
    opacity: 0.8;
}

.action-btn {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.add-players-btn {
    width: 100%;
    max-width: 300px;
    padding: 12px;
    font-size: 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.add-players-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.15);
    background: #0066FF;
}

.add-players-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.add-players-btn i {
    font-size: 1.1em;
}

/* Empty state court actions */
.court-actions.empty-state {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.queue-item.incomplete {
    opacity: 0.8;
    background: rgba(0, 0, 0, 0.02);
}

.queue-item .waiting-text {
    color: #666;
    font-style: italic;
    font-size: 0.9em;
}

.court-bottom {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 0 0 8px 8px;
}

.queue-container {
    width: 100%;
}

.queue-section {
    width: 100%;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.queue-header {
    padding: 0.75rem 1rem;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #eee;
}

.queue-list {
    padding: 0.5rem;
}

.queue-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    margin: 0.5rem 0;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.queue-item.incomplete {
    opacity: 0.8;
    background: rgba(0, 0, 0, 0.02);
}

.queue-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.queue-number {
    font-weight: 600;
    color: #666;
    min-width: 24px;
}

.queue-players {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.team-a, .team-b {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.vs {
    color: #666;
    font-weight: 500;
    margin: 0 0.5rem;
}

.waiting-text {
    color: #666;
    font-style: italic;
    font-size: 0.9em;
}

.team-balance {
    font-size: 0.9em;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.team-balance.balanced {
    background: #d4edda;
    color: #155724;
}

.team-balance.unbalanced {
    background: #f8d7da;
    color: #721c24;
}

/* Global Queue Styles */
.global-queue-container {
    width: 300px;
    background-color: #f8f9fa;
    border-left: 1px solid #e9ecef;
    padding: 20px;
    height: 100vh;
    overflow-y: auto;
    position: sticky;
    top: 0;
    display: block;
    z-index: 10;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.05);
}

.global-queue-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.global-queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
}

.global-queue-header h2 {
    font-size: 1.5rem;
    margin: 0;
    color: #343a40;
    font-weight: 600;
}

.queue-stats {
    display: flex;
    gap: 8px;
}

.queue-count {
    background-color: #e9ecef;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.85rem;
    color: #495057;
    font-weight: 500;
}

.ready-count {
    background-color: #d4edda;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.85rem;
    color: #155724;
    font-weight: 500;
}

.global-queue-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.queue-item {
    background-color: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
    margin-bottom: 15px;
    border: 1px solid #e9ecef;
}

.queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.court-badge {
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    background-color: #6c757d;
    padding: 3px 8px;
    border-radius: 12px;
    text-transform: uppercase;
}

.court-1 { background-color: #20c997; }
.court-2 { background-color: #fd7e14; }
.court-3 { background-color: #e83e8c; }
.court-4 { background-color: #6f42c1; }
.court-5 { background-color: #0d6efd; }

.queue-actions {
    display: flex;
    gap: 5px;
}

.remove-queue-btn {
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 0.8rem;
}

.remove-queue-btn:hover {
    background-color: #c82333;
}

.assign-court-btn {
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 0.8rem;
}

.assign-court-btn:hover {
    background-color: #218838;
}

.queue-content {
    background-color: white;
    border-radius: 8px;
    padding: 12px;
}

.queue-players {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.team {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.team-a {
    border-left: 3px solid #20c997;
    padding-left: 8px;
}

.team-b {
    border-left: 3px solid #fd7e14;
    padding-left: 8px;
}

.vs {
    text-align: center;
    font-weight: bold;
    color: #6c757d;
    margin: 5px 0;
    font-size: 0.9rem;
}

.queued-player {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
}

.waiting-text {
    color: #6c757d;
    font-style: italic;
    text-align: center;
    margin: 10px 0;
}

.team-balance {
    display: block;
    text-align: center;
    font-size: 0.8rem;
    padding: 4px;
    margin-top: 8px;
    border-radius: 4px;
}

.team-balance.balanced {
    background-color: #d4edda;
    color: #155724;
}

.team-balance.unbalanced {
    background-color: #f8d7da;
    color: #721c24;
}

.empty-queue {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    text-align: center;
}

.empty-queue i {
    font-size: 2rem;
    color: #dee2e6;
    margin-bottom: 15px;
}

.empty-queue p {
    margin: 0 0 5px 0;
    font-weight: 600;
    color: #495057;
}

.empty-queue span {
    font-size: 0.9rem;
    color: #6c757d;
}

/* Responsive layout adjustments for global queue */
@media (max-width: 1200px) {
    .container {
        grid-template-columns: 250px 1fr 250px;
    }
}

@media (max-width: 992px) {
    .container {
        grid-template-columns: 220px 1fr 220px;
    }
    .global-queue-container {
        width: 220px;
    }
}

@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
        display: flex;
        flex-direction: column;
    }
    
    .global-queue-container {
        width: 100%;
        height: auto;
        max-height: 50vh;
        border-left: none;
        border-top: 1px solid #e9ecef;
        order: 3; /* Make it appear after the courts */
        position: relative;
    }
}

/* Empty state styles */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    color: #666;
}

.empty-state-icon {
    position: relative;
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #ccc;
}

.empty-state-icon .fa-users {
    font-size: 3rem;
}

.empty-state-plus {
    position: absolute;
    bottom: -5px;
    right: -10px;
    font-size: 1rem;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-state-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #333;
}

.empty-state-text {
    margin-bottom: 1rem;
}

.empty-state-list {
    text-align: left;
    margin-top: 0.5rem;
}

.empty-state-list li {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.empty-state-list i {
    color: #4CAF50;
    width: 20px;
    text-align: center;
}

.import-tab-btn {
    margin-top: 1.5rem;
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s ease;
}

.import-tab-btn:hover {
    background-color: #0062cc; /* Darker shade of the primary blue */
}

.import-tab-btn i {
    font-size: 1.1em;
}

/* Tab Styles */
.sidebar-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 15px;
}

.sidebar-tab {
    flex: 1;
    padding: 10px;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
    color: #666;
    transition: all 0.3s ease;
}

.sidebar-tab:hover {
    color: #333;
}

.sidebar-tab.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

/* Empty state styles */
.empty-state-icon {
    position: relative;
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #ccc;
}

.empty-state-plus {
    position: absolute;
    bottom: -5px;
    right: -10px;
    font-size: 1rem;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-state-list i {
    color: var(--primary-color);
    width: 20px;
    text-align: center;
}

.empty-state-list i {
    color: var(--primary-color);
    width: 20px;
    text-align: center;
}

/* Player List Filter and Sort Controls */
.players-list-controls,
.mobile-players-list-controls {
    margin-bottom: 15px;
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.search-container {
    margin-bottom: 10px;
}

.player-search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.filter-sort-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.status-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 5px;
}

.status-filter-btn {
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.status-filter-btn.active {
    background-color: #0E6F67;
    color: white;
    border-color: #0E6F67;
}

.count-badge {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    padding: 2px 6px;
    margin-left: 5px;
    font-size: 11px;
    min-width: 20px;
    text-align: center;
}

.status-filter-btn.active .count-badge {
    background-color: rgba(255, 255, 255, 0.2);
}

.sort-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.sort-btn {
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.sort-btn.active {
    background-color: #0E6F67;
    color: white;
    border-color: #0E6F67;
}

.sort-btn i {
    font-size: 10px;
}

.sort-btn.desc i.fa-sort-alpha-down {
    transform: rotate(180deg);
}

.clear-filters-btn {
    background-color: #f44336;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 15px;
    font-size: 14px;
    cursor: pointer;
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
    justify-content: center;
    width: 100%;
}

/* Mobile-specific styles */
@media (max-width: 768px) {
    .mobile-players-list-controls {
        margin: 0 10px 15px;
    }
    
    .status-filters,
    .sort-options {
        justify-content: center;
    }
}

/* Hide players tab content when import tab is active */
.sidebar-tab[data-tab="import-tab"].active ~ .tab-content #players-tab,
.sidebar-tab[data-tab="mobile-import-tab"].active ~ .tab-content #mobile-players-tab {
    display: none !important;
}

.sidebar {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.mobile-queue-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: var(--spacing-md);
    overflow-y: auto;
    background-color: white;
}

.mobile-queue-content .sidebar-header {
    margin-bottom: var(--spacing-md);
}

.mobile-queue-content .global-queue-container {
    width: 100%;
    height: auto;
    max-height: none;
    border-left: none;
    border-top: none;
    position: relative;
    box-shadow: none;
    padding: 10px;
    flex: 1;
    overflow-y: auto;
}

@media (max-width: 768px) {
    .container .global-queue-container {
        display: none; /* Hide desktop queue on mobile */
    }
    
    .mobile-queue-content .global-queue-container {
        display: block; /* Show mobile queue in queue tab */
        width: 100%;
        padding: 10px;
        height: auto;
        position: static;
    }
    
    .global-queue-section {
        width: 100%;
    }
    
    /* Queue view */
    #queue-view {
        height: calc(100vh - 60px);
        overflow-y: auto;
    }
    
    #queue-view .mobile-queue-content {
        height: auto;
        min-height: calc(100vh - 60px);
    }
}

@media (max-width: 768px) {
    /* Hide sidebar header on queue page for mobile */
    #queue-view .mobile-queue-content .sidebar-header {
        display: none;
    }
    
    /* Make global queue container mobile friendly */
    .mobile-queue-content {
        display: flex;
        flex-direction: column;
        height: 100%;
        padding: 0;
        overflow-y: auto;
        background-color: white;
    }
    
    .mobile-queue-content .global-queue-container {
        width: 100% !important;
        height: auto;
        max-height: none;
        border-left: none;
        border-top: none;
        position: relative;
        box-shadow: none;
        padding: 10px;
        flex: 1;
        overflow-y: auto;
        margin-top: 0;
    }
    
    .global-queue-section {
        width: 100%;
        padding: 10px;
    }
    
    /* Queue view */
    #queue-view {
        height: calc(100vh - 60px);
        overflow-y: auto;
    }
    
    #queue-view .mobile-queue-content {
        height: auto;
        min-height: calc(100vh - 60px);

    }
}

/* Inline editing styles */
.court-number {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.edit-court-name-btn,
.edit-player-name-btn {
    background: none;
    border: none;
    color: #6c757d;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 2px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.5;
    transition: opacity 0.2s, background-color 0.2s;
}

.court-number:hover .edit-court-name-btn,
.player-name-container:hover .edit-player-name-btn {
    opacity: 1;
}

.edit-court-name-btn:hover,
.edit-player-name-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: #007bff;
}

.player-name-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.player-name {
    font-weight: 500;
}

.edit-name-input {
    font-family: inherit;
    font-size: inherit;
    padding: 2px 5px;
    border: 1px solid #007bff;
    border-radius: 4px;
    outline: none;
}

.edit-name-input:focus {
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Additional styles for player list view */
.player-name-level .player-name-container {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.player-name-level .edit-player-name-btn {
    opacity: 0.5;
    position: relative; /* Changed from absolute to relative */
    margin-left: 4px; /* Added margin instead of positioning */
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
}

.player-name-level:hover .edit-player-name-btn {
    opacity: 1;
}