:root {
    --primary-color: #ffd700;
    --secondary-color: #ffb700;
    --background-color: #fffbeb;
    --text-color: #333333;
    --accent-color: #ff9f1c;
    --footer-bg: #2c2c2c;
    --footer-text: #fff8e1;
    --footer-accent: #ffd700;
    --footer-border: rgba(255, 215, 0, 0.2);

    /* Dark theme variables */
    --dark-primary-color: #ffd700;
    --dark-secondary-color: #ffb700;
    --dark-background-color: #1a1a1a;
    --dark-text-color: #ffffff;
    --dark-accent-color: #ff9f1c;
    --dark-footer-bg: #000000;
    --dark-footer-text: #fff8e1;
    --dark-table-bg: #2d2d2d;
    --dark-table-border: #444444;
    --dark-hover-bg: rgb(0 0 0 / 82%);
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: var(--background-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    flex: 1;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
}

/* Tab Styles */
.tab-container {
    margin-bottom: 20px;
    text-align: center;
}

.tab-button {
    padding: 12px 24px;
    margin: 0 4px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    border-radius: 4px;
    font-size: 15px;
    transition: all 0.3s ease;
}

.tab-button:hover {
    background: #f5f5f5;
}

.tab-button.active {
    background: var(--primary-color);
    color: var(--text-color);
    border-color: var(--secondary-color);
    font-weight: bold;
}

/* Enhanced Table Styles */
.leaderboard {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    margin: 20px 0;
}

/* Table Wrapper Styles */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0;
    border-radius: 12px;
    position: relative;
    /* Prevent horizontal overflow */
    max-width: 100vw;
    scrollbar-width: thin;
}

.table-wrapper::-webkit-scrollbar {
    height: 8px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

[data-theme="dark"] .table-wrapper::-webkit-scrollbar-track {
    background: #2d2d2d;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th, td {
    padding: 12px 15px;
    text-align: center;
    border-bottom: 1px solid #ddd;
}

/* Column Headers */
th {
    background: var(--primary-color);
    color: var(--dark-background-color);  /* Dark text on light background */
    font-weight: 700;  /* Made bolder for better contrast */
}

td {
    padding: 14px 12px;
    border-bottom: 1px solid #eee;
    font-size: 15px;
    transition: all 0.2s ease;
}

/* Column specific widths */
td:first-child, th:first-child {
    width: 60px;
    font-weight: bold;
}

td:nth-child(2), th:nth-child(2) {
    width: 200px;
    text-align: left;
}

td:last-child, th:last-child {
    font-weight: bold;
    color: #1a73e8;
}

/* Hover and zebra striping */
tr:nth-child(even) {
    background: var(--background-color);
}

tr:hover td {
    background: rgba(255, 215, 0, 0.1);
}

/* Top 3 Styling */
tr:nth-child(1) td:first-child {
    color: #b38600 !important;  /* Darker gold for light mode */
    font-size: 18px;
}

tr:nth-child(2) td:first-child {
    color: #8c8c8c !important;  /* Darker silver for light mode */
    font-size: 17px;
}

tr:nth-child(3) td:first-child {
    color: #8b4513 !important;  /* Darker bronze for light mode */
    font-size: 16px;
}

/* Row Effects */
tr:hover {
    background-color: #f9f9f9;
}

/* Status Colors */
td[data-status="complete"] {
    color: #00a344 !important;  /* Darker green for light mode */
    font-weight: 500;
}

td[data-status="timeout"] {
    color: #d32f2f !important;  /* Darker red for light mode */
    font-weight: 500;
}

td[data-status="completed"] {
    color: #00a344 !important;  /* Darker green for light mode */
    font-weight: 500;
}

/* Score Column */
td:last-child {
    font-weight: 600;
    color: #1a73e8 !important;  /* Blue in light mode */
}

/* Add before the mobile media query */
td[data-status="eliminated"] {
    color: #d32f2f !important;  /* Red color for eliminated status */
    font-weight: 500;
}

/* Override the last-child color for eliminated status */
td[data-status="eliminated"]:last-child,
[data-theme="dark"] td[data-status="eliminated"]:last-child {
    color: #ff5252 !important;  /* Bright red in both light and dark mode */
}

/* Dark Theme Overrides */
[data-theme="dark"] td[data-status="eliminated"] {
    color: #ff5252 !important;  /* Brighter red for dark mode */
}

/* Override any other color rules for eliminated status */
[data-theme="dark"] td[data-status="eliminated"],
[data-theme="dark"] tr:hover td[data-status="eliminated"] {
    color: #ff5252 !important;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .tab-container {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
        justify-content: center;
        padding: 0 5px;
        width: 100%;
        box-sizing: border-box;
    }

    .tab-button {
        padding: 8px 12px;
        font-size: 13px;
        flex: 0 1 auto;
        white-space: nowrap;
        min-width: 80px;
        min-width: unset;
        width: auto;
    }

    .leaderboard {
        margin: 10px 0;
        border-radius: 8px;
        width: 100%;
        overflow: hidden;
    }

    table {
        min-width: 600px; /* Minimum width to ensure readability */
        width: 100%;
    }

    th, td {
        padding: 8px 10px;
        font-size: 13px;
        white-space: nowrap;
    }

    /* Remove sticky positioning for first two columns */
    td:first-child, th:first-child,
    td:nth-child(2), th:nth-child(2) {
        position: static; /* Override sticky positioning */
        left: auto;
        z-index: 1;
        background: none;
    }

    /* Remove specific background colors for sticky columns */
    [data-theme="dark"] td:first-child,
    [data-theme="dark"] td:nth-child(2),
    [data-theme="dark"] tr:nth-child(even) td:first-child,
    [data-theme="dark"] tr:nth-child(even) td:nth-child(2) {
        background: none;
    }

    .tab-button {
        padding: 8px 16px;
        font-size: 14px;
    }

    th, td {
        padding: 8px;
        font-size: 14px;
        white-space: nowrap;
    }
}

