/* ========================================================
   ElcorScreen Custom Breadcrumb — breadcrumb.css
   Version: 1.1.0
   ======================================================== */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600&display=swap');

/* ─── CSS Variables ───────────────────────────────────── */
.ecsb-breadcrumb-nav {
    --ecsb-font: 'Sora', system-ui, sans-serif;

    /* Dark theme */
    --ecsb-bg-dark: linear-gradient(100deg, #0d1117 0%, #161b27 40%, #0f1923 100%);
    --ecsb-border-dark: rgba(255,255,255,0.06);
    --ecsb-glow-dark: rgba(0, 174, 255, 0.18);
    --ecsb-text-dark: #94a3b8;
    --ecsb-link-dark: #e2e8f0;
    --ecsb-current-dark: #38bdf8;
    --ecsb-icon-bg-dark: rgba(56, 189, 248, 0.1);
    --ecsb-icon-border-dark: rgba(56, 189, 248, 0.2);
    --ecsb-sep-dark: rgba(148, 163, 184, 0.35);
    --ecsb-hover-dark: #38bdf8;
    --ecsb-accent-dark: #0ea5e9;

    /* Light theme */
    --ecsb-bg-light: linear-gradient(100deg, #f8faff 0%, #eef3ff 50%, #f0f7ff 100%);
    --ecsb-border-light: rgba(14, 165, 233, 0.15);
    --ecsb-glow-light: rgba(14, 165, 233, 0.08);
    --ecsb-text-light: #64748b;
    --ecsb-link-light: #1e3a5f;
    --ecsb-current-light: #0369a1;
    --ecsb-icon-bg-light: rgba(14, 165, 233, 0.08);
    --ecsb-icon-border-light: rgba(14, 165, 233, 0.2);
    --ecsb-sep-light: rgba(100, 116, 139, 0.3);
    --ecsb-hover-light: #0369a1;
}

/* ─── Base Wrapper ─────────────────────────────────────── */
.ecsb-breadcrumb-nav {
    display: block;
    width: 100%;
    font-family: var(--ecsb-font);
    margin: 0 0 1.5rem 0;
    position: relative;
    /* overflow must NOT be hidden — inner div handles scrolling */
    overflow: visible;
}

/* ─── DARK THEME ───────────────────────────────────────── */
.ecsb-breadcrumb-nav.ecsb-theme-dark {
    background: var(--ecsb-bg-dark);
    border: 1px solid var(--ecsb-border-dark);
    border-radius: 14px;
    box-shadow:
        0 1px 0 0 rgba(255,255,255,0.04) inset,
        0 8px 32px rgba(0,0,0,0.45),
        0 0 0 1px rgba(0,0,0,0.2),
        0 0 40px var(--ecsb-glow-dark);
}

.ecsb-theme-dark::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    border-radius: 14px 14px 0 0;
    background: linear-gradient(90deg, transparent, rgba(56,189,248,0.4), transparent);
    pointer-events: none;
    z-index: 1;
}

/* ─── LIGHT THEME ──────────────────────────────────────── */
.ecsb-breadcrumb-nav.ecsb-theme-light {
    background: var(--ecsb-bg-light);
    border: 1px solid var(--ecsb-border-light);
    border-radius: 14px;
    box-shadow:
        0 1px 0 0 rgba(255,255,255,0.9) inset,
        0 4px 20px rgba(14,165,233,0.08),
        0 0 0 1px rgba(14,165,233,0.06);
}

.ecsb-theme-light::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    border-radius: 14px 14px 0 0;
    background: linear-gradient(90deg, transparent, rgba(14,165,233,0.3), transparent);
    pointer-events: none;
    z-index: 1;
}

/* ─── Inner Container ──────────────────────────────────── */
/* This is THE scroll container. Must clip horizontally,   */
/* but keep border-radius on the parent intact.            */
.ecsb-breadcrumb-inner {
    display: flex;
    justify-content: center;           /* centered on desktop */
    padding: 0 1.25rem;
    overflow-x: auto;                  /* horizontal scroll when needed */
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;             /* hide scrollbar Firefox */
    border-radius: 14px;               /* clip to parent shape */
}

.ecsb-breadcrumb-inner::-webkit-scrollbar {
    display: none;                     /* hide scrollbar Chrome/Safari */
}

/* ─── Breadcrumb List ──────────────────────────────────── */
.ecsb-breadcrumb-list {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;                 /* ALWAYS single row — scroll if overflow */
    justify-content: center;
    list-style: none;
    margin: 0;
    padding: 0.85rem 0;
    gap: 0;
    min-width: max-content;            /* prevent any shrinking of items */
}

/* ─── Each Crumb ──────────────────────────────────────── */
.ecsb-crumb {
    display: flex;
    align-items: center;
    gap: 0;
    flex-shrink: 0;                    /* never let crumbs shrink */
}

/* ─── Crumb Link / Span ───────────────────────────────── */
.ecsb-crumb__link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    transition: all 0.2s ease;
    white-space: nowrap;
    border: 1px solid transparent;
    flex-shrink: 0;
}

