/* --- Modern Dark Theme --- */
:root {
    --bg-color: #1a1a1a;
    --primary-color: #2c2c2c;
    --secondary-color: #444;
    --accent-color: #00ff8c; /* A vibrant green, reminiscent of hacker themes */
    --text-color: #e0e0e0;
    --header-color: #ffffff;
}

html, body {
    height: 100%;
    overflow: hidden; /* Prevent scrolling on the body */
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
}

.container {
    position: relative;
    width: 95%;
    height: 95%;
    margin: auto;
    padding: 20px 30px;
    background-color: var(--primary-color);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--secondary-color);
    display: flex;
    flex-direction: column;
}

h1 {
    text-align: center;
    color: var(--header-color);
    font-weight: 700;
    font-size: 2em;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.dashboard-container {
    display: flex;
    flex-direction: row;
    gap: 30px;
    flex-grow: 1;
    min-height: 0; /* Critical for child flex scrolling */
}

.chart-wrapper {
    flex: 3; /* Give chart more space */
    position: relative;
    min-width: 0;
}

.table-wrapper {
    flex: 2; /* Give table less space */
    overflow-y: auto; /* Enable vertical scrolling */
    min-height: 0;
    border: 1px solid var(--secondary-color);
    border-radius: 8px;
    padding: 0 10px;
}

/* --- Table Styles --- */
#leaderboard table {
    width: 100%;
    border-collapse: collapse;
}

#leaderboard th, #leaderboard td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--secondary-color);
    text-align: left;
    vertical-align: middle;
}

#leaderboard th {
    background-color: #333; /* Darker header for contrast */
    color: var(--header-color);
    font-weight: 600;
    text-transform: uppercase;
    position: sticky; /* Make header stick to top of scrolling container */
    top: 0;
}

#leaderboard tr:nth-child(even) {
    background-color: #252525;
}

#leaderboard tr:hover {
    background-color: #383838;
}

/* Avatar Styles */
#leaderboard .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 15px;
    border: 2px solid var(--accent-color);
}

#leaderboard .user-cell {
    display: flex;
    align-items: center;
}

/* --- Rank & Animation Styles --- */

/* Top 3 Rank Styling */
#leaderboard tr.rank-1 { border-left: 5px solid #FFD700; } /* Gold */
#leaderboard tr.rank-2 { border-left: 5px solid #C0C0C0; } /* Silver */
#leaderboard tr.rank-3 { border-left: 5px solid #CD7F32; } /* Bronze */

/* Animation Keyframes */
@keyframes rank-up-animation {
    0% { background-color: transparent; }
    50% { background-color: rgba(46, 125, 50, 0.7); } /* Green flash */
    100% { background-color: transparent; }
}

@keyframes rank-down-animation {
    0% { background-color: transparent; }
    50% { background-color: rgba(198, 40, 40, 0.7); } /* Red flash */
    100% { background-color: transparent; }
}

/* Animation Classes */
.rank-up {
    animation: rank-up-animation 1.5s ease-in-out;
}

.rank-down {
    animation: rank-down-animation 1.5s ease-in-out;
}


/* --- Responsive Design --- */
@media (max-width: 1024px) {
    html, body {
        overflow: auto; /* Re-enable scrolling for mobile */
        height: auto;
    }
    .dashboard-container {
        flex-direction: column;
    }
    .chart-wrapper {
        height: 60vh; /* Define height for vertical layout */
    }
    .table-wrapper {
        overflow-y: visible; /* Disable internal scroll on mobile */
    }
}

#countdown {
    position: absolute;
    top: 30px;
    right: 30px;
    font-size: 1.2em;
    color: var(--accent-color);
    background-color: var(--secondary-color);
    padding: 5px 10px;
    border-radius: 5px;
}

/* --- Moderator Panel Styles --- */
.mod-section {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.log-wrapper {
    background-color: #111;
    border: 1px solid var(--secondary-color);
    border-radius: 8px;
    padding: 15px;
    overflow-y: auto;
    flex-grow: 1;
    font-family: 'Fira Code', monospace;
    font-size: 0.9em;
}

.log-entry {
    margin-bottom: 8px;
    white-space: pre-wrap;
    word-break: break-word;
}

.suspicious-change {
    color: #ff4d4d;
    font-weight: bold;
}

.mod-suggestion {
    margin-top: 30px;
    padding: 15px;
    background-color: rgba(255, 206, 86, 0.1);
    border: 1px solid rgba(255, 206, 86, 0.3);
    border-radius: 8px;
    color: #f0e6d2;
}

.mod-suggestion strong {
    color: #ffce54;
}

/* Ensure moderator tables also have sticky headers if needed */
#suspicious-activity table {
    width: 100%;
    border-collapse: collapse;
}

#suspicious-activity th, #suspicious-activity td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--secondary-color);
    text-align: left;
    vertical-align: middle;
}

#suspicious-activity th {
    background-color: #333;
    color: var(--header-color);
    font-weight: 600;
    text-transform: uppercase;
    position: sticky;
    top: 0;
}

/* Animation for new suspicious entries */
@keyframes suspicious-flash-animation {
    0% { background-color: transparent; }
    50% { background-color: rgba(198, 40, 40, 0.5); } /* Red flash */
    100% { background-color: transparent; }
}

.suspicious-flash {
    animation: suspicious-flash-animation 1.5s ease-in-out;
}

.clickable-row {
    cursor: pointer;
}

.clickable-row:hover {
    background-color: #383838;
}

.log-entry.highlight {
    background-color: rgba(255, 206, 86, 0.2);
    border-left: 3px solid #ffce54;
    padding-left: 10px;
}

/* --- Header with Logout Button --- */
.header-with-logout {
    position: relative; /* Creates a positioning context for the logout link */
    display: flex;
    justify-content: center; /* Centers the h1 */
    align-items: center;
}

.logout-link {
    position: absolute; /* Position relative to the header-with-logout div */
    right: 0;
}

/* --- Login Page Styles --- */
.login-container {
    max-width: 450px;
    margin: 10vh auto 0 auto; /* Center vertically and horizontally */
    padding: 2rem 2.5rem;
    /* We don't want the login container to be a flex child, so we override */
    display: block; 
    height: auto;
}

.login-container h1 {
    margin-bottom: 2rem;
    font-size: 1.8em;
}

.login-container form {
    display: flex;
    flex-direction: column;
}

.login-container input {
    background-color: var(--bg-color);
    border: 1px solid var(--secondary-color);
    color: var(--text-color);
    padding: 1rem;
    margin-bottom: 1.2rem;
    border-radius: 6px;
    font-family: 'Poppins', sans-serif;
    font-size: 1em;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.login-container input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 10px rgba(0, 255, 140, 0.2);
}

.login-container button {
    background-color: var(--accent-color);
    color: #111; /* Dark text for better contrast on the bright button */
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.1em;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.login-container button:hover {
    background-color: #00e67e; /* Slightly lighter green on hover */
    transform: translateY(-2px);
}

.login-container .error {
    color: #ff4d4d;
    text-align: center;
    margin-bottom: 1rem;
    background-color: rgba(255, 77, 77, 0.1);
    padding: 10px;
    border-radius: 6px;
}
