---
export interface BreadcrumbItem {
  label: string;
  href?: string;
}

export interface Props {
  items: BreadcrumbItem[];
}

const { items } = Astro.props;
---

<nav class="breadcrumbs" aria-label="Навигация по странице">
  <div class="site-container">
    <ol class="breadcrumbs-list">
      {items.map((item, index) => (
        <li class="breadcrumb-item">
          {item.href && index < items.length - 1 ? (
            <a href={item.href} class="breadcrumb-link">{item.label}</a>
          ) : (
            <span class="breadcrumb-current">{item.label}</span>
          )}
          {index < items.length - 1 && (
            <svg class="breadcrumb-separator" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
              <path d="m9 18 6-6-6-6"/>
            </svg>
          )}
        </li>
      ))}
    </ol>
  </div>
</nav>

<style>
  .breadcrumbs {
    padding: 0.75rem 0 0.75rem;
    background: transparent;
  }

  .breadcrumbs-list {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .breadcrumb-link {
    color: #64748b;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0.25rem 0;
  }

  .breadcrumb-link:hover {
    color: #d4af37;
  }

  .breadcrumb-current {
    color: #1e293b;
    font-size: 0.875rem;
    font-weight: 600;
  }

  .breadcrumb-separator {
    width: 1rem;
    height: 1rem;
    color: #94a3b8;
    flex-shrink: 0;
  }

  @media (max-width: 640px) {
    .breadcrumbs {
      padding: 0 0 0.5rem;
    }

    .breadcrumb-link,
    .breadcrumb-current {
      font-size: 0.8rem;
    }

    .breadcrumb-separator {
      width: 0.875rem;
      height: 0.875rem;
    }
  }
</style>