/* No Data Message */
.no-data-message {
    text-align: center;
    padding: 40px 20px;
    font-size: 18px;
    color: #666;
    background: #f9f9f9;
    border-radius: 8px;
    margin: 20px 0;
    border: 1px dashed #ddd;
}

.no-data-message p {
    margin: 0;
    line-height: 1.6;
}

.no-data-message .emoji {
    font-size: 24px;
    margin-bottom: 10px;
}

/* Enhanced No Data Message */
.no-data-message {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-color);
    background: var(--background-color);
    border-radius: 12px;
    margin: 20px auto;
    max-width: 600px;
    border: 2px dashed var(--primary-color);
}

.message-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.message-logo {
    width: 200px;
    height: auto;
    margin-bottom: 20px;
    filter: contrast(1.2) brightness(0.95); /* Increased contrast, slightly darker */
    transition: filter 0.3s ease;
}

.no-data-message h2 {
    color: var(--primary-color);
    font-family: 'Russo One', sans-serif;
    font-size: 28px;
    margin: 0;
}

.no-data-message p {
    margin: 5px 0;
    line-height: 1.6;
    font-size: 16px;
}

.no-data-message .emoji {
    font-size: 48px;
    margin: 10px 0;
}

[data-theme="dark"] .no-data-message {
    background: var(--dark-table-bg);
    border-color: var(--dark-primary-color);
}

[data-theme="dark"] .no-data-message p {
    color: var(--dark-text-color);
}

[data-theme="dark"] .message-logo {
    filter: contrast(1.3) brightness(0.85); /* Even more contrast and darker in dark mode */
}

/* Mobile responsiveness for no-data message */
@media screen and (max-width: 768px) {
    .no-data-message {
        padding: 40px 15px;
    }

    .message-logo {
        width: 150px;
    }

    .no-data-message h2 {
        font-size: 24px;
    }

    .no-data-message p {
        font-size: 14px;
    }

    .no-data-message .emoji {
        font-size: 36px;
    }
}

/* Navigation */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 2rem;
    background: var(--primary-color);
    color: var(--background-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    height: 70px; /* Fixed height for nav */
}

.logo, .nav-logo {
    width: 60px;  /* Reduced from 80px */
    height: 60px; /* Reduced from 80px */
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px; /* Slightly reduced border radius */
    overflow: hidden;
}

.logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 5px;
}

.nav-logo {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    overflow: hidden;
    /* Removed background: white; and padding */
}

.nav-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: brightness(1.1); /* Optional: make logo slightly brighter */
}

.game-title {
    font-family: 'Russo One', sans-serif;
    font-size: 1.8rem; /* Slightly reduced */
    color: #463737;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    letter-spacing: 1px;
}

/* Footer */
.footer {
    margin-top: auto;
    padding: 1rem;
    background: var(--footer-bg);
    color: var(--footer-text);
    border-top: 1px solid var(--footer-border);
    text-align: center;
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
}

.footer-credit {
    font-size: 1.1rem;
    color: var(--footer-accent);
}

.footer-logo {
    width: 300px;
    height: 80px;
    margin: 0.25rem auto;
    position: relative;
}

.footer-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.heart {
    color: #ff4d4d;
    display: inline-block;
    animation: heartBeat 1.5s infinite;
}