/* Dark link */
.ecsb-theme-dark .ecsb-crumb__link {
    color: var(--ecsb-text-dark);
}
.ecsb-theme-dark .ecsb-crumb__link:hover {
    color: var(--ecsb-hover-dark);
    background: rgba(56, 189, 248, 0.06);
    border-color: rgba(56, 189, 248, 0.15);
    text-decoration: none;
}

/* Light link */
.ecsb-theme-light .ecsb-crumb__link {
    color: var(--ecsb-text-light);
}
.ecsb-theme-light .ecsb-crumb__link:hover {
    color: var(--ecsb-hover-light);
    background: rgba(14, 165, 233, 0.06);
    border-color: rgba(14, 165, 233, 0.15);
    text-decoration: none;
}

/* ─── Home Crumb ─────────────────────────────────────── */
.ecsb-crumb--home .ecsb-crumb__link { font-weight: 600; }
.ecsb-theme-dark  .ecsb-crumb--home .ecsb-crumb__link { color: var(--ecsb-link-dark); }
.ecsb-theme-light .ecsb-crumb--home .ecsb-crumb__link { color: var(--ecsb-link-light); }

/* ─── Current (last) Crumb ───────────────────────────── */
.ecsb-crumb__link--current {
    cursor: default;
    font-weight: 600;
}
.ecsb-theme-dark  .ecsb-crumb__link--current {
    color: var(--ecsb-current-dark);
    background: rgba(56, 189, 248, 0.08);
    border-color: rgba(56, 189, 248, 0.18);
}
.ecsb-theme-light .ecsb-crumb__link--current {
    color: var(--ecsb-current-light);
    background: rgba(14, 165, 233, 0.08);
    border-color: rgba(14, 165, 233, 0.18);
}
.ecsb-theme-dark  .ecsb-crumb__link--current:hover {
    background: rgba(56, 189, 248, 0.08);
    border-color: rgba(56, 189, 248, 0.18);
    color: var(--ecsb-current-dark);
}
.ecsb-theme-light .ecsb-crumb__link--current:hover {
    background: rgba(14, 165, 233, 0.08);
    border-color: rgba(14, 165, 233, 0.18);
    color: var(--ecsb-current-light);
}

/* ─── Icon ───────────────────────────────────────────── */
.ecsb-crumb__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 5px;
    font-size: 13px;
    line-height: 1;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}
.ecsb-theme-dark  .ecsb-crumb__icon { background: var(--ecsb-icon-bg-dark);  border: 1px solid var(--ecsb-icon-border-dark); }
.ecsb-theme-light .ecsb-crumb__icon { background: var(--ecsb-icon-bg-light); border: 1px solid var(--ecsb-icon-border-light); }
.ecsb-crumb__link:hover .ecsb-crumb__icon { transform: scale(1.15); }

/* ─── Separator ─────────────────────────────────────── */
.ecsb-crumb__sep {
    display: inline-flex;
    align-items: center;
    margin: 0 2px;
    flex-shrink: 0;
}
.ecsb-theme-dark  .ecsb-crumb__sep { color: var(--ecsb-sep-dark); }
.ecsb-theme-light .ecsb-crumb__sep { color: var(--ecsb-sep-light); }
.ecsb-crumb__sep svg { display: block; width: 12px; height: 12px; }

/* ─── Label ─────────────────────────────────────────── */
.ecsb-crumb__label {
    display: inline-block;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
    font-size: 0.8rem;
    line-height: 1.2;
}

/* ─── Responsive ─────────────────────────────────────── */
/* On mobile: left-align and allow finger-swipe scroll.   */
/* flex-wrap stays nowrap (set above globally).           */
@media (max-width: 768px) {
    .ecsb-breadcrumb-inner {
        justify-content: flex-start;   /* left-align so scroll starts at item 1 */
        padding: 0 1rem;
    }

    .ecsb-breadcrumb-list {
        justify-content: flex-start;
        padding: 0.7rem 0;
    }

    .ecsb-crumb__label {
        max-width: 120px;
        font-size: 0.76rem;
    }

    .ecsb-crumb__icon {
        width: 20px;
        height: 20px;
        font-size: 11px;
    }

    .ecsb-crumb__link {
        padding: 4px 8px;
        gap: 5px;
        font-size: 0.76rem;
    }
}

@media (max-width: 480px) {
    .ecsb-crumb__label  { max-width: 90px; }
    .ecsb-crumb__link   { padding: 4px 7px; }
}

/* ─── Fade-in animation ─────────────────────────────── */
@keyframes ecsb-fade-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.ecsb-breadcrumb-nav { animation: ecsb-fade-in 0.35s ease both; }

/* ─── Print ─────────────────────────────────────────── */
@media print {
    .ecsb-breadcrumb-nav  { background: none !important; border: 1px solid #ccc !important; box-shadow: none !important; }
    .ecsb-crumb__link     { color: #333 !important; }
}
