/* ─── Treemap-specific Styles (mobile layout) ─────────────────────── */

/* ── Node rectangles ─────────────────────────────────────────────── */
.treemap-container rect {
    transition: opacity 0.25s, filter 0.25s;
    will-change: opacity, transform;
}

.treemap-container .treemap-node rect:hover {
    filter: brightness(1.2);
    stroke: rgba(255, 255, 255, 0.5) !important;
}

/* ── Root bar at top ─────────────────────────────────────────────── */
.treemap-root-bar rect:hover {
    filter: brightness(1.15);
}

.treemap-back-btn:hover rect {
    fill: rgba(255,255,255,0.38) !important;
}

.treemap-back-btn:active rect {
    fill: rgba(255,255,255,0.50) !important;
}

.treemap-cs-btn:hover rect {
    fill: rgba(255,255,255,0.38) !important;
}

.treemap-cs-btn:active rect {
    fill: rgba(255,255,255,0.50) !important;
}

/* ── Labels ──────────────────────────────────────────────────────── */
.treemap-label {
    transition: opacity 0.2s ease-out;
    will-change: opacity;
}

/* ── Mobile overrides ────────────────────────────────────────────── */
@media (max-width: 767px) {
    /* Hide the center-label overlay — treemap uses SVG bar instead */
    body:not(.sunburst-mode) .center-label {
        display: none !important;
    }

    /* Hide breadcrumbs — treemap top bar handles navigation */
    body:not(.sunburst-mode) .breadcrumb {
        display: none !important;
    }

    /* Grade dropdown styling (replaces pills on mobile) */
    .grade-selector {
        order: 2;               /* position right before daily-quiz-btn (order 3) */
        margin-left: auto;      /* push to the right */
        flex: 0 0 auto;
    }

    .daily-quiz-btn {
        order: 3;
    }

    .grade-dropdown {
        font-family: 'Inter', sans-serif;
        font-size: 13px;
        font-weight: 500;
        color: var(--text-primary, #e8e8ed);
        background: rgba(25, 27, 35, 0.85);
        border: 1px solid var(--border, #2a2d3a);
        border-radius: 20px;
        padding: 6px 32px 6px 14px;     /* same vertical padding as quiz button */
        line-height: 1.2;               /* match quiz button line height */
        cursor: pointer;
        transition: all 0.2s;
        outline: none;
        appearance: none;
        -webkit-appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%239a9aad' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 12px center;
    }

    .grade-dropdown:hover {
        background-color: var(--surface-hover, rgba(255,255,255,0.06));
        border-color: rgba(255, 255, 255, 0.15);
    }

    .grade-dropdown:focus {
        border-color: var(--accent-border, #60a5fa);
        box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.15);
    }

    .grade-dropdown option {
        background: var(--bg, #0f1117);
        color: var(--text-primary, #e8e8ed);
        font-size: 14px;
        padding: 8px 12px;
    }

    /* Hide the "Grade" label on mobile — dropdown has full text */
    .grade-selector .grade-label {
        display: none;
    }
}
