@import url('main.css');

/* Dashboard Specific Styles */

/* Dashboard Header */
.dashboard-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--text-color);
    padding: 20px 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.dashboard-title {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-right: auto; /* Push controls to the right */
}

.dashboard-title h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    color: var(--text-color);
}

.last-updated {
    font-size: 13px;
    opacity: 0.9;
    font-weight: 400;
    color: var(--text-color);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.dashboard-controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-left: auto; /* Push controls to the right */
    justify-content: flex-end;
    flex: 1;
    min-width: 0;
}

.nav-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-width: 120px;
    text-align: center;
}

.nav-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nav-button.active {
    background: var(--accent-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    font-weight: 600;
}

.nav-button i {
    font-size: 14px;
}

/* Make bingo button use the same style as other buttons */
.bingo-button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.bingo-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Header controls container */
.header-controls {
    display: flex;
    align-items: center;
}

/* Content Wrapper */
.content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Game Section */
.games-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.games-section > h2 {
    grid-column: 1 / -1;
}

/* Stats Bar */
.stats-bar {
    display: flex;
    gap: 24px;
    margin-bottom: 12px;
    padding: 10px 28px;
    background: #fff;
    border-radius: 7px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    border: 1px solid #ececec;
    align-items: center;    
}

.stat-item {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 8px;
    flex-wrap: nowrap;
    padding: 8px 12px;
}

.stat-label {
    color: #222;
    font-size: 15px;
    font-weight: 500;
    margin-right: 3px;
} 

.stat-value {
    font-weight: 700;
    font-size: 17px;
    color: #2992e4;
    margin-right: 2px;
} 

.stat-percentage {
    font-size: 13px;
    color: #888;
    margin-left: 2px;
    font-weight: 400;
    vertical-align: middle;
} 

/* Stats Panel */
.stats-panel {
    background-color: #f8f9fa;
    border-radius: 4px;
    padding: 10px 12px;
    margin-top: 15px;
    border: 1px solid #183a5a; /* Dark blue border */
    box-shadow: 0 2px 5px rgba(24, 58, 90, 0.07);
}

.stats-panel h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 8px;
}

.stats-panel .stat-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    padding: 6px 0;
    border-bottom: 1px solid #f0f0f0;
}

.stats-panel .stat-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.stats-panel .stat-label {
    color: #183a5a;
    font-size: 14px;
    font-weight: 500;
}

.stats-panel .stat-value {
    color: #2992e4;
    font-weight: 600;
    font-size: 14px;
}

/* Table Container */
.table-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 500px;
    position: relative;
    -webkit-overflow-scrolling: touch;
    background-color: var(--card-background);
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

/* Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    table-layout: auto;
    position: relative;
    background-color: var(--card-background);
}

.viewers-panel .table-container {
    max-height: 600px;
}

/* Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    table-layout: auto;
    position: relative;
}

/* Table Header */
thead {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--primary-color);
}

th {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 12px;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 1000;
    white-space: nowrap;
    user-select: none;
    cursor: pointer;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 12px;
    border-bottom: 1px solid var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: background-color 0.2s;
}

th:not(.no-sort):hover {
    background-color: #34495e;
}

/* No-sort columns */
th.no-sort {
    cursor: default;
}

/* Sort indicators */
th:not(.no-sort).sorted-asc::after {
    content: ' ▲';
    font-size: 0.7em;
    opacity: 0.8;
}

th:not(.no-sort).sorted-desc::after {
    content: ' ▼';
    font-size: 0.7em;
    opacity: 0.8;
}

/* Table Body */
tbody {
    position: relative;
    z-index: 1;
}

tbody tr {
    transition: background-color 0.2s;
    background-color: #ffffff;
}

tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

tbody tr:hover {
    background-color: #f5f9ff !important;
}

td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    color: #212529;
    vertical-align: middle;
}

/* Adjust column widths for viewers table */
#viewersTable th:nth-child(1),
#viewersTable td:nth-child(1) {
    width: 60px; /* Rank column */
    text-align: center;
}

#viewersTable th:nth-child(3),
#viewersTable td:nth-child(3) {
    width: 100px; /* Messages column */
    text-align: center;
}

