/* ── Fixed side panel (visible at top of page) ───────────────── */
.side-panel {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 2000;
    width: 200px;
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid rgba(0, 0, 0, 0.18);
    border-radius: 6px;
    background: #1e1e28;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

body.has-sub-nav.scrolled .side-panel {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* ── Sub-navigation bar (visible when scrolled) ──────────────── */
.sub-nav {
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(15px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 52px;
    z-index: 900;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: none;
}

body.has-sub-nav .sub-nav {
    display: none;
}

body.has-sub-nav.scrolled .sub-nav {
    display: block;
}

.sub-nav__row {
    width: 100%;
}

.sub-nav__row--links-bordered {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sub-nav__row--stats {
    background: rgba(0, 0, 0, 0.2);
}

.sub-nav__wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.sub-nav__links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.sub-nav__extra {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 4px 0;
}

/* ── Auth section (always present in side panel) ─────────────── */
.side-panel__auth {
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.side-panel__content {
    display: flex;
    flex-direction: column;
}

/* ── Shared button styles ────────────────────────────────────── */
.sub-nav__btn,
.side-panel__btn {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 14px;
    background: transparent;
    color: #d1d5db;
    text-decoration: none;
    font-size: 0.825rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    border: none;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}

.sub-nav__btn {
    padding: 8px 14px;
}

.side-panel__btn {
    border-radius: 0;
    width: 100%;
}

.sub-nav__btn i,
.side-panel__btn i {
    width: 14px;
    text-align: center;
    font-size: 0.8rem;
    opacity: 0.75;
    flex-shrink: 0;
}

.sub-nav__btn:hover,
.side-panel__btn:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
}

.sub-nav__btn:hover i,
.side-panel__btn:hover i {
    opacity: 1;
}

.sub-nav__btn--auth,
.side-panel__btn--auth {
    color: #9ca3af;
}

.sub-nav__btn--green,
.side-panel__btn--green {
    color: #6ee7b7;
}

.sub-nav__btn--green:hover,
.side-panel__btn--green:hover {
    background: rgba(16, 185, 129, 0.15);
    color: #a7f3d0;
}

.sub-nav__btn--blue,
.side-panel__btn--blue {
    color: #93c5fd;
}

.sub-nav__btn--blue:hover,
.side-panel__btn--blue:hover {
    background: rgba(59, 130, 246, 0.15);
    color: #bfdbfe;
}

.sub-nav__btn--red,
.side-panel__btn--red {
    color: #fca5a5;
}

.sub-nav__btn--red:hover,
.side-panel__btn--red:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #fecaca;
}

/* ── Set title ───────────────────────────────────────────────── */
.side-panel__set-title {
    padding: 10px 14px 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #e5e7eb;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    margin-top: 25pt;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* In sub-nav, set title is inline */
.sub-nav .side-panel__set-title {
    border-top: none;
    margin-top: 0;
    padding: 0 8px;
}

/* ── Stats ───────────────────────────────────────────────────── */
.side-panel__stats {
    padding: 10px 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 9px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.side-panel__stats--first {
    border-top: none;
    padding-top: 2px;
}

/* In sub-nav, stats are horizontal */
.sub-nav .side-panel__stats {
    flex-direction: row;
    align-items: center;
    gap: 16px;
    padding: 0 8px;
    border-top: none;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.sub-nav .side-panel__stats--first {
    border-left: none;
}

.side-panel__stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.side-panel__stat--navigable {
    cursor: pointer;
    border-radius: 6px;
    padding: 4px 6px;
    margin: 0 -6px;
    transition: background 0.15s ease;
}

.side-panel__stat--navigable:hover {
    background: rgba(255, 255, 255, 0.06);
}

.side-panel__stat--navigable:hover .side-panel__stat-value {
    color: #f59e0b;
}

.side-panel__stat-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.75rem;
}

/* In sub-nav, stat row is inline */
.sub-nav .side-panel__stat-row {
    gap: 6px;
    font-size: 0.72rem;
}

.side-panel__stat-label {
    color: #9ca3af;
}

.side-panel__stat-value {
    color: #e5e7eb;
    font-weight: 600;
    font-size: 0.8rem;
}

.side-panel__stat-total {
    color: #6b7280;
    font-weight: 400;
    font-size: 0.72rem;
}

.side-panel__progress {
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
}

/* In sub-nav, thinner progress bar */
.sub-nav .side-panel__progress {
    height: 3px;
}

.side-panel__progress-bar {
    height: 100%;
    background: #6ee7b7;
    border-radius: 2px;
}

.side-panel__label {
    padding: 7px 14px 4px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6b7280;
    user-select: none;
}

.sub-nav .side-panel__label {
    padding: 0;
    margin-right: 4px;
}

.side-panel__divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.07);
    margin: 0;
}

.side-panel__completion {
    font-size: 0.7rem;
    color: #6b7280;
    text-align: right;
    margin-top: -2px;
}
