/* Top 20 Games Plugin Styles */

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.top-20-games-wrapper {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 2rem;
    background: linear-gradient(135deg, var(--bg-dark) 0%, #1a1f35 100%);
    border-radius: 24px;
    box-shadow: var(--shadow-xl);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.top-20-games-header {
    padding: 0 15px 0 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.games-title {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    letter-spacing: -0.5px;
}

.games-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.update-time {
    color: var(--text-secondary);
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.refresh-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.3);
}

.refresh-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 12px -1px rgba(99, 102, 241, 0.4);
}

.refresh-btn:active {
    transform: translateY(0);
}

.refresh-btn.loading svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Game name link styles */
.game-name-link {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s ease;
}

.game-name-link:hover {
    color: #a5b4fc;
    text-decoration: underline;
}

/* Estimated count tooltip */
.estimated-tooltip-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    margin-left: 0.25rem;
}

.question-icon {
    color: var(--text-secondary);
    transition: color 0.2s ease;
    opacity: 0.7;
}

.estimated-tooltip-trigger:hover .question-icon {
    color: var(--warning-color);
    opacity: 1;
}

.estimated-tooltip-trigger.active .question-icon {
    color: var(--warning-color);
    opacity: 1;
}

.estimated-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0.875rem;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: var(--warning-color);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    border-radius: 8px;
    border: 1px solid var(--warning-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 100;
    pointer-events: none;
}

.estimated-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--warning-color);
}

.estimated-tooltip-trigger.active .estimated-tooltip {
    opacity: 1;
    visibility: visible;
}

.table-container {
    overflow-x: auto;
    border-radius: 16px;
    background: var(--bg-card);
    box-shadow: var(--shadow-lg);
}

.top-20-games-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.938rem;
}

.top-20-games-table thead {
    color: white !important;
    position: sticky;
    top: 0;
    z-index: 10;
}

.top-20-games-table th,
.top-20-games-table thead th,
.top-20-games-table thead tr th,
.top-20-games-wrapper .top-20-games-table th {
    padding: 1.25rem 1.5rem !important;
    text-align: left !important;
    font-weight: 700 !important;
    color: white !important;
    text-transform: uppercase !important;
    font-size: 0.75rem !important;
    letter-spacing: 0.5px !important;
    border-bottom: 2px solid var(--border-color) !important;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
    background: transparent !important;
}

.top-20-games-table th .th-content,
.top-20-games-table th .sort-icon {
    color: white !important;
}

.top-20-games-table th:hover {
    background: var(--bg-hover);
}

.top-20-games-table th.sortable {
    position: relative;
}

.th-content {
    display: inline-flex;
    align-items: center;
}

.sort-icon {
    margin-left: 0.5rem;
    opacity: 0.4;
    transition: opacity 0.2s ease;
}

.top-20-games-table th:hover .sort-icon {
    opacity: 1;
}

.top-20-games-table th.sorted-asc .sort-icon::before {
    content: '▲';
    opacity: 1;
}

.top-20-games-table th.sorted-desc .sort-icon::before {
    content: '▼';
    opacity: 1;
}

.top-20-games-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.top-20-games-table tbody tr:hover {
    background: var(--bg-hover);
    transform: scale(1.01);
}

.top-20-games-table td {
    padding: 1.25rem 1.5rem;
    color: var(--text-primary);
}

.rank-cell {
    font-weight: 700;
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 45px;
    padding: 0.5rem 0.75rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 700;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.3);
}

.rank-badge.rank-1 {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    box-shadow: 0 4px 6px -1px rgba(251, 191, 36, 0.4);
}

.rank-badge.rank-2 {
    background: linear-gradient(135deg, #94a3b8, #64748b);
    box-shadow: 0 4px 6px -1px rgba(148, 163, 184, 0.4);
}

.rank-badge.rank-3 {
    background: linear-gradient(135deg, #fb923c, #ea580c);
    box-shadow: 0 4px 6px -1px rgba(251, 146, 60, 0.4);
}

.game-name-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.game-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

.game-platform {
    padding: 0.25rem 0.625rem;
    border-radius: 6px;
    font-size: 0.688rem;
    font-weight: 600;
    text-transform: uppercase;
}

.game-platform.steam {
    background: linear-gradient(135deg, #1b2838, #2a475e);
    color: #66c0f4;
    border: 1px solid #66c0f4;
}

.players-cell {
    position: relative;
}

.player-count {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.063rem;
}

.live-indicator {
    color: var(--success-color);
    margin-left: 0.5rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.peak-count,
.avg-count {
    color: var(--text-secondary);
    font-weight: 500;
}

.change-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 0.875rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.875rem;
}

.change-badge.positive {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.change-badge.negative {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-color);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.change-badge:not(.positive):not(.negative) {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-secondary);
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.table-footer {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.data-source {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0;
}

.data-source a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.data-source a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

.top-20-games-error {
    padding: 2rem;
    background: rgba(239, 68, 68, 0.1);
    border: 2px solid var(--danger-color);
    border-radius: 12px;
    color: var(--danger-color);
    text-align: center;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .top-20-games-wrapper {
        padding: 1.5rem;
    }

    .games-title {
        font-size: 1.5rem;
    }

    .top-20-games-table th,
    .top-20-games-table td {
        padding: 1rem;
    }
}

@media (max-width: 768px) {
    .top-20-games-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .game-name-link {
        font-size: 0.875rem;
    }

    .estimated-tooltip {
        font-size: 0.688rem;
        padding: 0.375rem 0.625rem;
    }

    .top-20-games-table {
        font-size: 0.813rem;
    }

    .top-20-games-table th,
    .top-20-games-table td {
        padding: 0.75rem 0.5rem;
    }

    .game-name {
        font-size: 0.875rem;
    }
}