#viewersTable th:nth-child(4),
#viewersTable td:nth-child(4) {
    width: 120px; /* Joined column */
    text-align: center;
}

#viewersTable th:nth-child(5),
#viewersTable td:nth-child(5) {
    min-width: 200px; /* Last Message column */
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Stats Bar */
.stats-bar {
    display: flex;
    align-items: center;
    gap: 30px;
    margin-bottom: 20px;
    padding: 12px 20px;
    background-color: var(--card-background);
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    overflow-x: auto;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.stat-label {
    color: #666;
    font-size: 14px;
    font-weight: 500;
    margin: 0;
}

.stat-value {
    font-weight: bold;
    font-size: 20px;
    color: var(--secondary-color);
    margin: 0;
}

.stat-percentage {
    color: #666;
    font-size: 14px;
    margin-left: 2px;
}

/* Adjust column widths for game tables */
#dartsTable th:nth-child(1),
#dartsTable td:nth-child(1),
#bingoTable th:nth-child(1),
#bingoTable td:nth-child(1) {
    width: 60px; /* Rank column */
    text-align: center;
}

#dartsTable th:nth-child(3),
#dartsTable td:nth-child(3),
#bingoTable th:nth-child(3),
#bingoTable td:nth-child(3) {
    width: 100px; /* Score column */
    text-align: center;
}

/* Header title and controls spacing */
.dashboard-header {
    padding: 15px 30px; /* Increased horizontal padding */
}

.dashboard-title {
    margin-right: 30px; /* Add space between title and controls */
}

/* Column Specific Styles */
.narrow {
    width: 60px;
    max-width: 80px;
    text-align: center;
}

.rank-cell {
    text-align: center;
    font-weight: bold;
    color: #666;
    position: relative;
    padding-left: 24px;
    min-width: 60px;
}

.player-name, .viewer-name {
    font-weight: 500;
    color: #333;
    min-width: 150px;
}

.score-cell, .message-count {
    text-align: center;
    font-weight: bold;
    color: var(--secondary-color);
}

/* Podium highlighting for leaderboards */
tr.podium {
    background-color: #f8f9fa !important;
    position: relative;
}

tr.podium::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--secondary-color);
}

tr.podium:hover {
    background-color: #e9ecef !important;
}

tr.podium .rank-cell {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 0; /* Hide the text number */
}

/* Trophy icons for podium positions */
tr:nth-child(1).podium::after {
    background: linear-gradient(to bottom, #ffd700, #c5a642);
}

tr:nth-child(2).podium::after {
    background: linear-gradient(to bottom, #c0c0c0, #8e8e8e);
}

tr:nth-child(3).podium::after {
    background: linear-gradient(to bottom, #cd7f32, #8b5a2b);
}

tr:nth-child(1) .rank-cell::before,
tr:nth-child(2) .rank-cell::before,
tr:nth-child(3) .rank-cell::before {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px; /* Set icon size */
}

tr:nth-child(1) .rank-cell::before {
    content: '🥇';
}

tr:nth-child(2) .rank-cell::before {
    content: '🥈';
}

tr:nth-child(3) .rank-cell::before {
    content: '🥉';
}

/* Scrollbar styling */
.table-container::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

.table-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .table-container {
        border-radius: 0;
        margin: 0 -16px;
        width: calc(100% + 32px);
    }
    
    th, td {
        padding: 10px 12px;
    }
    
    .table-container {
        max-height: 400px;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        align-items: stretch;
        gap: 20px;
        padding: 15px 20px;
    }
    
    .dashboard-title {
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    .dashboard-controls {
        width: 100%;
        justify-content: flex-start;
        margin-left: 0;
    }
    
    .nav-button {
        flex: 1;
        min-width: 0;
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .nav-button {
        flex: 1;
        justify-content: center;
        padding: 8px 10px;
        font-size: 12px;
    }
    
    .nav-button i {
        display: none;
    }
    
    .games-section {
        grid-template-columns: 1fr;
    }
    
    .stats-bar {
        flex-direction: column;
        gap: 10px;
    }
    
    .stat-item {
        justify-content: space-between;
    }
}
