/* Admin Quiz Leaderboard Styles */
/* Using themes.css variables */

body {
    margin: 0;
    padding: 16px;
    max-width: 900px;
    margin-inline: auto;
    font-family: 'Pretendard', system-ui, -apple-system, Segoe UI, sans-serif;
    background-color: var(--bg);
    background-image: var(--bg-grad);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
}

h1 {
    margin: 0 0 4px;
    font-size: 1.7rem;
    color: var(--text-main);
}

.subtitle {
    font-size: 0.9rem;
    color: var(--text-sub);
    margin-bottom: 16px;
}

.card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--glass-shadow);
    border: 1px solid var(--border);
    margin-top: 16px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text-main);
}

.card h2 {
    margin: 0 0 12px;
    font-size: 1.25rem;
    color: var(--text-main);
}

.small-muted {
    font-size: 0.8rem;
    color: var(--text-sub);
}

.row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

select {
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    font-size: 0.95rem;
    min-width: 220px;
    background: var(--bg-input);
    color: var(--text-main);
    outline: none;
    transition: all 0.2s;
}

select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-soft);
}

button {
    border: none;
    border-radius: 999px;
    padding: 10px 20px;
    font-size: 0.95rem;
    cursor: pointer;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    transform: translateY(-2px);
}

#status {
    margin-top: 12px;
    font-size: 0.9rem;
    font-weight: 600;
}

.quiz-title-main {
    font-weight: 800;
    font-size: 1.25rem;
    margin-bottom: 8px;
    color: var(--text-main);
}

.quiz-meta {
    font-size: 0.85rem;
    color: var(--text-sub);
    margin-bottom: 4px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 16px;
    margin-bottom: 16px;
}

.summary-item {
    padding: 16px;
    border-radius: 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.summary-label {
    color: var(--text-sub);
    font-size: 0.8rem;
    font-weight: 600;
}

.summary-value {
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--primary);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 16px;
    font-size: 0.9rem;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
}

thead {
    background: var(--primary-soft);
}

th,
td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

th {
    color: var(--primary);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

td {
    color: var(--text-main);
}

th:nth-child(1),
td:nth-child(1) {
    text-align: center;
    width: 60px;
}

th:nth-child(3),
td:nth-child(3),
th:nth-child(4),
td:nth-child(4),
th:nth-child(5),
td:nth-child(5) {
    text-align: center;
}

tbody tr {
    transition: background 0.2s;
}

tbody tr:hover {
    background: var(--bg-hover);
}

tbody tr:nth-child(odd) {
    background: rgba(255, 255, 255, 0.02);
}

/* Medal Colors for top 3 */
tbody tr:nth-child(1) {
    background: rgba(251, 191, 36, 0.1);
}

tbody tr:nth-child(2) {
    background: rgba(148, 163, 184, 0.1);
}

tbody tr:nth-child(3) {
    background: rgba(180, 83, 9, 0.1);
}

.medal {
    font-size: 1.2rem;
    display: inline-block;
    margin-right: 4px;
    vertical-align: middle;
}

.code-text {
    font-size: 0.8rem;
    color: var(--text-sub);
    margin-top: 2px;
}

.no-data {
    padding: 32px 0;
    text-align: center;
    color: var(--text-sub);
    font-size: 0.95rem;
    font-weight: 500;
}

.mode-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-main);
    cursor: pointer;
    font-weight: 500;
}

.mode-label input {
    accent-color: var(--primary);
}

.nav-bar {
    display: flex;
    gap: 12px;
}

@media (max-width: 600px) {
    .row {
        flex-direction: column;
        align-items: stretch;
    }

    select {
        min-width: unset;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }
}