@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Theme Switcher Button */
.theme-switch {
    background: transparent;
    border: 2px solid var(--footer-accent);
    border-radius: 20px;
    padding: 5px 15px;
    color: var(--footer-text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0;
    transition: all 0.3s ease;
}

.theme-switch:hover {
    background: var(--footer-accent);
    color: var(--footer-bg);
}

.theme-switch i {
    font-size: 14px;
}

/* Dark Theme Styles */
[data-theme="dark"] {
    background: var(--dark-background-color);
    color: var(--dark-text-color);
}

[data-theme="dark"] th {
    background: var(--dark-primary-color);
    color: var(--dark-background-color);  /* Keep dark text on yellow */
}

[data-theme="dark"] .leaderboard {
    background: var(--dark-table-bg);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

[data-theme="dark"] td {
    border-bottom: 1px solid var(--dark-table-border);
    color: var(--dark-text-color);
}

[data-theme="dark"] tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] tr:hover td {
    background: var(--dark-hover-bg);
    color: var(--dark-text-color) !important;
}

[data-theme="dark"] td[data-status="complete"] {
    color: #4caf50 !important;  /* Brighter green for dark mode */
}

[data-theme="dark"] td[data-status="timeout"] {
    color: #ff5252 !important;  /* Brighter red for dark mode */
}

[data-theme="dark"] td[data-status="eliminated"] {
    color: #ff5252 !important;  /* Brighter red for dark mode */
}

[data-theme="dark"] td[data-status="completed"] {
    color: #4caf50 !important;  /* Brighter green for dark mode */
}

[data-theme="dark"] td:last-child {
    color: var(--primary-color) !important;  /* Yellow in dark mode */
}

[data-theme="dark"] .tab-button {
    background: var(--dark-table-bg);
    color: var(--dark-text-color);
    border-color: var(--dark-table-border);
}

[data-theme="dark"] .tab-button:hover {
    background: var(--dark-hover-bg);
}

[data-theme="dark"] .tab-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--dark-table-bg);
}

[data-theme="dark"] .tab-button:disabled:hover {
    background: var(--dark-table-bg);
}

/* Dark Theme Styles */
[data-theme="dark"] tr td {
    color: var(--dark-text-color) !important;
}

[data-theme="dark"] tr:hover td {
    background: var(--dark-hover-bg);
    color: var(--dark-text-color) !important;
}

/* Override specific colors in dark mode */
[data-theme="dark"] td[data-status="complete"] {
    color: #4caf50 !important;
}

[data-theme="dark"] td[data-status="timeout"] {
    color: #ff5252 !important;
}

[data-theme="dark"] td:last-child {
    color: var(--primary-color) !important;
}

[data-theme="dark"] tr:nth-child(1) td:first-child {
    color: #ffd700 !important;
}

[data-theme="dark"] tr:nth-child(2) td:first-child {
    color: #c0c0c0 !important;
}

[data-theme="dark"] tr:nth-child(3) td:first-child {
    color: #cd7f32 !important;
}

/* Mobile Styles Dark Mode Fixes */
@media screen and (max-width: 768px) {
    [data-theme="dark"] th {
        background: var(--dark-primary-color);
        color: var(--dark-background-color);
        border-color: var(--dark-table-border);
    }

    [data-theme="dark"] tr:hover td {
        background: var(--dark-hover-bg) !important;
    }

    [data-theme="dark"] tr:hover td:first-child,
    [data-theme="dark"] tr:hover td:nth-child(2) {
        background: var(--dark-hover-bg) !important;
    }

    [data-theme="dark"] tr:nth-child(even) {
        background: rgba(255, 255, 255, 0.03) !important;
    }
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
    nav {
        padding: 0.5rem 1rem;
        height: 60px;
    }

    .logo, .nav-logo {
        width: 45px;
        height: 45px;
        border-radius: 6px;
    }

    .game-title {
        font-size: 1.29rem;
    }
}

/* Winners Podium Styles */
.winners-podium {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 20px;
    margin: 20px 0 40px;
    padding: 20px;
    background: transparent; /* Make entire podium section transparent */
}

.podium-place {
    width: 200px;
    background: transparent; /* Keep boxes transparent */
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    /* Remove shadow for cleaner look */
    box-shadow: none;
    transition: transform 0.3s ease;
}

.podium-place:hover {
    transform: translateY(-5px);
}

.podium-first {
    margin-bottom: 30px;
    border: 2px solid #ffd700;
}

.podium-second {
    border: 2px solid #c0c0c0;
}

.podium-third {
    border: 2px solid #cd7f32;
}

.medal-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.podium-first .medal-icon {
    color: #ffd700;
}

.podium-second .medal-icon {
    color: #c0c0c0;
}

.podium-third .medal-icon {
    color: #cd7f32;
}

.podium-name {
    font-size: 1.2rem;
    font-weight: bold;
    margin: 10px 0;
    color: var(--text-color);
}

.podium-score {
    font-size: 1.1rem;
    color: #1a73e8;
    font-weight: 500;
}

/* Dark theme support */
[data-theme="dark"] .podium-place {
    background: transparent; /* Remove the dark background */
    box-shadow: none;
}

[data-theme="dark"] .podium-name {
    color: var(--dark-text-color);
}

[data-theme="dark"] .podium-score {
    color: var(--primary-color);
}

/* Mobile responsive */
@media screen and (max-width: 768px) {
    .winners-podium {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }

    .podium-place {
        width: 180px;
    }

    .podium-first {
        margin-bottom: 0;
        order: 1;
    }

    .podium-second {
        order: 2;
    }

    .podium-third {
        order: 3;
    }
}
