/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { overflow-x: hidden; }
body { font-family: sans-serif; background: #0d1117; color: #e6edf3; min-height: 100vh; max-width: 100%; overflow-x: hidden; }

/* ── Navigation ───────────────────────────────────────────────────────────── */
.pub-nav-outer { background: #161b22; border-bottom: 1px solid #30363d; position: relative; z-index: 100; }
.pub-nav {
    max-width: 1200px; margin: 0 auto; padding: 0 20px;
    display: flex; align-items: center; gap: 20px; height: 52px;
}
.pub-nav-logo { color: #58a6ff; font-weight: bold; font-size: 1rem; text-decoration: none; white-space: nowrap; }
.pub-nav-links { display: flex; gap: 16px; flex: 1; align-items: center; }
.pub-nav-links a { color: #8b949e; text-decoration: none; font-size: 0.85rem; }
.pub-nav-links a:hover,
.pub-nav-links a.nav-active { color: #e6edf3; }
.pub-nav-right { display: flex; align-items: center; gap: 10px; font-size: 0.85rem; color: #8b949e; }
.pub-nav-right a {
    color: #8b949e; text-decoration: none; font-size: 0.85rem;
    padding: 5px 12px; border: 1px solid #30363d; border-radius: 6px;
}
.pub-nav-right a:hover { color: #58a6ff; border-color: #58a6ff; }
.pub-nav-right a.btn-login  { background: none; }
.pub-nav-right a.btn-register { background: #1a4a8a; border-color: #2d6abf; color: #90c8ff; }
.pub-nav-right a.btn-register:hover { opacity: .85; color: #90c8ff; border-color: #2d6abf; }
.pub-nav-right form button {
    background: none; border: none; color: #8b949e;
    cursor: pointer; font-size: 0.85rem; padding: 0;
}
.pub-nav-right form button:hover { color: #e6edf3; }
.pub-content { width: 100%; }

/* ── Nav user/guest rows (desktop: inline; mobile: block rows) ────────────── */
.nav-user-row  { display: contents; } /* on desktop, children appear as normal flex items */
.nav-guest-row { display: contents; }
.nav-lang-row  { display: flex; gap: 4px; align-items: center; }

/* ── Hamburger button ─────────────────────────────────────────────────────── */
.nav-hamburger {
    display: none; flex-direction: column; justify-content: center; gap: 5px;
    background: none; border: none; cursor: pointer; padding: 6px 4px;
    margin-left: auto; flex-shrink: 0;
}
.nav-hamburger span {
    display: block; width: 22px; height: 2px;
    background: #8b949e; border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Mobile nav drawer ────────────────────────────────────────────────────── */
@media (max-width: 720px) {
    .nav-hamburger { display: flex; }

    .pub-nav-links,
    .pub-nav-right {
        display: none;
    }
    .pub-nav-links.open,
    .pub-nav-right.open { display: flex; }

    /* Nav bar wraps when open */
    .pub-nav { flex-wrap: wrap; height: auto; padding: 0 20px; align-items: center; }
    .pub-nav-logo { padding: 16px 0; }

    /* Links: vertical list */
    .pub-nav-links {
        flex-direction: column; align-items: flex-start; gap: 0;
        width: 100%; border-top: 1px solid #21262d; padding: 6px 0 4px;
    }
    .pub-nav-links a {
        display: block; padding: 10px 4px; font-size: 0.92rem; width: 100%;
        border-bottom: 1px solid #21262d;
    }
    .pub-nav-links a:last-child { border-bottom: none; }
    .pub-nav-links span { display: none; }

    /* Right section: two sub-rows */
    .pub-nav-right {
        flex-direction: column; align-items: stretch; gap: 0;
        width: 100%; border-top: 1px solid #21262d; padding: 8px 0 14px;
    }
    /* Row 1: user + logout side by side */
    .pub-nav-right > a[href*="dashboard"],
    .pub-nav-right > form {
        display: inline-flex;
    }
    .pub-nav-right .nav-user-row {
        display: flex; align-items: center; justify-content: space-between;
        gap: 10px; padding: 6px 0; border-bottom: 1px solid #21262d; margin-bottom: 6px;
    }
    .pub-nav-right .nav-user-row a { border: none; padding: 0; font-size: 0.88rem; }
    .pub-nav-right .nav-user-row button { font-size: 0.88rem; }
    /* Guest buttons */
    .pub-nav-right .nav-guest-row {
        display: flex; gap: 8px; padding: 4px 0; border-bottom: 1px solid #21262d; margin-bottom: 6px;
    }
    /* Language + EN/ES row */
    .pub-nav-right .nav-lang-row {
        display: flex; gap: 6px; align-items: center; padding: 4px 0;
    }

    /* Sticky sidebar → static on mobile to allow normal stacking */
    .sidebar { position: static !important; }

    /* Contain all page content within viewport */
    .pub-content, main.page { padding-left: 2px; padding-right: 2px; max-width: 100vw; overflow-x: hidden; }
    .table-wrap { max-width: calc(100vw - 24px); }
    /* Prevent any fixed-width child from pushing layout */
    .pub-content *, main.page * { max-width: 100%; }
}

/* ── Visibility dots ──────────────────────────────────────────────────────── */
.vdot {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    background: #30363d; vertical-align: middle; margin-right: 5px;
    opacity: .4; flex-shrink: 0; cursor: default;
    transition: background .3s, opacity .3s;
}

/* ── Badge ────────────────────────────────────────────────────────────────── */
.badge {
    display: inline-block; padding: 2px 8px; border-radius: 10px;
    font-size: 0.72rem; font-weight: bold; color: #fff; white-space: nowrap;
}

/* ── Card container ───────────────────────────────────────────────────────── */
.card { background: #161b22; border: 1px solid #30363d; border-radius: 10px; overflow: hidden; }

/* ── Table ────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th {
    background: #161b22; color: #8b949e; text-align: left;
    padding: 9px 12px; font-size: 0.78rem;
    text-transform: uppercase; letter-spacing: .05em;
    white-space: nowrap; border-bottom: 1px solid #30363d;
}
td { padding: 9px 12px; border-bottom: 1px solid #21262d; font-size: 0.85rem; vertical-align: middle; }
tr:hover td { background: #161b22; }
tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #1c2130; }

/* ── Rankings ─────────────────────────────────────────────────────────────── */
.rank   { color: #8b949e; font-size: 0.8rem; }
.rank-1 { color: #f0d060; font-weight: bold; }
.rank-2 { color: #c0c0c0; font-weight: bold; }
.rank-3 { color: #cd7f32; font-weight: bold; }

/* ── Progress bar ─────────────────────────────────────────────────────────── */
.bar-wrap {
    background: #21262d; border-radius: 4px; height: 6px; width: 80px;
    display: inline-block; vertical-align: middle; margin-left: 6px;
}
.bar { height: 6px; border-radius: 4px; background: #58a6ff; display: block; }

/* ── Score colours ────────────────────────────────────────────────────────── */
.score-hi { color: #c0392b; font-weight: bold; }
.score-md { color: #e67e22; }
.score-lo { color: #27ae60; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
    padding: 6px 12px; border-radius: 6px; text-decoration: none;
    font-size: 0.82rem; border: 1px solid #30363d;
    color: #8b949e; background: #161b22; white-space: nowrap; display: inline-block;
}
.btn.active { background: #58a6ff; color: #0d1117; border-color: #58a6ff; }
.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Controls row ─────────────────────────────────────────────────────────── */
.controls { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.ctrl-sep { color: #484f58; margin: 0 4px; align-self: center; }

/* ── Time-filter pills ────────────────────────────────────────────────────── */
.panel_filters_time {
    padding: 4px 10px; border-radius: 6px; text-decoration: none;
    font-size: 0.78rem; border: 1px solid #21262d;
    color: #6e7681; background: #0d1117; white-space: nowrap;
}
.panel_filters_time.active { background: #1c2b3a; color: #58a6ff; border-color: #1f6feb; }
.panel_filters_time:hover  { border-color: #30363d; color: #8b949e; }

/* ── Stats boxes ──────────────────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-bottom: 24px; }
.stat-box { background: #161b22; border: 1px solid #30363d; border-radius: 8px; padding: 12px 16px; }
.stat-box .num   { font-size: 1.5rem; font-weight: bold; color: #58a6ff; }
.stat-box .label { font-size: 0.75rem; color: #8b949e; margin-top: 2px; }

/* ── Back link ────────────────────────────────────────────────────────────── */
.back-link {
    color: #8b949e; text-decoration: none; font-size: 0.85rem;
    display: inline-flex; align-items: center; gap: 6px; margin-bottom: 20px;
}
.back-link:hover { color: #58a6ff; }

/* ── Misc helpers ─────────────────────────────────────────────────────────── */
.zero       { color: #484f58; font-style: italic; }
.note       { color: #8b949e; font-size: 0.8rem; padding: 8px 0; }
.spike-badge {
    display: inline-block; background: #e74c3c; color: #fff;
    font-size: 0.65rem; font-weight: bold; border-radius: 4px;
    padding: 1px 4px; margin-left: 3px; vertical-align: middle; line-height: 1.4;
}
