/* Body styling */
* {
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #111;
    color: #fff;
    margin: 0;
    padding: 10px; /* Reduced padding for better mobile view */
}

/* Layout */
.layout {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

/* Sidebar */
.sidebar {
    width: 280px;
    text-align: left;
    overflow-wrap: break-word; /* Ensure text wraps */
}

.sidebar-box {
    background-color: #1a1a1a;
    padding: 15px;
    border-radius: 10px;
}

.sidebar h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #0f0;
    font-size: 20px;
}

.sidebar ul {
    list-style: none;
    padding: 0;
}

.sidebar ul li {
    margin: 8px 0;
    font-size: 16px; /* bigger font */
}

/* === Add spacing between CPS Records and KPS Records === */
.sidebar h3:nth-of-type(2) {
    margin-top: 20px; /* Margin between CPS Records and KPS Records titles */
}

/* Click Method Boxes */
.method-box {
    background-color: #2a2a2a;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.method-box:last-child {
    margin-bottom: 0;
}

.method-box h4 {
    margin-top: 0;
    color: #0f0;
}

.method-box ul {
    padding-left: 20px;
    margin-bottom: 0;
}

/* Main container */
.container {
    flex: 1;
    margin: 0 20px;
    text-align: center;
}

/* Tabs */
.tabs {
    margin-bottom: 20px;
}

.tabBtn {
    background-color: #333;
    color: #fff;
    padding: 10px 20px;
    border: none;
    cursor: pointer;
    margin-right: 5px;
    border-radius: 5px;
}

.tabBtn.active {
    background-color: #555;
}

/* Action button */
.actionBtn {
    padding: 100px 120px;
    font-size: 2.5em;
    margin: 20px 0;
    cursor: pointer;
    background-color: #007bff;
    border: none;
    border-radius: 8px;
    color: #fff;
    transition: transform 0.1s;
}

.actionBtn:active {
    transform: scale(0.95);
}

/* Stats */
.stats p {
    margin: 10px 0;
}

/* Time options */
.time-options label {
    margin-right: 10px;
    cursor: pointer;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 999;
    padding-top: 100px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
}

.modal-content {
    background-color: #222;
    margin: auto;
    padding: 20px;
    border-radius: 10px;
    width: 80%;
    max-width: 800px; /* Increased from 400px */
    max-height: 80vh; /* Added for scrolling */
    overflow-y: auto;   /* Added for scrolling */
    color: #fff;
    text-align: center;
}

/* Close button */
.close {
    color: #aaa;
    float: right;
    font-size: 36px;
    font-weight: bold;
    cursor: pointer;
    padding: 10px;
}

.close:hover {
    color: #fff;
}

/* KPS Feedback */
#kpsFeedback {
    margin-top: 20px;
    background-color: rgba(0,200,0,0.2);
    color: #0f0;
    padding: 10px;
    border-radius: 10px;
    font-size: 18px;
    font-family: monospace;
    display: inline-block;
    min-width: 200px;
    transition: opacity 0.1s;
    opacity: 1;
}

/* Prevent selection */
body, button, .actionBtn, .tabBtn {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Mobile optimization */
body, button, .actionBtn, .tabBtn {
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
    touch-action: manipulation;
}

/* Responsive design */
@media (max-width: 768px) {
    .layout {
        flex-direction: column;
        align-items: center;
    }

    .sidebar {
        width: 100%;
        margin-bottom: 20px;
    }

    .container {
        margin: 0;
        width: 100%; /* Ensure container also takes full width */
    }
}

/* Leaderboard Styles */
.leaderboard-filters {
    margin-bottom: 20px;
}

.leaderboard-filters select {
    padding: 8px;
    border-radius: 5px;
    border: 1px solid #444;
    background-color: #333;
    color: #fff;
    font-size: 1em;
}

#leaderboardContent table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

#leaderboardContent th,
#leaderboardContent td {
    border: 1px solid #444;
    padding: 10px;
    text-align: left;
}

#leaderboardContent th {
    background-color: #2a2a2a;
    color: #0f0;
}

#leaderboardContent tr:nth-child(even) {
    background-color: #1a1a1a;
}

#leaderboardContent tr:hover {
    background-color: #222;
}

@media (max-width: 480px) {
    #leaderboardContent th,
    #leaderboardContent td {
        font-size: 0.8em;
        padding: 5px;
    }
}

/* Global Leaderboard Section Styling */
#globalLeaderboardSection {
    background-color: #1a1a1a;
    padding: 20px;
    border-radius: 10px;
    margin-top: 30px; /* Add some space from the main content */
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.3); /* Green glow effect */
}

#globalLeaderboardSection h2 {
    color: #0f0; /* Bright green for heading */
    text-align: center;
    margin-bottom: 20px;
    font-size: 2em;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.7);
}

#globalLeaderboardSection .leaderboard-filters {
    text-align: center;
    margin-bottom: 20px;
}

#globalLeaderboardSection .leaderboard-filters select {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #0f0; /* Green border */
    background-color: #2a2a2a;
    color: #fff;
    font-size: 1.1em;
    cursor: pointer;
    outline: none;
}

#globalLeaderboardSection table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: #222;
    border-radius: 8px;
    overflow: hidden; /* Ensures border-radius applies to table corners */
}

#globalLeaderboardSection th,
#globalLeaderboardSection td {
    border: 1px solid #333; /* Slightly darker border for cells */
    padding: 12px;
    text-align: left;
    color: #eee;
}

#globalLeaderboardSection th {
    background-color: #0f0; /* Green background for headers */
    color: #111; /* Dark text on green background */
    font-weight: bold;
    text-transform: uppercase;
}

#globalLeaderboardSection tr:nth-child(even) {
    background-color: #1c1c1c; /* Darker shade for even rows */
}

#globalLeaderboardSection tr:hover {
    background-color: #3a3a3a; /* Lighter shade on hover */
    transition: background-color 0.2s ease;
}

#globalLeaderboardSection p {
    text-align: center;
    color: #aaa;
    font-style: italic;
}

/* Responsive table for mobile */
#leaderboardContentBottom {
    overflow-x: auto; /* Allows horizontal scrolling for the table */
}

#cpsHistoryList, #kpsHistoryList {
    height: 200px; /* Adjust as needed */
    overflow-y: auto;
    border: 1px solid #444;
    padding: 10px;
    border-radius: 5px;
}

.duration-filters {
    margin-bottom: 10px;
}

.duration-filter {
    background-color: #333;
    color: #fff;
    padding: 5px 10px;
    border: none;
    cursor: pointer;
    margin-right: 5px;
    border-radius: 5px;
}

.duration-filter.active {
    background-color: #555;
}