/* Enhanced responsive styles for Fortnite Campers Ranked */

/* Mobile-first improvements */
* {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Hamburger menu for mobile */
.mobile-menu {
    display: none;
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 8px;
    padding: 0.5rem;
    backdrop-filter: blur(10px);
}

.hamburger {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.3s;
}

.hamburger:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mobile-nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 300px;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    z-index: 999;
    padding: 2rem 1rem;
    transition: right 0.3s ease;
    overflow-y: auto;
}

.mobile-nav.open {
    right: 0;
}

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

.mobile-nav h2 {
    color: #fff;
    margin: 0;
    font-size: 1.2rem;
}

.close-nav {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

.mobile-nav-tabs {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mobile-nav-tabs .tab {
    width: 100%;
    text-align: center;
    padding: 1rem;
    border-radius: 8px;
    font-size: 1rem;
}

.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.mobile-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Swipe gesture container */
.swipe-container {
    position: relative;
    overflow: hidden;
}

.swipe-indicator {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.3);
    z-index: 10;
    pointer-events: none;
    transition: opacity 0.3s;
}

.swipe-indicator.left {
    left: 1rem;
}

.swipe-indicator.right {
    right: 1rem;
}

/* Touch-friendly enhancements */
.leaderboard-row {
    min-height: 60px;
    transition: transform 0.2s, background 0.3s;
}

.leaderboard-row:active {
    transform: scale(0.98);
    background: rgba(255, 255, 255, 0.1);
}

.player-avatar,
.player-name,
.tab,
.profile-link {
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(102, 126, 234, 0.3);
}

/* Improved touch targets */
.tab {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-height: 40px;
}

.profile-link {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    /* Show mobile menu */
    .mobile-menu {
        display: block;
    }
    
    /* Hide desktop tabs on mobile */
    .tabs {
        display: none;
    }
    
    /* Mission banner mobile styles */
    .mission-banner {
        padding: 1rem;
    }
    
    .mission-content h2 {
        font-size: 1.1rem;
    }
    
    .mission-content p {
        font-size: 0.85rem;
        padding: 0 10px;
    }
    
    .leaderboard-header,
    .leaderboard-row {
        grid-template-columns: 50px 60px minmax(150px, max-content) 120px;
    }
    
    .rank-display {
        display: none;
    }

    .modal-content {
        width: 95%;
        margin: 5% auto;
        padding: 1rem;
        max-height: 90vh;
        overflow-y: auto;
    }

    .chart-container {
        height: 300px;
    }

    h1 {
        font-size: 2rem;
    }

    .container {
        padding: 1rem;
        padding-top: 4rem; /* Account for mobile menu */
    }

    .progress-bar {
        width: 100px;
    }
    
    /* Enhanced mobile leaderboard */
    .leaderboard {
        border-radius: 10px;
        margin-top: 1rem;
    }
    
    .leaderboard-row {
        padding: 1rem 0.75rem;
        border-radius: 8px;
        margin-bottom: 2px;
    }
    
    .player-info {
        min-width: 0; /* Allow text to wrap */
    }
    
    .player-name {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 120px;
    }
    
    .highest-rank {
        display: none; /* Hide on mobile to save space */
    }
    
    .last-updated {
        font-size: 0.7rem;
    }
    
    /* Mobile-optimized progress section */
    .progress-section {
        min-width: 80px;
    }
    
    .global-rank {
        font-size: 1.2rem;
    }
    
    .global-rank-label {
        font-size: 0.6rem;
    }
}

@media (max-width: 480px) {
    .leaderboard-header,
    .leaderboard-row {
        grid-template-columns: 40px 50px 1fr 80px;
        gap: 0.5rem;
        padding: 0.75rem;
    }

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

    .crown-icon {
        width: 20px;
        height: 20px;
        top: -10px;
    }

    .rank-position {
        font-size: 1.2rem;
    }

    .player-name {
        font-size: 1rem;
        max-width: 100px;
    }

    .progress-bar {
        width: 60px;
    }

    h1 {
        font-size: 1.5rem;
    }

    .container {
        padding: 0.5rem;
        padding-top: 3.5rem;
    }
    
    .mobile-nav {
        width: 90%;
        padding: 1.5rem 1rem;
    }
    
    .mobile-nav-tabs .tab {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    .leaderboard-row {
        padding: 0.75rem 0.5rem;
        min-height: 55px;
    }
    
    .progress-section {
        min-width: 70px;
    }
    
    .global-rank {
        font-size: 1rem;
    }
    
    .global-rank-label {
        font-size: 0.55rem;
    }
    
    .profile-link {
        min-height: 40px;
        min-width: 40px;
        font-size: 0.9rem;
    }
    
    /* Very small screens - stack content */
    .modal-content {
        width: 98%;
        margin: 2% auto;
        padding: 0.75rem;
    }
    
    .chart-container {
        height: 250px;
    }
}

/* Landscape orientation optimizations */
@media (max-width: 768px) and (orientation: landscape) {
    .container {
        padding-top: 3rem;
    }
    
    .mobile-nav {
        width: 60%;
        max-width: 250px;
    }
    
    .leaderboard-row {
        padding: 0.75rem;
    }
    
    h1 {
        font-size: 1.8rem;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .player-avatar,
    .rank-badge,
    .rank-icon {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Dark mode mobile optimizations */
@media (prefers-color-scheme: dark) and (max-width: 768px) {
    .mobile-nav {
        background: rgba(0, 0, 0, 0.98);
    }
    
    .mobile-menu {
        background: rgba(0, 0, 0, 0.9);
    }
}

/* Light mode mobile optimizations */
@media (prefers-color-scheme: light) and (max-width: 768px) {
    .mobile-nav {
        background: rgba(255, 255, 255, 0.98);
        color: #1a202c;
    }
    
    .mobile-nav h2,
    .close-nav {
        color: #1a202c;
    }
    
    .mobile-menu {
        background: rgba(255, 255, 255, 0.9);
    }
    
    .hamburger {
        color: #1a202c;
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .leaderboard-row,
    .tab,
    .mobile-nav,
    .swipe-indicator {
        transition: none;
    }
    
    .leaderboard-row:active {
        transform: none;
    }
}