/* Mobile Styles for NTR Website */

/* Base Mobile Styles - Applied for screens under 768px */
@media (max-width: 767px) {
    /* General Layout */
    body {
        margin: 0;
        padding: 0;
        background-attachment: scroll; /* Allow background scrolling on mobile */
        max-width: 100vw; /* Prevent horizontal overflow */
        overflow-x: hidden; /* Prevent horizontal scrolling on body */
    }

    .content-container {
        margin-top: 80px; /* Adjusted to account for smaller fixed header */
        padding: 0; /* Remove padding completely */
        width: 100%;
        box-sizing: border-box;
        overflow-x: hidden; /* Prevent horizontal scrolling */
        position: relative; /* Ensure position context for children */
    }

    /* Fix white space issue at the right side */
    .matchDetails-container,
    .matchDetails-header {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        padding: 0;
        margin: 0;
    }

    /* MOBILE Header & Navigation */
    .mobile-menu-toggle {
        display: block !important; /* Force display on mobile */
        position: absolute; /* Changed from fixed to absolute */
        top: 15px;
        left: 15px;
        font-size: 24px;
        color: #ffffff;
        background: none;
        border: none;
        cursor: pointer;
        z-index: 1001;
        padding: 10px 5px;
    }

    .main-header {
        position: fixed;
        width: 100%;
        top: 0;
        left: 0;
        z-index: 1000;
    }
    
    .main-navigation {
        height: 70px; /* Reduced height for mobile */
        padding: 0 15px;
        flex-direction: row;
        justify-content: space-between;
        background-image: url('../images/primary-graphic.svg'), url('../images/primary-bg.svg'); /* Keep original images */
    }

    .logo-container {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        margin: 0;
    }

    .logo {
        height: 3em; /* Smaller logo for mobile */
    }

    /* Right side user area on mobile */
    #userArea {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        margin-left: auto; /* Push to the right */
    }

    .login-button {
        margin: 0;
        padding: 8px 16px;
        font-size: 14px;
    }

    #userProfile {
        margin: 0;
        display: flex;
        align-items: center;
    }

    /* Username might be too long - hide on very small screens */
    #userName {
        display: none;
    }

    /* Nav list as overlay for mobile */
    .nav-list {
        display: none; /* Hide by default */
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background-color: rgba(0, 0, 30, 0.95);
        flex-direction: column;
        justify-content: center;
        z-index: 1000;
        padding-top: 60px;
        gap: 30px;
        margin: 0;
    }

    .nav-list.active {
        display: flex; /* Show when active */
    }

    .nav-link {
        padding: 15px;
        font-size: 20px;
        text-align: center;
        width: 100%;
    }

    /* Gradient text banner */
    .gradient-text, .ranked-gradient-text {
        height: 80px; /* Reduce height */
        line-height: 80px; /* Adjust to match height */
        font-size: 2em; /* Reduce font size */
        background-image: url('../images/Secondary BG.svg'); /* Keep original gradient image */
        margin-top: -10px;
        position: relative; /* Change from absolute to avoid overlap issues */
        margin-bottom: 0px; /* Reduced margin after banner */
        width: 100%; /* Full width on mobile */
        border-radius: 0; /* Remove border radius on mobile */
    }

    /* Match History Table */
    .MatchHistoryContainer {
        width: 100%; /* Make it full width */
        margin: 0 auto 20px auto; /* Reduced top margin */
        padding: 0; /* Remove padding that might cause extra space */
        overflow-x: hidden; /* Hide overflow initially */
        box-sizing: border-box;
        position: relative; /* For positioning child elements */
    }

    /* Month selector - Center it properly */
    .search-bar-container {
        width: 100%;
        margin: 0px auto -40px auto; /* Added bottom margin */
        padding: 5px 0;
        text-align: center; /* Center content */
        display: flex;
        justify-content: center; /* Center the flex child */
        position: relative; /* Ensure visible */
        z-index: 5; /* Above the table */
    }

    .month-filter-container {
        width: 90%; /* Slightly less than full width */
        max-width: 300px; /* Maximum width */
        margin: 0 auto; /* Center it */
        position: relative; /* Ensure visible */
    }

    .month-selector {
        width: 100%;
        padding: 8px 30px 8px 40px; /* Reduced padding */
        visibility: visible !important; /* Force visibility */
        opacity: 1 !important; /* Force opacity */
        position: relative;
        z-index: 5;
    }

    /* Table container for horizontal scrolling */
    .match-history-table-container {
        width: 100%;
        overflow-x: scroll;
        -webkit-overflow-scrolling: touch;
        margin-top: 0; /* Reset negative margin */
        padding: 0; /* No padding */
        position: relative;
        left: 0;
        right: 0;
    }

    /* Keep original table layout but make it responsive */
    .match-history-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 0.9rem; /* Slightly smaller font size for mobile */
        margin: 0; /* Remove margins */
        table-layout: fixed; /* Control column widths */
        position: relative;
    }
    
    /* Fix table headers to look better on mobile */
    .match-history-table thead th {
        position: sticky;
        top: 70px; /* Match the mobile header height */
        font-size: 0.75rem; /* Smaller font for headers */
        padding: 8px 2px;
        text-align: center;
        vertical-align: middle;
        line-height: 1.2;
        background-color: #000;
        color: #fff;
        z-index: 10;
    }
    
    /* Use icons only for table headers on mobile, hide text */
    .match-history-table thead th i {
        font-size: 1.2rem;
        display: block;
        margin: 0 auto 4px auto;
    }
    
    /* Make table cells more compact */
    .match-history-table tbody td {
        padding: 8px 4px;
        font-size: 0.9rem;
        text-align: center;
        white-space: nowrap; /* Prevent text wrapping */
        overflow: hidden; /* Hide overflow content */
        text-overflow: ellipsis; /* Add ellipsis for overflow */
    }
    
    /* Adjust column widths */
    .match-history-table th:nth-child(1), 
    .match-history-table td:nth-child(1) { /* Date */
        width: 80px;
        min-width: 80px;
        max-width: 80px;
    }
    
    .match-history-table th:nth-child(2), 
    .match-history-table td:nth-child(2) { /* Match ID */
        width: 50px;
        min-width: 50px;
        max-width: 50px;
    }
    
    .match-history-table th:nth-child(3), 
    .match-history-table td:nth-child(3),
    .match-history-table th:nth-child(5), 
    .match-history-table td:nth-child(5) { /* MVPs */
        width: 100px;
        min-width: 100px;
        max-width: 100px;
    }
    
    .match-history-table th:nth-child(4), 
    .match-history-table td:nth-child(4) { /* Score */
        width: 60px;
        min-width: 60px;
        max-width: 60px;
        font-weight: bold;
        font-size: 1.1em;
    }
    
    .match-history-table th:nth-child(6), 
    .match-history-table td:nth-child(6) { /* Stats */
        width: 40px;
        min-width: 40px;
        max-width: 40px;
    }
    
    .match-history-table th:nth-child(7), 
    .match-history-table td:nth-child(7) { /* Edited By */
        width: 60px;
        min-width: 60px;
        max-width: 60px;
    }

    /* Editor avatar group */
    .editor-avatar-group {
        margin: 8px 0;
        height: auto;
        min-width: 40px;
    }

    .editor-tooltip {
        width: 250px;
        left: 50%;
        transform: translateX(-50%);
    }

    /* Footer */
    .main-footer {
        padding: 20px 10px;
        width: 100%;
        box-sizing: border-box;
    }

    .social-media a {
        margin: 0 8px;
        font-size: 18px;
    }

    /* ==================== STATS PAGE STYLES ==================== */
    /* Stats Page - Leaderboard Styling */
    .ranked-leaderboard-container {
        width: 100%;
        margin: 10px 0;
        padding: 0;
        overflow-x: auto; /* Enable horizontal scrolling */
        -webkit-overflow-scrolling: touch;
        box-sizing: border-box;
        position: relative;
    }

    /* Fix for white space issue - ensure table is in a proper container */
    .ranked-leaderboard-container:after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        pointer-events: none;
        z-index: -1;
    }

    /* Stats page filters container - center it and make it stay visible */
    .filters-container {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 5px; /* Reduced gap */
        margin-top: -20px; /* Move everything up */
        padding: 3px 0; /* Reduced padding */
        width: 100%;
        box-sizing: border-box;
        position: sticky; /* Keep it in place when scrolling */
        left: 0;
        right: 0;
        z-index: 5; /* Lower z-index so it doesn't overlay table headers */
        text-align: center; /* Center content */
        background-color: #ffffff; /* Match page background */
    }

    /* Time period filter */
    .period-filter-container {
        width: 90%;
        max-width: 300px;
        margin-top: -25px; /* Reduced top margin */
        position: relative;
        z-index: 6; /* Lower z-index */
    }

    .period-filter-container select {
        visibility: visible !important; /* Force visibility */
        opacity: 1 !important; /* Force opacity */
        width: 100%;
        max-width: 300px;
        -webkit-appearance: none;
        appearance: none;
        color: #333;
        height: 35px; /* Smaller height */
    }

    /* Search filter */
    .search-filter-container {
        width: 90%;
        max-width: 300px;
        margin-bottom: 25px; /* Reduced bottom margin to move up */
        position: relative;
        z-index: 6; /* Lower z-index */
    }

    .search-filter-container input {
        width: 100%;
        padding: 6px 30px 6px 40px; /* Reduced padding */
        font-size: 13px; /* Smaller font */
        box-sizing: border-box;
        visibility: visible !important; /* Force visibility */
        opacity: 1 !important; /* Force opacity */
        -webkit-appearance: none;
        appearance: none;
        height: 35px; /* Smaller height */
    }

    .filter-icon {
        position: absolute;
        left: 15px;
        top: 50%;
        transform: translateY(-50%);
        color: #666;
        font-size: 14px;
        z-index: 7; /* Lower z-index */
    }

    /* Stats table styling */
    .ranked-leaderboard-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 0.9rem;
        margin: 0;
        table-layout: fixed;
        position: relative;
    }

    .ranked-leaderboard-table thead th {
        position: sticky;
        top: 70px;
        font-size: 0.75rem;
        padding: 8px 2px;
        text-align: center;
        vertical-align: middle;
        line-height: 1.2;
        background-color: #000;
        color: #fff;
        z-index: 10;
    }

    .ranked-leaderboard-table thead th i {
        font-size: 1.2rem;
        display: block;
        margin: 0 auto 4px auto;
    }

    .ranked-leaderboard-table tbody td {
        padding: 8px 4px;
        font-size: 0.9rem;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Stats table column widths */
    .ranked-leaderboard-table th:nth-child(1), 
    .ranked-leaderboard-table td:nth-child(1) { /* Rank */
        width: 40px;
        min-width: 40px;
        max-width: 40px;
    }

    .ranked-leaderboard-table th:nth-child(2), 
    .ranked-leaderboard-table td:nth-child(2) { /* Player */
        width: 120px;
        min-width: 120px;
        max-width: 120px;
    }

    .ranked-leaderboard-table th:nth-child(3), 
    .ranked-leaderboard-table td:nth-child(3) { /* Country */
        width: 40px;
        min-width: 40px;
        max-width: 40px;
    }

    .ranked-leaderboard-table th:nth-child(4), 
    .ranked-leaderboard-table td:nth-child(4) { /* Rating */
        width: 60px;
        min-width: 60px;
        max-width: 60px;
        font-weight: bold;
    }

    /* Other stat columns (MVPs, Goals, etc) */
    .ranked-leaderboard-table th:nth-child(n+5):nth-child(-n+11), 
    .ranked-leaderboard-table td:nth-child(n+5):nth-child(-n+11) {
        width: 50px;
        min-width: 50px;
        max-width: 50px;
    }

    /* Form column */
    .ranked-leaderboard-table th:nth-child(12), 
    .ranked-leaderboard-table td:nth-child(12) {
        width: 120px;
        min-width: 120px;
        max-width: 120px;
    }

    /* Player cell styling */
    .player-cell-container {
        display: flex;
        align-items: center;
        max-width: 120px;
        overflow: hidden;
    }

    .leaderboard-avatar {
        width: 20px;
        height: 20px;
        margin-right: 5px;
        flex-shrink: 0;
    }

    .player-name-cell {
        max-width: 85px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Form display */
    .form-container {
        display: flex;
        gap: 2px;
        justify-content: center;
    }

    .form-circle {
        width: 20px;
        height: 20px;
        font-size: 10px;
    }

    /* ==================== PLAYER PROFILE STYLES ==================== */
    /* Profile Hero Section */
    .profile-hero {
        padding: 80px 15px 30px;
        margin-top: 0; /* Adjust to remove negative margin */
        width: 100% !important; /* Force full width */
        margin-left: 0 !important; /* Remove any left margin */
        box-sizing: border-box;
        position: relative;
        left: 0;
        right: 0;
    }
    
    .profile-hero::before,
    .profile-hero::after {
        width: 100% !important; /* Force background patterns to full width */
        left: 0 !important;
        right: 0 !important;
    }
    
    .profile-hero-container {
        grid-template-columns: 1fr;
        gap: 20px;
        text-align: center;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .player-image-container {
        width: 120px;
        height: 120px;
        margin: 0 auto;
        justify-self: center;
    }
    
    .player-identity h1 {
        font-size: 2rem;
        margin-bottom: 5px;
        word-break: break-word; /* Allow long names to break */
    }
    
    .player-ids {
        justify-content: center;
    }
    
    .player-id {
        font-size: 0.9rem;
    }
    
    .player-tags {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 10px;
        margin-bottom: 15px;
        width: 100%;
    }
    
    .position-tag, .country-tag {
        padding: 6px 15px;
        font-size: 1.2rem;
        margin-right: 0;
    }
    
    .position-tag i, .country-tag img {
        margin-right: 6px;
    }
    
    .position-tag i {
        font-size: 1.1rem;
    }
    
    .country-tag img {
        width: 24px;
        height: 18px;
    }
    
    .player-metrics {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 15px;
        margin-bottom: 15px;
        width: 100%;
    }
    
    .metric {
        margin-right: 0;
        min-width: 70px;
    }
    
    .metric-value {
        font-size: 1.8rem;
    }
    
    .metric-label {
        font-size: 0.9rem;
    }
    
    .player-form {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        width: 100%;
    }
    
    .form-indicators {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    
    .form-indicator {
        width: 30px;
        height: 30px;
        font-size: 1rem;
        margin-right: 0;
    }
    
    /* Main Content */
    .profile-content {
        padding: 15px 10px;
        width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    
    .stats-container {
        grid-template-columns: 1fr;
        gap: 15px;
        width: 100%;
        box-sizing: border-box;
        margin: 0 auto;
        padding: 0 5px;
    }
    
    /* Stats Cards */
    .stats-card {
        padding: 15px;
        margin-bottom: 15px;
        width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }
    
    .stats-card h2 {
        font-size: 1.4rem;
        margin-bottom: 15px;
        padding-bottom: 8px;
    }
    
    /* Stats Overview */
    .stats-overview {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
        width: 100%;
    }
    
    .stat-item {
        flex: 1 1 40%;
        padding: 15px 10px;
        margin: 5px;
        min-width: 0; /* Allow items to shrink below content size */
    }
    
    .stat-item i {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }
    
    .stat-number {
        font-size: 1.8rem;
    }
    
    .stat-label {
        font-size: 0.9rem;
    }
    
    .stat-rate {
        font-size: 0.7rem;
    }
    
    /* Position Stats Table */
    .position-stats {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .position-stats-table {
        font-size: 0.8rem;
        min-width: 600px; /* Ensure table is wide enough for content */
        width: auto; /* Allow the table to be wider than container */
    }
    
    .position-stats-table th {
        padding: 8px 4px;
        font-size: 0.7rem;
        white-space: nowrap;
    }
    
    .position-stats-table td {
        padding: 8px 4px;
        white-space: nowrap;
    }
    
    /* Chart Controls */
    .chart-controls-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        width: 100%;
    }
    
    .chart-toggle, 
    .dropdown-container,
    .chart-controls {
        width: 100%;
    }
    
    .dropdown-button {
        width: 100%;
        padding: 8px;
        text-align: left;
    }
    
    .month-filter-control {
        width: 100%;
        display: flex;
        align-items: center;
    }
    
    .month-filter-control select {
        flex-grow: 1;
        margin-left: 10px;
    }
    
    /* Chart Containers */
    .chart-container {
        height: 250px;
        width: 100%;
        overflow: hidden;
    }
    
    /* Recent Matches Table */
    .recent-matches-wrapper {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .recent-matches-table {
        font-size: 0.8rem;
        min-width: 700px; /* Ensure table is wide enough for content */
        width: auto; /* Allow the table to be wider than container */
    }
    
    .recent-matches-table th {
        padding: 8px 5px;
        font-size: 0.7rem;
        white-space: nowrap;
    }
    
    .recent-matches-table td {
        padding: 8px 5px;
        font-size: 0.8rem;
        white-space: nowrap;
    }
    
    .match-result {
        padding: 4px 8px;
        font-size: 0.8rem;
        white-space: normal; /* Allow wrapping of the result text */
    }
    
    /* Rating Changes Section */
    .rating-changes-section {
        margin-top: 20px;
    }
    
    .rating-changes-heading {
        font-size: 1.1rem;
        padding-bottom: 6px;
    }
    
    /* Stats Period Filter */
    .stats-period-filter {
        margin: 10px 0;
    }
    
    .period-filter-container {
        width: 100%;
        max-width: 250px;
        height: 38px;
        margin: 0 auto;
    }
    
    .period-filter-container select {
        font-size: 0.9rem;
    }
    
    /* Fix for full-width cards */
    .full-width {
        width: 100%;
        grid-column: 1 / -1;
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    /* Base fixes for smallest screens */
    .mobile-menu-toggle {
        top: 15px;
        left: 10px;
        font-size: 20px;
    }
    
    .logo {
        height: 2.5em; /* Make logo even smaller */
    }
    
    /* Player profile specific */
    .player-identity h1 {
        font-size: 1.6rem;
    }
    
    .position-tag, .country-tag {
        font-size: 1rem;
        padding: 5px 12px;
    }
    
    .metric-value {
        font-size: 1.5rem;
    }
    
    .stat-item {
        flex: 1 1 100%;
    }
    
    .form-indicator {
        width: 25px;
        height: 25px;
        font-size: 0.9rem;
    }
    
    /* Adjust chart height for very small screens */
    .chart-container {
        height: 200px;
    }
    
    /* Make position stats table scrollable horizontally */
    .position-stats {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .position-stats-table {
        min-width: 500px;
    }
    
    /* Stats cards for very small devices */
    .stats-card {
        padding: 10px;
    }
    
    .stats-card h2 {
        font-size: 1.2rem;
    }
}

/* Mobile menu toggle - ensure it's visible on mobile, hidden on desktop */
.mobile-menu-toggle {
    display: none; /* Hidden by default */
}

@media (min-width: 768px) {
    .mobile-menu-toggle {
        display: none !important; /* Always hidden on desktop */
    }
} 