/* Premium Hub Explorer Aesthetics & Layout Polish */

.td-hub-entity-explorer {
    --td-glass-bg: rgba(255, 255, 255, 0.96);
    --td-glass-border: rgba(29, 39, 51, 0.08);
    --td-glass-shadow: 0 16px 36px -32px rgba(29, 39, 51, 0.45);
    --td-anim-bezier: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Glass-like hierarchy without per-card backdrop compositing. */
.td-hub-entity-explorer__card {
    background: var(--td-glass-bg) !important;
    border: 1px solid var(--td-glass-border) !important;
    box-shadow: var(--td-glass-shadow) !important;
    border-radius: 1rem !important;
    transition: transform 0.3s var(--td-anim-bezier), box-shadow 0.3s var(--td-anim-bezier), border-color 0.3s var(--td-anim-bezier) !important;
}

@media (hover: hover) and (pointer: fine) {
    .td-hub-entity-explorer__card:hover {
        transform: translateY(-4px);
        border-color: rgba(29, 39, 51, 0.16) !important;
        box-shadow: 0 24px 48px -24px rgba(29, 39, 51, 0.25) !important;
    }
}

.td-hub-entity-explorer__axis-card[data-axis-coverage="uncovered"],
.td-hub-entity-explorer__axis-card[data-count-authority="none"] {
    border-style: dashed;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(248, 250, 252, 0.82));
}

.td-hub-entity-explorer__axis-card[data-count-authority="derived"],
.td-hub-entity-explorer__axis-card[data-count-authority="governed"],
.td-hub-entity-explorer__axis-card[data-count-source="json"],
.td-hub-entity-explorer__axis-card[data-count-source="taxonomy"] {
    position: relative;
}

.td-hub-entity-explorer__axis-card[data-count-authority="derived"]::after,
.td-hub-entity-explorer__axis-card[data-count-authority="governed"]::after,
.td-hub-entity-explorer__axis-card[data-count-source="json"]::after,
.td-hub-entity-explorer__axis-card[data-count-source="taxonomy"]::after {
    position: absolute;
    top: 0.72rem;
    right: 0.72rem;
    z-index: 1;
    max-width: calc(100% - 1.44rem);
    overflow: hidden;
    padding: 0.22rem 0.48rem;
    border: 1px solid rgba(29, 39, 51, 0.07);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 10px 22px -20px rgba(29, 39, 51, 0.65);
    color: #5f6a75;
    content: "Dati reali";
    font-size: 0.66rem;
    font-weight: 880;
    letter-spacing: 0.045em;
    line-height: 1;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.td-hub-entity-explorer__axis-card[data-count-authority="governed"]::after,
.td-hub-entity-explorer__axis-card[data-count-source="json"]::after {
    border-color: rgba(47, 111, 159, 0.18);
    background: rgba(47, 111, 159, 0.08);
    color: #2f6f9f;
    content: "JSON reale";
}

.td-hub-entity-explorer__axis-card[data-axis-coverage="uncovered"]::after,
.td-hub-entity-explorer__axis-card[data-count-authority="none"]::after {
    border-color: rgba(217, 78, 70, 0.18);
    background: rgba(217, 78, 70, 0.075);
    color: #a93d37;
    content: "Da collegare";
}

.td-hub-entity-explorer__axis-card--hierarchy[data-hierarchy-child-article-count]:not([data-hierarchy-child-article-count="0"]) {
    border-color: rgba(29, 39, 51, 0.12) !important;
}

.td-hub-entity-explorer__axis-card--hierarchy[data-hierarchy-child-article-count]:not([data-hierarchy-child-article-count="0"])::before {
    position: absolute;
    inset-block: 0.9rem;
    left: 0;
    width: 0.28rem;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(47, 111, 159, 0.68), rgba(217, 78, 70, 0.48));
    content: "";
}

.td-hub-entity-explorer__chip {
    transition: transform 0.2s var(--td-anim-bezier), background-color 0.2s var(--td-anim-bezier), box-shadow 0.2s var(--td-anim-bezier) !important;
}

@media (hover: hover) and (pointer: fine) {
    .td-hub-entity-explorer__chip:hover {
        transform: translateY(-2px) scale(1.02);
        box-shadow: 0 8px 16px -8px rgba(0, 0, 0, 0.15);
    }
}

@media (prefers-reduced-motion: reduce) {
    .td-hub-entity-explorer__card,
    .td-hub-entity-explorer__chip {
        transition: none !important;
    }

    .td-hub-entity-explorer__card:hover,
    .td-hub-entity-explorer__chip:hover {
        transform: none;
    }
}

@keyframes tdHubSkeletonPulse {
    0% { opacity: 0.65; background-color: rgba(226, 232, 240, 0.5); }
    50% { opacity: 1; background-color: rgba(203, 213, 225, 0.7); }
    100% { opacity: 0.65; background-color: rgba(226, 232, 240, 0.5); }
}

.td-hub-entity-explorer.is-loading .td-hub-entity-explorer__card,
.td-hub-entity-explorer.is-loading .td-hub-entity-explorer__chip {
    animation: tdHubSkeletonPulse 1.6s infinite ease-in-out !important;
    pointer-events: none;
    border-color: transparent !important;
    box-shadow: none !important;
}

.td-hub-entity-explorer.is-loading .td-hub-entity-explorer__card * {
    visibility: hidden !important;
}

.td-hub-entity-explorer__active-path-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.38rem 0.7rem;
    width: 100%;
}

.td-hub-entity-explorer__active-path-summary {
    color: #66717d;
    font-size: 0.74rem;
    font-weight: 760;
}

.td-hub-entity-explorer__active-path-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2rem;
    margin-inline-start: auto;
    padding: 0.36rem 0.68rem;
    border: 1px solid rgba(29, 39, 51, 0.12);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.82);
    color: #1d2733;
    font-size: 0.72rem;
    font-weight: 850;
    line-height: 1.1;
    text-decoration: none;
}

.td-hub-entity-explorer__active-path-clear:hover,
.td-hub-entity-explorer__active-path-clear:focus-visible {
    border-color: rgba(29, 39, 51, 0.34);
    background: #ffffff;
    text-decoration: underline;
}

@media (max-width: 640px) {
    .td-hub-entity-explorer__active-path-clear {
        width: 100%;
        margin-inline-start: 0;
    }
}
