/**
 * QuickCap Player Stats Component Styles
 * Shared CSS for player statistics panel
 * Used in both mobile app and spectator screens
 */

/* Players Panel Styles */
.players-panel {
    background: #374151;
    border-bottom: 1px solid #4b5563;
    margin: 0;
}

.players-panel-header {
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    background: #374151;
    border-bottom: 1px solid #4b5563;
}

.players-panel-header:hover {
    background: #404652;
}

.players-panel-title {
    font-weight: 600;
    font-size: 14px;
    color: #e5e7eb;
    flex: 1;
    text-align: center;
}

.players-panel-toggle {
    font-size: 12px;
    color: #9ca3af;
    transition: transform 0.2s ease;
}

.players-panel-toggle.collapsed {
    transform: rotate(-90deg);
}

.players-panel-content {
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    max-height: 400px;
}

.players-panel-content.collapsed {
    max-height: 0;
}

/* Base grid layout - can be overridden by specific implementations */
.players-grid {
    display: flex;
    padding: 16px;
    gap: 16px;
    position: relative;
}

.players-grid::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 8px;
    bottom: 8px;
    width: 1px;
    background: #4b5563;
    transform: translateX(-50%);
    opacity: 0.5;
}

.team-column {
    flex: 1;
}

.team-players-header {
    font-size: 12px;
    font-weight: 600;
    color: #9ca3af;
    margin-bottom: 8px;
    text-align: center;
}

.player-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.player-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    background: #1f2937;
    border-radius: 4px;
    font-size: 12px;
    transition: background-color 0.2s ease;
}

.player-item.clickable:hover {
    background: #374151;
}

.player-item.clickable:active {
    background: #4b5563;
    transform: scale(0.98);
}

.player-item.two-major-fouls {
    border: 1px solid #dc2626; /* thin red border like majored players */
}

.player-item.two-major-fouls:hover {
    background: #4b5563;
}

.player-item.two-major-fouls:active {
    background: #4b5563;
    transform: scale(0.98);
}

.player-item.all-fouls {
    background: #7f1d1d;
}

.player-item.all-fouls:hover {
    background: #991b1b;
}

.player-item.all-fouls:active {
    background: #dc2626;
    transform: scale(0.98);
}

.player-stats {
    display: flex;
    align-items: center;
    gap: 0;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 6px;
}

.player-name {
    color: #e5e7eb;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.player-cap {
    background: #6b7280;
    color: #e5e7eb;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    min-width: 24px;
    text-align: center;
}

.foul-indicators {
    display: flex;
    gap: 2px;
}

/* Unattributed foul display - single dot and number */
.unattributed-foul-display {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 26px; /* Same width as 3 circles */
}

.unattributed-foul-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid #dc2626;
    background-color: transparent;
    flex-shrink: 0;
}

.unattributed-foul-dot.filled {
    background-color: #dc2626;
}

.unattributed-foul-count {
    font-size: 10px;
    font-weight: bold;
    color: #e5e7eb;
    min-width: 12px;
    text-align: left;
}

/* Unattributed player special layout */
.unattributed-player {
    padding: 6px 8px;
}

.unattributed-layout {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.unattributed-label {
    font-weight: bold;
    color: #e5e7eb;
    flex-shrink: 0;
}

.unattributed-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: bold;
}

.unattributed-goals {
    color: #e5e7eb;
    font-size: 14px;
}

.unattributed-separator {
    color: #6b7280;
    font-weight: normal;
}

.foul-circle {
    width: 8px;
    height: 8px;
    border: 1px solid #6b7280;
    border-radius: 50%;
    background: transparent;
    transition: background-color 0.2s ease;
}

.foul-circle.filled {
    background: #dc2626;
    border-color: #dc2626;
}

.stats-separator {
    width: 1px;
    height: 12px;
    background: #4b5563;
    margin: 0 6px;
}

.goal-counter {
    font-size: 12px;
    font-weight: 600;
    color: #ffffff;
    min-width: 16px;
    text-align: center;
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
}

.empty-stats-message {
    color: #6b7280;
    font-size: 11px;
    font-style: italic;
    text-align: center;
    padding: 8px;
}

.stats-message {
    color: #6b7280;
    font-size: 11px;
    font-style: italic;
    text-align: center;
    padding: 8px;
}

/* Player Stats Modal Styles */
.modal {
    display: none !important;
    position: fixed !important;
    z-index: 99999 !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(0, 0, 0, 0.8) !important;
    overflow: auto !important;
    visibility: visible !important;
    opacity: 1 !important;
}

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

.modal-content {
    background: #111827;
    margin: auto;
    padding: 0;
    border: 1px solid #374151;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    top: auto;
    left: auto;
    transform: none;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #374151;
    background: #1f2937;
    border-radius: 12px 12px 0 0;
}

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

.close {
    color: #9ca3af;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    padding: 0 5px;
}

.close:hover,
.close:focus {
    color: #f9fafb;
    text-decoration: none;
}

.player-stats-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
}

/* Mobile responsive adjustments - Apply to all mobile devices including iPhone */
@media (max-width: 480px) {
    /* Keep teams side by side but optimize for narrow screens */
    .players-grid {
        display: flex !important;
        flex-direction: row !important;
        padding: 8px 4px;
        gap: 4px;
    }
    
    .team-column {
        min-width: 0; /* Allow shrinking below content size */
    }
    
    /* Make "US" team slightly wider and "THEM" team narrower for narrow screens */
    .team-column:first-child {
        flex: 1.2 1 55%; /* US team gets slightly more space */
    }
    
    .team-column:last-child {
        flex: 0.8 1 45%; /* THEM team gets less space */
    }
    
    /* Adjust player items for smaller screens */
    .player-item {
        padding: 3px 4px;
        font-size: 10px;
        min-height: 20px;
    }
    
    .player-info {
        gap: 3px;
        min-width: 0;
        flex: 1;
    }
    
    .player-name {
        max-width: 60px;
        font-size: 10px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .player-cap {
        padding: 1px 3px;
        font-size: 9px;
        min-width: 18px;
        flex-shrink: 0;
    }
    
    .player-stats {
        gap: 2px;
        flex-shrink: 0;
    }
    
    .foul-circle {
        width: 5px;
        height: 5px;
    }
    
    .foul-indicators {
        gap: 1px;
    }
    
    .goal-counter {
        font-size: 10px;
        min-width: 12px;
    }
    
    .team-players-header {
        font-size: 10px;
        margin-bottom: 4px;
        padding: 0 2px;
    }
    
    .stats-separator {
        margin: 0 3px;
        height: 10px;
    }
    
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .modal-header {
        padding: 15px;
    }
    
    .modal-header h3 {
        font-size: 16px;
    }
    
    .player-stats-content {
        padding: 15px;
        gap: 15px;
    }
}

.stat-section {
    background: #1f2937;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid #374151;
}

.stat-section-title {
    color: #f9fafb;
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 12px 0;
    border-bottom: 1px solid #374151;
    padding-bottom: 8px;
}

.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.stat-label {
    color: #d1d5db;
    font-size: 14px;
}

.stat-value {
    color: #f9fafb;
    font-weight: 600;
    font-size: 16px;
}

.special-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.special-flag {
    background: #3b82f6;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}