/* ══════════════════════════════════════════════════
   app-sub-nav.css — Sub-icon rail navigation control
   ClickUp-inspired sub-navigation within the icon rail.
   All classes prefixed with ch- to avoid collisions.
   ══════════════════════════════════════════════════ */

/* ── Active app glow aura ─────────────────────────
   Applied to .rail-app-btn.active when an app has
   sub-nav items registered. The glow uses the skin's
   --accent color for a soft radial bloom behind the icon.
   ────────────────────────────────────────────────── */
.rail-app-btn.active.ch-has-subnav {
    position: relative;
}
.rail-app-btn.active.ch-has-subnav::before {
    content: '';
    position: absolute;
    inset: 2px;
    border-radius: 10px;
    background: radial-gradient(
        circle at center,
        color-mix(in srgb, var(--accent) 25%, transparent) 0%,
        transparent 70%
    );
    pointer-events: none;
    z-index: 0;
    transition: opacity 150ms ease;
}
.rail-app-btn.active.ch-has-subnav > * {
    position: relative;
    z-index: 1;
}

/* ── Sub-nav container ────────────────────────────── */
.ch-sub-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 0;
    animation: ch-sub-nav-enter 150ms ease-out;
}

@keyframes ch-sub-nav-enter {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Divider above sub-items ──────────────────────── */
.ch-sub-nav-divider {
    width: 28px;
    height: 1px;
    background: var(--border);
    margin: 4px 0 2px;
    opacity: 0.6;
    flex-shrink: 0;
}

/* ── Individual sub-nav button ────────────────────── */
.ch-sub-nav-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    transition: color 120ms ease, background 120ms ease;
}

.ch-sub-nav-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Hover state */
.ch-sub-nav-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* Active/selected state — solid accent pill behind icon */
.ch-sub-nav-btn.ch-active {
    color: #fff;
    background: var(--accent);
    box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 50%, transparent);
}

/* ── Tooltip (shown on hover via title attr, but we
   add a css-only tooltip for richer styling if needed) ── */
.ch-sub-nav-btn[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 12px;
    line-height: 1.3;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
    white-space: nowrap;
    pointer-events: none;
    z-index: 800;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    animation: ch-tooltip-enter 100ms ease-out;
}

@keyframes ch-tooltip-enter {
    from { opacity: 0; transform: translateY(-50%) translateX(-2px); }
    to   { opacity: 1; transform: translateY(-50%) translateX(0); }
}

/* ── Divider below sub-items ──────────────────────── */
.ch-sub-nav-divider-bottom {
    width: 28px;
    height: 1px;
    background: var(--border);
    margin: 2px 0 4px;
    opacity: 0.6;
    flex-shrink: 0;
}

/* ── Mobile: hide sub-nav when rail becomes tab bar ── */
@media (max-width: 600px) {
    .ch-sub-nav { display: none; }
    .rail-app-btn.active.ch-has-subnav::before { display: none; }
}

/* ── Small screens: tighter sizing ────────────────── */
@media (max-width: 900px) {
    .ch-sub-nav-btn {
        width: 32px;
        height: 32px;
    }
    .ch-sub-nav-btn svg {
        width: 18px;
        height: 18px;
    }
}
