:host {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.context-column {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

// ─── Header ───────────────────────────────────────────────────────────────────
.context-header {
    padding: 4px 6px 10px;
    flex-shrink: 0;
}

.context-header__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;

    h2 {
        margin: 0;
        font-size: 0.94rem;
        font-weight: 600;
        letter-spacing: -0.01em;
        color: var(--mat-sys-on-surface);
    }
}

.context-header__actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.context-header__action {
    width: 28px;
    height: 28px;
    line-height: 28px;
    flex-shrink: 0;
    padding: 0;

    &[disabled] {
        opacity: 0.48;
    }

    &--active mat-icon {
        color: var(--mat-sys-primary);
    }

    mat-icon {
        font-size: 18px;
        width: 18px;
        height: 18px;
        color: var(--mat-sys-on-surface-variant);
    }
}

.context-header__badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 5px;
    padding: 2px 0;
    border-radius: 999px;
    background: var(--mat-sys-surface-container);
    color: var(--mat-sys-on-surface-variant);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.context-sort-check {
    margin-left: auto;
}

.context-header p {
    margin: 4px 0 0;
    font-size: 0.78rem;
    color: var(--mat-sys-on-surface-variant);
}

// ─── Search Bar ──────────────────────────────────────────────────────────────
.context-search {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 6px 6px;
    padding: 0 10px;
    min-height: 36px;
    border-radius: 10px;
    border: 1px solid var(--app-search-border, var(--mat-sys-outline-variant));
    background: var(--app-search-bg, var(--mat-sys-surface-container));
    flex-shrink: 0;
    cursor: text;
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;

    &:focus-within {
        border-color: var(--mat-sys-primary);
        box-shadow: 0 0 0 3px
            color-mix(in srgb, var(--mat-sys-primary) 12%, transparent);
    }
}

.context-search__icon {
    font-size: 18px;
    width: 18px;
    height: 18px;
    color: var(--mat-sys-on-surface-variant);
    flex-shrink: 0;
}

.context-search input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    color: var(--mat-sys-on-surface);
    font: inherit;
    font-size: 0.84rem;
    width: 100%;
    min-width: 0;

    &::placeholder {
        color: var(--mat-sys-on-surface-variant);
        opacity: 0.6;
    }

    &::-webkit-search-cancel-button {
        display: none;
    }
}

.context-search__clear {
    width: 24px;
    height: 24px;
    min-width: 24px;
    line-height: 24px;
    flex-shrink: 0;
    padding: 0;

    mat-icon {
        font-size: 16px;
        width: 16px;
        height: 16px;
    }
}

// ─── Divider ──────────────────────────────────────────────────────────────────
.context-divider {
    height: 1px;
    background: var(--mat-sys-outline-variant);
    margin: 0 0 6px;
    opacity: 0.6;
    flex-shrink: 0;
}

// ─── Category List ────────────────────────────────────────────────────────────
app-workspace-context-category-view {
    display: block;
    min-height: 0;
    height: 100%;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--mat-sys-outline-variant) transparent;
}

.context-skeleton {
    display: grid;
    gap: 8px;
    padding: 4px 6px 2px;
    overflow: hidden;
}

.context-skeleton__row {
    display: grid;
    grid-template-columns: 12px minmax(0, 1fr) 28px;
    align-items: center;
    gap: 10px;
    min-height: 36px;
    padding: 0 10px;
    border-radius: 12px;
    background: color-mix(
        in srgb,
        var(--app-widget-header-bg, var(--mat-sys-surface-container-high)) 88%,
        var(--app-widget-bg, var(--mat-sys-surface-container)) 12%
    );
    border: 1px solid
        color-mix(
            in srgb,
            var(--app-widget-header-border, var(--mat-sys-outline-variant)) 96%,
            transparent
        );
}

.context-skeleton__dot,
.context-skeleton__label,
.context-skeleton__count {
    position: relative;
    overflow: hidden;
    background: color-mix(
        in srgb,
        var(--app-widget-header-bg, var(--mat-sys-surface-container-high)) 52%,
        var(--app-body-color, var(--mat-sys-on-surface-variant)) 48%
    );

    &::after {
        content: '';
        position: absolute;
        inset: 0;
        background: linear-gradient(
            100deg,
            transparent 8%,
            color-mix(
                    in srgb,
                    var(--app-heading-color, var(--mat-sys-on-surface)) 18%,
                    transparent
                )
                44%,
            transparent 74%
        );
        transform: translateX(-120%);
        animation: context-skeleton-shimmer 1.15s ease-in-out infinite;
    }
}

.context-skeleton__dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
}

.context-skeleton__label {
    height: 9px;
    border-radius: 999px;
}

.context-skeleton__count {
    justify-self: end;
    width: 22px;
    height: 9px;
    border-radius: 999px;
}

@keyframes context-skeleton-shimmer {
    100% {
        transform: translateX(120%);
    }
}
