/* Stats Page Styles */
.stats-search-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.stats-search-input {
    flex: 1;
    min-width: 250px;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
}

.stats-search-input:focus {
    outline: none;
    border-color: #FF6B35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.stats-player-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #FFF8DC 0%, #FFE4B5 100%);
    border-radius: 12px;
    margin-bottom: 2rem;
}

.stats-player-pic {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

.stats-profile-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #FF6B35 0%, #D9534F 100%);
    color: white;
    font-size: 2rem;
    font-weight: bold;
}

.stats-player-info h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.8rem;
    color: #1f2937;
}

.stats-player-meta {
    margin: 0;
    color: #6b7280;
    font-size: 0.95rem;
}

.stats-grid-detailed {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card-detailed {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s;
}

.stat-card-detailed:hover {
    border-color: #FF6B35;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.15);
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #FF6B35;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 600;
}

.stats-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid #e5e7eb;
}

.stats-section-title {
    font-size: 1.3rem;
    color: #1f2937;
    margin-bottom: 1.5rem;
    font-weight: 700;
}

.distance-breakdown {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.distance-bar-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.distance-label {
    min-width: 80px;
    font-weight: 600;
    color: #4b5563;
}

.distance-bar-bg {
    flex: 1;
    height: 30px;
    background: #f3f4f6;
    border-radius: 15px;
    overflow: hidden;
}

.distance-bar {
    height: 100%;
    background: linear-gradient(90deg, #FF6B35 0%, #D9534F 100%);
    transition: width 0.5s ease;
    border-radius: 15px;
}

.distance-stats {
    min-width: 120px;
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.distance-percentage {
    font-weight: 700;
    color: #FF6B35;
    font-size: 1.1rem;
}

.distance-makes {
    font-size: 0.875rem;
    color: #6b7280;
}

.distance-count {
    min-width: 40px;
    text-align: right;
    font-weight: 700;
    color: #FF6B35;
}

.best-session-card {
    background: linear-gradient(135deg, #FFE4B5 0%, #F4A460 100%);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
}

.best-session-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
}

.best-session-points {
    font-size: 2rem;
    font-weight: 700;
    color: #FF6B35;
    margin-bottom: 0.5rem;
}

.best-session-date {
    color: #6b7280;
    font-size: 0.95rem;
}

/* Bulk Quick Actions */
.bulk-quick-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #f3f4f6;
    border-radius: 8px;
}

.selected-count {
    margin-left: auto;
    font-weight: 600;
    color: #FF6B35;
    font-size: 0.875rem;
}

/* Bulk Routine Drills */
.bulk-player-card-routine {
    background: #fafafa;
}

.bulk-routine-drills {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-left: 1.5rem;
}

.bulk-drill-group {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 0.75rem;
}

.bulk-drill-header {
    font-size: 0.875rem;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.bulk-drill-inputs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

@media (max-width: 768px) {
    .bulk-drill-inputs {
        grid-template-columns: 1fr;
    }
}

/* Bulk Players List */
.bulk-players-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.bulk-player-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    background: #f9fafb;
}

.bulk-player-card.current-user-card {
    border: 2px solid #10B981;
    background: #ECFDF5;
}

.bulk-player-card.current-user-card .checkbox-label strong {
    color: #10B981;
}

.bulk-player-card:has(.bulk-player-checkbox:checked) {
    border-color: #FF6B35;
    background: #FFF7ED;
}

.bulk-player-card.current-user-card:has(.bulk-player-checkbox:checked) {
    border-color: #10B981;
    background: #D1FAE5;
}

.bulk-player-header {
    margin-bottom: 0.75rem;
}

.bulk-player-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-left: 1.5rem;
}

.bulk-routine-stats,
.bulk-game-stats {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.bulk-routine-select,
.bulk-game-select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.875rem;
}

.full-width {
    grid-column: 1 / -1;
}

.form-group-inline {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.form-group-inline label {
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 600;
}

.bulk-input {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.875rem;
}

.bulk-input:disabled {
    background: #e5e7eb;
    cursor: not-allowed;
}

.bulk-input:enabled {
    border-color: #FF6B35;
    background: white;
}

@media (max-width: 768px) {
    .bulk-player-stats {
        grid-template-columns: 1fr;
    }
}

/* Header Actions Group */
.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Logged By Badge */
.logged-by-badge {
    background: #3B82F6;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.pending-badge {
    background: #F59E0B;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.pending-session {
    border-left: 4px solid #F59E0B;
    background: #FEF3C7;
}

/* Player Checkbox List */
.player-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.checkbox-label:hover {
    background: #f3f4f6;
}

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

/* Permissions Modal */
.permissions-section {
    margin-bottom: 2rem;
}

.permissions-section h4 {
    font-size: 1.1rem;
    color: #1f2937;
    margin-bottom: 0.75rem;
}

.section-hint {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.75rem;
}

.permission-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.permission-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.permission-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.permission-name {
    font-weight: 600;
    color: #1f2937;
}

.permission-detail {
    font-size: 0.875rem;
    color: #6b7280;
}

.permission-actions {
    display: flex;
    gap: 0.5rem;
}

/* Success and Danger Buttons */
.btn-success {
    background: #10B981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: #EF4444;
    color: white;
}

.btn-danger:hover {
    background: #DC2626;
}

/* Section Header with Action Button */
.section-header-with-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header-with-action .stats-section-title {
    margin-bottom: 0;
}

/* Routine Difficulty Sections */
.routine-difficulty-section {
    margin-bottom: 2rem;
}

.difficulty-title {
    font-size: 1.3rem;
    color: #1f2937;
    margin-bottom: 1rem;
    font-weight: 700;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-left: 4px solid #FF6B35;
}

.difficulty-title.clickable {
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
}

.difficulty-title.clickable:hover {
    background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
    border-left-color: #D9534F;
}

.difficulty-count {
    margin-left: auto;
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

.routine-difficulty-section .routines-grid {
    margin-top: 1rem;
}

/* Personal Goals in Profile */
.goal-item {
    margin-bottom: 1.5rem;
}

.goal-item label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.goal-progress-bar {
    width: 100%;
    height: 24px;
    background: #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.goal-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #FF6B35 0%, #FFA07A 100%);
    transition: width 0.5s ease;
    border-radius: 12px;
}

.goal-progress-text {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.25rem;
    text-align: right;
}

/* Achievement Collapsible Categories */
.category-title.clickable {
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
}

.category-title.clickable:hover {
    color: #FF6B35;
}

.category-toggle {
    font-size: 0.875rem;
    color: #FF6B35;
    transition: transform 0.3s;
    display: inline-block;
    min-width: 1rem;
}

.achievement-category.collapsed .category-toggle {
    transform: rotate(0deg);
}

/* Achievement Splash Screen */
.achievement-splash-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.achievement-splash {
    position: relative;
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    border: 3px solid #FF6B35;
    border-radius: 24px;
    padding: 3rem 2rem;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(255, 107, 53, 0.4);
    animation: splashBounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    overflow: hidden;
}

@keyframes splashBounce {
    0% {
        transform: scale(0.3) translateY(-100px);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.achievement-splash-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 107, 53, 0.3) 0%, transparent 70%);
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% {
        opacity: 0.5;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

.achievement-splash-content {
    position: relative;
    z-index: 1;
    text-align: center;
}

.achievement-splash-header {
    margin-bottom: 2rem;
}

.achievement-splash-badge {
    font-size: 3rem;
    margin-bottom: 1rem;
    animation: rotateBadge 0.8s ease-in-out;
}

@keyframes rotateBadge {
    0% {
        transform: rotate(-180deg) scale(0);
    }
    50% {
        transform: rotate(10deg) scale(1.2);
    }
    100% {
        transform: rotate(0deg) scale(1);
    }
}

.achievement-splash-title {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, #FF6B35 0%, #FFA07A 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    animation: slideDown 0.5s ease 0.2s backwards;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.achievement-splash-icon {
    font-size: 5rem;
    margin: 1.5rem 0;
    animation: bounceIcon 1s ease infinite;
}

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

.achievement-splash-name {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    margin: 1rem 0 0.5rem 0;
    animation: slideDown 0.5s ease 0.4s backwards;
}

.achievement-splash-desc {
    font-size: 1.1rem;
    color: #d1d5db;
    margin: 0.5rem 0 1.5rem 0;
    line-height: 1.6;
    animation: slideDown 0.5s ease 0.6s backwards;
}

.achievement-splash-points {
    display: inline-block;
    background: linear-gradient(135deg, #FF6B35 0%, #D9534F 100%);
    color: white;
    font-size: 1.3rem;
    font-weight: 700;
    padding: 0.75rem 2rem;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
    animation: slideUp 0.5s ease 0.8s backwards;
}

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

.achievement-splash-sparkles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.sparkle {
    position: absolute;
    font-size: 2rem;
    animation: sparkleFloat 3s ease-in-out infinite;
}

.sparkle:nth-child(1) {
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.sparkle:nth-child(2) {
    top: 20%;
    right: 15%;
    animation-delay: 0.5s;
}

.sparkle:nth-child(3) {
    bottom: 25%;
    left: 15%;
    animation-delay: 1s;
}

.sparkle:nth-child(4) {
    bottom: 15%;
    right: 10%;
    animation-delay: 1.5s;
}

.sparkle:nth-child(5) {
    top: 50%;
    left: 5%;
    animation-delay: 2s;
}

.sparkle:nth-child(6) {
    top: 50%;
    right: 5%;
    animation-delay: 2.5s;
}

@keyframes sparkleFloat {
    0%, 100% {
        opacity: 0;
        transform: translateY(0) scale(0.5);
    }
    50% {
        opacity: 1;
        transform: translateY(-20px) scale(1);
    }
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .achievement-splash {
        padding: 2rem 1.5rem;
        max-width: 90%;
    }
    
    .achievement-splash-title {
        font-size: 1.5rem;
    }
    
    .achievement-splash-icon {
        font-size: 4rem;
    }
    
    .achievement-splash-name {
        font-size: 1.5rem;
    }
    
    .achievement-splash-desc {
        font-size: 1rem;
    }
    
    .achievement-splash-points {
        font-size: 1.1rem;
        padding: 0.6rem 1.5rem;
    }
    
    .sparkle {
        font-size: 1.5rem;
    }
}

/* Custom Alert Styles */
.custom-alert {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10000;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease;
    max-width: 400px;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.custom-alert.success {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: white;
}

.custom-alert.error {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    color: white;
}

.custom-alert.warning {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    color: white;
}

.custom-alert.info {
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    color: white;
}

.alert-icon {
    font-size: 1.5rem;
}

.alert-message {
    flex: 1;
}

.session-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.session-points {
    color: #FF6B35;
    font-size: 1.1rem;
}

.btn-edit-session,
.btn-delete-session,
.btn-edit-routine,
.btn-delete-routine,
.btn-edit-game,
.btn-delete-game {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-edit-session:hover,
.btn-edit-routine:hover,
.btn-edit-game:hover {
    background: rgba(59, 130, 246, 0.1);
    transform: scale(1.1);
}

.btn-delete-session:hover,
.btn-delete-routine:hover,
.btn-delete-game:hover {
    background: rgba(239, 68, 68, 0.1);
    transform: scale(1.1);
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .stats-search-container {
        flex-direction: column;
    }
    
    .stats-search-input {
        width: 100%;
        min-width: 0;
    }
    
    .stats-player-header {
        flex-direction: column;
        text-align: center;
    }
    
    .stats-player-pic {
        width: 100px;
        height: 100px;
    }
    
    .stats-grid-detailed {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stat-card-detailed {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .distance-bar-container {
        flex-wrap: wrap;
    }
    
    .distance-label {
        min-width: 60px;
        font-size: 0.875rem;
    }
    
    .distance-stats {
        min-width: 100px;
    }
    
    .distance-percentage {
        font-size: 1rem;
    }
    
    .distance-makes {
        font-size: 0.8rem;
    }
    
    .best-session-stats {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .custom-alert {
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    /* Optimize tabs for mobile */
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .tabs::-webkit-scrollbar {
        display: none;
    }
    
    .tab {
        white-space: nowrap;
        min-width: fit-content;
    }
    
    /* Better touch targets */
    .btn,
    .tab,
    .gender-toggle,
    .leaderboard-tab {
        min-height: 44px;
        padding: 0.75rem 1rem;
    }
    
    /* Optimize modals for mobile */
    .modal {
        max-width: 95vw;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-body {
        max-height: 60vh;
        overflow-y: auto;
    }
}

@media (max-width: 480px) {
    .stats-grid-detailed {
        grid-template-columns: 1fr;
    }
    
    .stat-card-detailed {
        padding: 0.875rem;
    }
    
    .stat-icon {
        font-size: 1.5rem;
    }
    
    .stat-value {
        font-size: 1.25rem;
    }
    
    .stats-section-title {
        font-size: 1.1rem;
    }
}

/* Improve form inputs on mobile */
@media (max-width: 768px) {
    input[type="text"],
    input[type="number"],
    input[type="email"],
    textarea,
    select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.75rem;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .form-group {
        width: 100%;
    }
}

/* Better modal overlay on mobile */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 1rem;
        align-items: flex-start;
        padding-top: 2rem;
    }
    
    .modal-header h3 {
        font-size: 1.2rem;
    }
    
    .close-modal-btn {
        width: 32px;
        height: 32px;
        font-size: 1.5rem;
    }
}

/* Optimize leaderboard for mobile */
@media (max-width: 768px) {
    .leaderboard-item {
        padding: 0.875rem;
    }
    
    .leaderboard-profile-pic {
        width: 40px;
        height: 40px;
    }
    
    .leaderboard-name {
        font-size: 0.95rem;
    }
    
    .leaderboard-stats {
        flex-direction: column;
        align-items: flex-end;
        gap: 0.25rem;
    }
}

/* Optimize achievements for mobile */
@media (max-width: 768px) {
    .achievements-grid {
        grid-template-columns: 1fr;
    }
    
    .achievement-card {
        padding: 1.25rem;
    }
    
    .achievement-icon {
        font-size: 2.5rem;
    }
}

/* Better header on mobile */
@media (max-width: 768px) {
    .header-content {
        padding: 0.75rem 0;
    }
    
    .header-logo {
        max-width: 40px;
    }
    
    .app-title {
        font-size: 1.25rem;
    }
    
    .user-name {
        display: none; /* Hide username on very small screens */
    }
    
    .header-profile-pic {
        width: 32px;
        height: 32px;
    }
}

/* Landscape mobile optimizations */
@media (max-height: 500px) and (orientation: landscape) {
    .modal {
        max-height: 85vh;
    }
    
    .modal-body {
        max-height: 50vh;
    }
}
