/**
 * Breadcrumbs Component - Admin Interface
 *
 * Navigation breadcrumb trail showing current page hierarchy.
 * Responsive with overflow handling for long paths.
 */

@layer admin-components {
    /**
     * Breadcrumbs Container
     */
    .admin-breadcrumbs {
        display: flex;
        align-items: center;
        gap: var(--admin-spacing-xs);
        padding: var(--admin-spacing-sm) 0;
        overflow-x: auto;
        scrollbar-width: thin;

        /* Hide scrollbar but keep functionality */
        &::-webkit-scrollbar {
            height: 0;
        }

        /* Mobile: Show in header instead of title */
        @media (max-width: 767px) {
            flex: 1;
            min-width: 0;
        }
    }

    /**
     * Breadcrumb List
     */
    .admin-breadcrumbs__list {
        display: flex;
        align-items: center;
        gap: var(--admin-spacing-xs);
        list-style: none;
        margin: 0;
        padding: 0;
        flex-wrap: nowrap;
    }

    /**
     * Breadcrumb Item
     */
    .admin-breadcrumbs__item {
        display: flex;
        align-items: center;
        gap: var(--admin-spacing-xs);
        white-space: nowrap;
        flex-shrink: 0;

        /* Last item can shrink */
        &:last-child {
            flex-shrink: 1;
            min-width: 0;
        }
    }

    /**
     * Breadcrumb Link
     */
    .admin-breadcrumbs__link {
        display: inline-flex;
        align-items: center;
        gap: var(--admin-spacing-xs);
        color: var(--admin-link-color);
        text-decoration: none;
        font-size: var(--admin-font-size-sm);
        font-weight: 500;
        transition: color var(--admin-transition-base);

        &:hover {
            color: var(--admin-link-hover);
            text-decoration: underline;
        }

        &:focus-visible {
            outline: 2px solid var(--admin-focus-ring);
            outline-offset: 2px;
            border-radius: 2px;
        }
    }

    /**
     * Current Page (not a link)
     */
    .admin-breadcrumbs__current {
        color: var(--admin-content-text);
        font-size: var(--admin-font-size-sm);
        font-weight: 600;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /**
     * Home Icon
     */
    .admin-breadcrumbs__home-icon {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
    }

    /**
     * Separator
     */
    .admin-breadcrumbs__separator {
        display: inline-flex;
        align-items: center;
        color: var(--admin-content-text);
        opacity: 0.4;
        font-size: var(--admin-font-size-sm);
        user-select: none;
        flex-shrink: 0;
    }

    .admin-breadcrumbs__separator-icon {
        width: 16px;
        height: 16px;
    }

    /**
     * Overflow Indicator (for collapsed middle items)
     */
    .admin-breadcrumbs__overflow {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        color: var(--admin-content-text);
        background-color: var(--admin-bg-secondary);
        border-radius: var(--admin-radius-sm);
        cursor: pointer;
        transition: background-color var(--admin-transition-base);

        &:hover {
            background-color: var(--admin-bg-tertiary);
        }

        &:focus-visible {
            outline: 2px solid var(--admin-focus-ring);
            outline-offset: 2px;
        }
    }

    /**
     * Responsive: Compact Mode
     *
     * On very small screens, only show: Home > ... > Current
     */
    @media (max-width: 480px) {
        .admin-breadcrumbs__item:not(:first-child):not(:last-child):not(.admin-breadcrumbs__overflow) {
            display: none;
        }
    }

    /**
     * Accessibility: Screen Reader Only Text
     */
    .admin-breadcrumbs__sr-only {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
}
